From 6894dca64c04936d07048c0e8cbf7e25858548c3 Mon Sep 17 00:00:00 2001 From: lloyd Date: Fri, 10 Jan 2014 03:41:59 +0000 Subject: Move lib into src --- src/lib/engine/asm_engine/asm_engine.cpp | 72 ++++++++++++++++++++++++++++++++ src/lib/engine/asm_engine/asm_engine.h | 32 ++++++++++++++ src/lib/engine/asm_engine/info.txt | 11 +++++ 3 files changed, 115 insertions(+) create mode 100644 src/lib/engine/asm_engine/asm_engine.cpp create mode 100644 src/lib/engine/asm_engine/asm_engine.h create mode 100644 src/lib/engine/asm_engine/info.txt (limited to 'src/lib/engine/asm_engine') diff --git a/src/lib/engine/asm_engine/asm_engine.cpp b/src/lib/engine/asm_engine/asm_engine.cpp new file mode 100644 index 000000000..a43a3302d --- /dev/null +++ b/src/lib/engine/asm_engine/asm_engine.cpp @@ -0,0 +1,72 @@ +/* +* Assembly Implementation Engine +* (C) 1999-2010 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ + +#include + +#if defined(BOTAN_HAS_SERPENT_X86_32) + #include +#endif + +#if defined(BOTAN_HAS_MD4_X86_32) + #include +#endif + +#if defined(BOTAN_HAS_MD5_X86_32) + #include +#endif + +#if defined(BOTAN_HAS_SHA1_X86_64) + #include +#endif + +#if defined(BOTAN_HAS_SHA1_X86_32) + #include +#endif + +namespace Botan { + +BlockCipher* +Assembler_Engine::find_block_cipher(const SCAN_Name& request, + Algorithm_Factory&) const + { + if(request.algo_name() == "Serpent") + { +#if defined(BOTAN_HAS_SERPENT_X86_32) + return new Serpent_X86_32; +#endif + } + + return nullptr; + } + +HashFunction* +Assembler_Engine::find_hash(const SCAN_Name& request, + Algorithm_Factory&) const + { +#if defined(BOTAN_HAS_MD4_X86_32) + if(request.algo_name() == "MD4") + return new MD4_X86_32; +#endif + +#if defined(BOTAN_HAS_MD5_X86_32) + if(request.algo_name() == "MD5") + return new MD5_X86_32; +#endif + + if(request.algo_name() == "SHA-160") + { +#if defined(BOTAN_HAS_SHA1_X86_64) + return new SHA_160_X86_64; +#elif defined(BOTAN_HAS_SHA1_X86_32) + return new SHA_160_X86_32; +#endif + } + + return nullptr; + } + +} diff --git a/src/lib/engine/asm_engine/asm_engine.h b/src/lib/engine/asm_engine/asm_engine.h new file mode 100644 index 000000000..40fe5342f --- /dev/null +++ b/src/lib/engine/asm_engine/asm_engine.h @@ -0,0 +1,32 @@ +/* +* Assembly Implementation Engine +* (C) 1999-2010 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ + +#ifndef BOTAN_X86_32_ASM_ENGINE_H__ +#define BOTAN_X86_32_ASM_ENGINE_H__ + +#include + +namespace Botan { + +/** +* Engine for x86-32 specific implementations +*/ +class Assembler_Engine : public Engine + { + public: + std::string provider_name() const { return "asm"; } + + BlockCipher* find_block_cipher(const SCAN_Name&, + Algorithm_Factory&) const; + + HashFunction* find_hash(const SCAN_Name& request, + Algorithm_Factory&) const; + }; + +} + +#endif diff --git a/src/lib/engine/asm_engine/info.txt b/src/lib/engine/asm_engine/info.txt new file mode 100644 index 000000000..185656e3d --- /dev/null +++ b/src/lib/engine/asm_engine/info.txt @@ -0,0 +1,11 @@ +define ENGINE_ASSEMBLER 20131128 + +load_on dep + + +asm_engine.cpp + + + +asm_engine.h + -- cgit v1.2.3