aboutsummaryrefslogtreecommitdiffstats
path: root/src/engine
diff options
context:
space:
mode:
authorlloyd <[email protected]>2009-09-25 11:51:55 +0000
committerlloyd <[email protected]>2009-09-25 11:51:55 +0000
commit03f41b6ceb6e9dcfbe4b134239431de43afd7e6b (patch)
tree9ca56356954b58ac1aeffeca147f770db1c03956 /src/engine
parent7e839d037119055b572f40ce0cd882f85583db2e (diff)
Add runtime cpuid support. Check in the SSE2 engine that SSE2 is actually
existing on the current CPU before returning an object.
Diffstat (limited to 'src/engine')
-rw-r--r--src/engine/sse2_eng/eng_sse2.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/engine/sse2_eng/eng_sse2.cpp b/src/engine/sse2_eng/eng_sse2.cpp
index 9f68a070e..07c625c7c 100644
--- a/src/engine/sse2_eng/eng_sse2.cpp
+++ b/src/engine/sse2_eng/eng_sse2.cpp
@@ -6,6 +6,7 @@
*/
#include <botan/eng_sse2.h>
+#include <botan/cpuid.h>
#if defined(BOTAN_HAS_SHA1_SSE2)
#include <botan/sha1_sse2.h>
@@ -21,6 +22,9 @@ 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;
@@ -33,6 +37,9 @@ 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;