aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstate
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstate')
-rw-r--r--src/libstate/algo_factory.cpp5
-rw-r--r--src/libstate/engine/asm_engine/asm_engine.cpp70
-rw-r--r--src/libstate/engine/asm_engine/asm_engine.h26
-rw-r--r--src/libstate/engine/asm_engine/info.txt10
-rw-r--r--src/libstate/engine/def_engine/lookup_hash.cpp41
-rw-r--r--src/libstate/modules.cpp12
6 files changed, 125 insertions, 39 deletions
diff --git a/src/libstate/algo_factory.cpp b/src/libstate/algo_factory.cpp
index cbb3c8faa..019c79059 100644
--- a/src/libstate/algo_factory.cpp
+++ b/src/libstate/algo_factory.cpp
@@ -25,6 +25,7 @@ Algorithm_Factory::~Algorithm_Factory()
*/
void Algorithm_Factory::add_engine(Engine* engine)
{
+ printf("Add engine %s\n", engine->provider_name().c_str());
engines.push_back(engine);
}
@@ -52,7 +53,11 @@ Algorithm_Factory::prototype_hash_function(const SCAN_Name& request)
engines[i]->prototype_hash_function(request, *this);
if(algo)
+ {
+ printf("Got %s from %s\n", algo->name().c_str(),
+ engines[i]->provider_name().c_str());
return algo;
+ }
}
}
diff --git a/src/libstate/engine/asm_engine/asm_engine.cpp b/src/libstate/engine/asm_engine/asm_engine.cpp
new file mode 100644
index 000000000..8dfc93b2e
--- /dev/null
+++ b/src/libstate/engine/asm_engine/asm_engine.cpp
@@ -0,0 +1,70 @@
+/*************************************************
+* Assembly Implementation Engine Header File *
+* (C) 1999-2007 Jack Lloyd *
+*************************************************/
+
+#include <botan/asm_engine.h>
+#include <botan/hash.h>
+
+#if defined(BOTAN_HAS_MD4_IA32)
+ #include <botan/md4_ia32.h>
+#endif
+
+#if defined(BOTAN_HAS_MD5_IA32)
+ #include <botan/md5_ia32.h>
+#endif
+
+#if defined(BOTAN_HAS_SHA1_IA32)
+ #include <botan/sha1_ia32.h>
+#endif
+
+#if defined(BOTAN_HAS_SHA1_SSE2)
+ #include <botan/sha1_sse2.h>
+#endif
+
+#if defined(BOTAN_HAS_SHA1_AMD64)
+ #include <botan/sha1_amd64.h>
+#endif
+
+namespace Botan {
+
+/*
+BlockCipher* Assembler_Engine::find_block_cipher(const std::string&) const
+ {
+ return 0;
+ }
+*/
+
+HashFunction* Assembler_Engine::find_hash(const SCAN_Name& request,
+ Algorithm_Factory&) const
+ {
+#if defined(BOTAN_HAS_MD4_IA32)
+ if(request.algo_name() == "MD4")
+ return new MD4_IA32;
+#endif
+
+#if defined(BOTAN_HAS_MD5_IA32)
+ if(request.algo_name() == "MD5")
+ return new MD5_IA32;
+#endif
+
+#if defined(BOTAN_HAS_SHA1_SSE2) || \
+ defined(BOTAN_HAS_SHA1_AMD64) || \
+ defined(BOTAN_HAS_SHA1_IA32)
+
+ if(request.algo_name() == "SHA-160")
+ {
+#if defined(BOTAN_HAS_SHA1_SSE2)
+ return new SHA_160_SSE2;
+#elif defined(BOTAN_HAS_SHA1_AMD64)
+ return new SHA_160_AMD64;
+#elif defined(BOTAN_HAS_SHA1_IA32)
+ return new SHA_160_IA32;
+#endif
+ }
+#endif
+
+ return 0;
+ }
+
+}
diff --git a/src/libstate/engine/asm_engine/asm_engine.h b/src/libstate/engine/asm_engine/asm_engine.h
new file mode 100644
index 000000000..cb27e19c1
--- /dev/null
+++ b/src/libstate/engine/asm_engine/asm_engine.h
@@ -0,0 +1,26 @@
+/*************************************************
+* Assembly Implementation Engine Header File *
+* (C) 1999-2007 Jack Lloyd *
+*************************************************/
+
+#ifndef BOTAN_ASM_ENGINE_H__
+#define BOTAN_ASM_ENGINE_H__
+
+#include <botan/engine.h>
+
+namespace Botan {
+
+class BOTAN_DLL Assembler_Engine : public Engine
+ {
+ public:
+ std::string provider_name() const { return "asm"; }
+ private:
+ //BlockCipher* find_block_cipher(const std::string&) const;
+
+ HashFunction* find_hash(const SCAN_Name& reqeust,
+ Algorithm_Factory&) const;
+ };
+
+}
+
+#endif
diff --git a/src/libstate/engine/asm_engine/info.txt b/src/libstate/engine/asm_engine/info.txt
new file mode 100644
index 000000000..406b07412
--- /dev/null
+++ b/src/libstate/engine/asm_engine/info.txt
@@ -0,0 +1,10 @@
+realname "Assembler Engine"
+
+define ENGINE_ASSEMBLER
+
+load_on auto
+
+<add>
+asm_engine.cpp
+asm_engine.h
+</add>
diff --git a/src/libstate/engine/def_engine/lookup_hash.cpp b/src/libstate/engine/def_engine/lookup_hash.cpp
index 55ee922f9..0bfa08e3b 100644
--- a/src/libstate/engine/def_engine/lookup_hash.cpp
+++ b/src/libstate/engine/def_engine/lookup_hash.cpp
@@ -36,18 +36,10 @@
#include <botan/md4.h>
#endif
-#if defined(BOTAN_HAS_MD4_IA32)
- #include <botan/md4_ia32.h>
-#endif
-
#if defined(BOTAN_HAS_MD5)
#include <botan/md5.h>
#endif
-#if defined(BOTAN_HAS_MD5_IA32)
- #include <botan/md5_ia32.h>
-#endif
-
#if defined(BOTAN_HAS_RIPEMD_128)
#include <botan/rmd128.h>
#endif
@@ -60,18 +52,6 @@
#include <botan/sha160.h>
#endif
-#if defined(BOTAN_HAS_SHA1_IA32)
- #include <botan/sha1_ia32.h>
-#endif
-
-#if defined(BOTAN_HAS_SHA1_SSE2)
- #include <botan/sha1_sse2.h>
-#endif
-
-#if defined(BOTAN_HAS_SHA1_AMD64)
- #include <botan/sha1_amd64.h>
-#endif
-
#if defined(BOTAN_HAS_SHA2)
#include <botan/sha2_32.h>
#include <botan/sha2_64.h>
@@ -128,18 +108,12 @@ Default_Engine::find_hash(const SCAN_Name& request,
return new MD2;
#endif
-#if defined(BOTAN_HAS_MD4_IA32)
- if(request.algo_name() == "MD4")
- return new MD4_IA32;
-#elif defined(BOTAN_HAS_MD4)
+#if defined(BOTAN_HAS_MD4)
if(request.algo_name() == "MD4")
return new MD4;
#endif
-#if defined(BOTAN_HAS_MD5_IA32)
- if(request.algo_name() == "MD5")
- return new MD5_IA32;
-#elif defined(BOTAN_HAS_MD5)
+#if defined(BOTAN_HAS_MD5)
if(request.algo_name() == "MD5")
return new MD5;
#endif
@@ -154,16 +128,7 @@ Default_Engine::find_hash(const SCAN_Name& request,
return new RIPEMD_160;
#endif
-#if defined(BOTAN_HAS_SHA1_SSE2)
- if(request.algo_name() == "SHA-160")
- return new SHA_160_SSE2;
-#elif defined(BOTAN_HAS_SHA1_AMD64)
- if(request.algo_name() == "SHA-160")
- return new SHA_160_AMD64;
-#elif defined(BOTAN_HAS_SHA1_IA32)
- if(request.algo_name() == "SHA-160")
- return new SHA_160_IA32;
-#elif defined(BOTAN_HAS_SHA1)
+#if defined(BOTAN_HAS_SHA1)
if(request.algo_name() == "SHA-160")
return new SHA_160;
#endif
diff --git a/src/libstate/modules.cpp b/src/libstate/modules.cpp
index 8db202ddf..81508116d 100644
--- a/src/libstate/modules.cpp
+++ b/src/libstate/modules.cpp
@@ -5,7 +5,6 @@
#include <botan/modules.h>
#include <botan/defalloc.h>
-#include <botan/def_eng.h>
#include <botan/parsing.h>
#if defined(BOTAN_HAS_MUTEX_PTHREAD)
@@ -24,6 +23,13 @@
#include <botan/mmap_mem.h>
#endif
+// Default engine
+#include <botan/def_eng.h>
+
+#if defined(BOTAN_HAS_ENGINE_ASSEMBLER)
+ #include <botan/asm_engine.h>
+#endif
+
#if defined(BOTAN_HAS_ENGINE_GNU_MP)
#include <botan/eng_gmp.h>
#endif
@@ -107,6 +113,10 @@ std::vector<Engine*> Builtin_Modules::engines() const
#if defined(BOTAN_HAS_ENGINE_OPENSSL)
engines.push_back(new OpenSSL_Engine);
#endif
+
+#if defined(BOTAN_HAS_ENGINE_ASSEMBLER)
+ engines.push_back(new Assembler_Engine);
+#endif
}
engines.push_back(new Default_Engine);