diff options
author | lloyd <[email protected]> | 2009-10-29 01:40:55 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2009-10-29 01:40:55 +0000 |
commit | 78cb47ae1b43c51d6e91531f701ccf03fa8ea2c6 (patch) | |
tree | c71ff6ff187cc7ef15cf3c233ea7bdb43ef6f6df /src/engine | |
parent | ee169027c6cd30923aa30a735eb801836ee593d2 (diff) | |
parent | 1bc4d2fb37c8f1e6e94a65ec67062826393dda7f (diff) |
propagate from branch 'net.randombit.botan' (head 8fb69dd1c599ada1008c4cab2a6d502cbcc468e0)
to branch 'net.randombit.botan.general-simd' (head c05c9a6d398659891fb8cca170ed514ea7e6476d)
Diffstat (limited to 'src/engine')
-rw-r--r-- | src/engine/simd_engine/info.txt | 3 | ||||
-rw-r--r-- | src/engine/simd_engine/simd_engine.cpp | 54 | ||||
-rw-r--r-- | src/engine/simd_engine/simd_engine.h (renamed from src/engine/sse2_eng/eng_sse2.h) | 8 | ||||
-rw-r--r-- | src/engine/sse2_eng/eng_sse2.cpp | 51 | ||||
-rw-r--r-- | src/engine/sse2_eng/info.txt | 21 |
5 files changed, 61 insertions, 76 deletions
diff --git a/src/engine/simd_engine/info.txt b/src/engine/simd_engine/info.txt new file mode 100644 index 000000000..b0523285f --- /dev/null +++ b/src/engine/simd_engine/info.txt @@ -0,0 +1,3 @@ +define ENGINE_SIMD + +load_on dep diff --git a/src/engine/simd_engine/simd_engine.cpp b/src/engine/simd_engine/simd_engine.cpp new file mode 100644 index 000000000..7e15f9ec1 --- /dev/null +++ b/src/engine/simd_engine/simd_engine.cpp @@ -0,0 +1,54 @@ +/** +* SIMD Engine +* (C) 1999-2009 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ + +#include <botan/simd_engine.h> +#include <botan/cpuid.h> + +#if defined(BOTAN_HAS_SERPENT_SIMD) + #include <botan/serp_simd.h> +#endif + +#if defined(BOTAN_HAS_XTEA_SIMD) + #include <botan/xtea_simd.h> +#endif + +#if defined(BOTAN_HAS_SHA1_SSE2) + #include <botan/sha1_sse2.h> +#endif + +namespace Botan { + +BlockCipher* +SIMD_Engine::find_block_cipher(const SCAN_Name& request, + Algorithm_Factory&) const + { +#if defined(BOTAN_HAS_SERPENT_SIMD) + if(request.algo_name() == "Serpent") + return new Serpent_SIMD; +#endif + +#if defined(BOTAN_HAS_XTEA_SIMD) + if(request.algo_name() == "XTEA") + return new XTEA_SIMD; +#endif + + return 0; + } + +HashFunction* +SIMD_Engine::find_hash(const SCAN_Name& request, + Algorithm_Factory&) const + { +#if defined(BOTAN_HAS_SHA1_SSE2) + if(request.algo_name() == "SHA-160" && CPUID::has_sse2()) + return new SHA_160_SSE2; +#endif + + return 0; + } + +} diff --git a/src/engine/sse2_eng/eng_sse2.h b/src/engine/simd_engine/simd_engine.h index c6b0ce889..f7df6ff77 100644 --- a/src/engine/sse2_eng/eng_sse2.h +++ b/src/engine/simd_engine/simd_engine.h @@ -1,18 +1,18 @@ /** -* SSE2 Assembly Engine +* SIMD Assembly Engine * (C) 1999-2009 Jack Lloyd * * Distributed under the terms of the Botan license */ -#ifndef BOTAN_SSE2_ASM_ENGINE_H__ -#define BOTAN_SSE2_ASM_ENGINE_H__ +#ifndef BOTAN_SIMD_ENGINE_H__ +#define BOTAN_SIMD_ENGINE_H__ #include <botan/engine.h> namespace Botan { -class BOTAN_DLL SSE2_Assembler_Engine : public Engine +class BOTAN_DLL SIMD_Engine : public Engine { public: std::string provider_name() const { return "sse2"; } diff --git a/src/engine/sse2_eng/eng_sse2.cpp b/src/engine/sse2_eng/eng_sse2.cpp deleted file mode 100644 index 07c625c7c..000000000 --- a/src/engine/sse2_eng/eng_sse2.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/** -* SSE2 Assembly Engine -* (C) 1999-2009 Jack Lloyd -* -* Distributed under the terms of the Botan license -*/ - -#include <botan/eng_sse2.h> -#include <botan/cpuid.h> - -#if defined(BOTAN_HAS_SHA1_SSE2) - #include <botan/sha1_sse2.h> -#endif - -#if defined(BOTAN_HAS_SERPENT_SSE2) - #include <botan/serp_sse2.h> -#endif - -namespace Botan { - -BlockCipher* -SSE2_Assembler_Engine::find_block_cipher(const SCAN_Name& request, - Algorithm_Factory&) const - { - if(!CPUID::has_sse2()) - return 0; - -#if defined(BOTAN_HAS_SERPENT_SSE2) - if(request.algo_name() == "Serpent") - return new Serpent_SSE2; -#endif - - return 0; - } - -HashFunction* -SSE2_Assembler_Engine::find_hash(const SCAN_Name& request, - Algorithm_Factory&) const - { - if(!CPUID::has_sse2()) - return 0; - -#if defined(BOTAN_HAS_SHA1_SSE2) - if(request.algo_name() == "SHA-160") - return new SHA_160_SSE2; -#endif - - return 0; - } - -} diff --git a/src/engine/sse2_eng/info.txt b/src/engine/sse2_eng/info.txt deleted file mode 100644 index 43df92343..000000000 --- a/src/engine/sse2_eng/info.txt +++ /dev/null @@ -1,21 +0,0 @@ -define ENGINE_SSE2_ASSEMBLER - -load_on dep - -<add> -eng_sse2.cpp -eng_sse2.h -</add> - -<arch> -pentium-m -pentium4 -prescott -amd64 -</arch> - -<cc> -gcc -icc -msvc -</cc> |