aboutsummaryrefslogtreecommitdiffstats
path: root/src/engine/simd_engine
diff options
context:
space:
mode:
authorlloyd <[email protected]>2009-10-29 01:40:43 +0000
committerlloyd <[email protected]>2009-10-29 01:40:43 +0000
commit1bc4d2fb37c8f1e6e94a65ec67062826393dda7f (patch)
treea6d686a796d255d0e1b55ac341d79236a41b018f /src/engine/simd_engine
parent16adc6a5424aad033a18bae872586a52e54d7d8e (diff)
Rename SSE2 stuff to be generally SIMD since it supports at least SSE2
and Altivec (though Altivec is seemingly slower ATM...)
Diffstat (limited to 'src/engine/simd_engine')
-rw-r--r--src/engine/simd_engine/info.txt5
-rw-r--r--src/engine/simd_engine/simd_engine.cpp54
-rw-r--r--src/engine/simd_engine/simd_engine.h29
3 files changed, 88 insertions, 0 deletions
diff --git a/src/engine/simd_engine/info.txt b/src/engine/simd_engine/info.txt
new file mode 100644
index 000000000..b19664491
--- /dev/null
+++ b/src/engine/simd_engine/info.txt
@@ -0,0 +1,5 @@
+realname "SIMD Engine"
+
+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/simd_engine/simd_engine.h b/src/engine/simd_engine/simd_engine.h
new file mode 100644
index 000000000..f7df6ff77
--- /dev/null
+++ b/src/engine/simd_engine/simd_engine.h
@@ -0,0 +1,29 @@
+/**
+* SIMD Assembly Engine
+* (C) 1999-2009 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
+
+#ifndef BOTAN_SIMD_ENGINE_H__
+#define BOTAN_SIMD_ENGINE_H__
+
+#include <botan/engine.h>
+
+namespace Botan {
+
+class BOTAN_DLL SIMD_Engine : public Engine
+ {
+ public:
+ std::string provider_name() const { return "sse2"; }
+ private:
+ BlockCipher* find_block_cipher(const SCAN_Name&,
+ Algorithm_Factory&) const;
+
+ HashFunction* find_hash(const SCAN_Name& reqeust,
+ Algorithm_Factory&) const;
+ };
+
+}
+
+#endif