aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/algo_factory/algo_cache.h8
-rw-r--r--src/algo_factory/algo_factory.cpp2
-rw-r--r--src/algo_factory/algo_factory.h2
-rw-r--r--src/engine/amd64_eng/eng_amd64.cpp (renamed from src/libstate/engine/amd64_eng/eng_amd64.cpp)0
-rw-r--r--src/engine/amd64_eng/eng_amd64.h (renamed from src/libstate/engine/amd64_eng/eng_amd64.h)0
-rw-r--r--src/engine/amd64_eng/info.txt (renamed from src/libstate/engine/amd64_eng/info.txt)0
-rw-r--r--src/engine/def_engine/def_eng.h (renamed from src/libstate/engine/def_engine/def_eng.h)0
-rw-r--r--src/engine/def_engine/def_mode.cpp (renamed from src/libstate/engine/def_engine/def_mode.cpp)0
-rw-r--r--src/engine/def_engine/def_pk_ops.cpp (renamed from src/libstate/engine/def_engine/def_pk_ops.cpp)0
-rw-r--r--src/engine/def_engine/def_powm.cpp (renamed from src/libstate/engine/def_engine/def_powm.cpp)0
-rw-r--r--src/engine/def_engine/info.txt (renamed from src/libstate/engine/def_engine/info.txt)0
-rw-r--r--src/engine/def_engine/lookup_block.cpp (renamed from src/libstate/engine/def_engine/lookup_block.cpp)0
-rw-r--r--src/engine/def_engine/lookup_hash.cpp (renamed from src/libstate/engine/def_engine/lookup_hash.cpp)0
-rw-r--r--src/engine/def_engine/lookup_mac.cpp (renamed from src/libstate/engine/def_engine/lookup_mac.cpp)0
-rw-r--r--src/engine/def_engine/lookup_stream.cpp (renamed from src/libstate/engine/def_engine/lookup_stream.cpp)0
-rw-r--r--src/engine/engine.h (renamed from src/libstate/engine/engine.h)99
-rw-r--r--src/engine/gnump/eng_gmp.h (renamed from src/libstate/engine/gnump/eng_gmp.h)0
-rw-r--r--src/engine/gnump/gmp_dh.cpp (renamed from src/libstate/engine/gnump/gmp_dh.cpp)0
-rw-r--r--src/engine/gnump/gmp_dsa.cpp (renamed from src/libstate/engine/gnump/gmp_dsa.cpp)0
-rw-r--r--src/engine/gnump/gmp_elg.cpp (renamed from src/libstate/engine/gnump/gmp_elg.cpp)0
-rw-r--r--src/engine/gnump/gmp_if.cpp (renamed from src/libstate/engine/gnump/gmp_if.cpp)0
-rw-r--r--src/engine/gnump/gmp_mem.cpp (renamed from src/libstate/engine/gnump/gmp_mem.cpp)0
-rw-r--r--src/engine/gnump/gmp_nr.cpp (renamed from src/libstate/engine/gnump/gmp_nr.cpp)0
-rw-r--r--src/engine/gnump/gmp_powm.cpp (renamed from src/libstate/engine/gnump/gmp_powm.cpp)0
-rw-r--r--src/engine/gnump/gmp_wrap.cpp (renamed from src/libstate/engine/gnump/gmp_wrap.cpp)0
-rw-r--r--src/engine/gnump/gmp_wrap.h (renamed from src/libstate/engine/gnump/gmp_wrap.h)0
-rw-r--r--src/engine/gnump/info.txt (renamed from src/libstate/engine/gnump/info.txt)0
-rw-r--r--src/engine/ia32_eng/eng_ia32.cpp (renamed from src/libstate/engine/ia32_eng/eng_ia32.cpp)0
-rw-r--r--src/engine/ia32_eng/eng_ia32.h (renamed from src/libstate/engine/ia32_eng/eng_ia32.h)0
-rw-r--r--src/engine/ia32_eng/info.txt (renamed from src/libstate/engine/ia32_eng/info.txt)0
-rw-r--r--src/engine/info.txt (renamed from src/libstate/engine/info.txt)2
-rw-r--r--src/engine/openssl/arc4_openssl.cpp (renamed from src/libstate/engine/openssl/arc4_openssl.cpp)0
-rw-r--r--src/engine/openssl/bn_powm.cpp (renamed from src/libstate/engine/openssl/bn_powm.cpp)0
-rw-r--r--src/engine/openssl/bn_wrap.cpp (renamed from src/libstate/engine/openssl/bn_wrap.cpp)0
-rw-r--r--src/engine/openssl/bn_wrap.h (renamed from src/libstate/engine/openssl/bn_wrap.h)0
-rw-r--r--src/engine/openssl/eng_ossl.h (renamed from src/libstate/engine/openssl/eng_ossl.h)0
-rw-r--r--src/engine/openssl/info.txt (renamed from src/libstate/engine/openssl/info.txt)0
-rw-r--r--src/engine/openssl/ossl_bc.cpp (renamed from src/libstate/engine/openssl/ossl_bc.cpp)0
-rw-r--r--src/engine/openssl/ossl_dh.cpp (renamed from src/libstate/engine/openssl/ossl_dh.cpp)0
-rw-r--r--src/engine/openssl/ossl_dsa.cpp (renamed from src/libstate/engine/openssl/ossl_dsa.cpp)0
-rw-r--r--src/engine/openssl/ossl_elg.cpp (renamed from src/libstate/engine/openssl/ossl_elg.cpp)0
-rw-r--r--src/engine/openssl/ossl_if.cpp (renamed from src/libstate/engine/openssl/ossl_if.cpp)0
-rw-r--r--src/engine/openssl/ossl_md.cpp (renamed from src/libstate/engine/openssl/ossl_md.cpp)0
-rw-r--r--src/engine/openssl/ossl_nr.cpp (renamed from src/libstate/engine/openssl/ossl_nr.cpp)0
-rw-r--r--src/engine/sse2_eng/eng_sse2.cpp (renamed from src/libstate/engine/sse2_eng/eng_sse2.cpp)0
-rw-r--r--src/engine/sse2_eng/eng_sse2.h (renamed from src/libstate/engine/sse2_eng/eng_sse2.h)0
-rw-r--r--src/engine/sse2_eng/info.txt (renamed from src/libstate/engine/sse2_eng/info.txt)0
-rw-r--r--src/libstate/engine/engine.cpp202
-rw-r--r--src/libstate/info.txt2
-rw-r--r--src/libstate/pk_engine.cpp (renamed from src/libstate/engine/pk_engine.cpp)3
-rw-r--r--src/libstate/pk_engine.h92
51 files changed, 128 insertions, 284 deletions
diff --git a/src/algo_factory/algo_cache.h b/src/algo_factory/algo_cache.h
index dafa59c3e..a77828718 100644
--- a/src/algo_factory/algo_cache.h
+++ b/src/algo_factory/algo_cache.h
@@ -7,12 +7,14 @@
#include <botan/scan_name.h>
#include <botan/mutex.h>
-#include <stdexcept>
-#include <map>
#include <string>
+#include <map>
namespace Botan {
+/**
+* Algorithm_Cache (used by Algorithm_Factory)
+*/
template<typename T>
class Algorithm_Cache
{
@@ -35,7 +37,6 @@ class Algorithm_Cache
Mutex* mutex;
std::map<std::string, std::string> aliases;
std::map<std::string, std::map<std::string, T*> > algorithms;
-
};
/**
@@ -84,7 +85,6 @@ const T* Algorithm_Cache<T>::get(const SCAN_Name& request)
}
else // no specific provider requested: pick one
{
- printf("No specific provider requested for %s\n", request.as_string().c_str());
provider_iterator provider = algo->second.begin();
while(provider != algo->second.end())
diff --git a/src/algo_factory/algo_factory.cpp b/src/algo_factory/algo_factory.cpp
index e2debf7c9..e30d6d98b 100644
--- a/src/algo_factory/algo_factory.cpp
+++ b/src/algo_factory/algo_factory.cpp
@@ -18,7 +18,6 @@ Algorithm Factory
namespace Botan {
Algorithm_Factory::Algorithm_Factory(Mutex_Factory& mf) :
- mutex_factory(mf),
block_cipher_cache(mf.make()),
stream_cipher_cache(mf.make()),
hash_cache(mf.make()),
@@ -41,7 +40,6 @@ Algorithm_Factory::~Algorithm_Factory()
*/
void Algorithm_Factory::add_engine(Engine* engine)
{
- engine->initialize(mutex_factory);
engines.insert(engines.begin(), engine);
}
diff --git a/src/algo_factory/algo_factory.h b/src/algo_factory/algo_factory.h
index 64b2128ec..07a8c93f1 100644
--- a/src/algo_factory/algo_factory.h
+++ b/src/algo_factory/algo_factory.h
@@ -68,8 +68,6 @@ class BOTAN_DLL Algorithm_Factory
void add_mac(MessageAuthenticationCode* mac,
const std::string& provider);
private:
- Mutex_Factory& mutex_factory;
-
class Engine* get_engine_n(u32bit) const;
std::vector<class Engine*> engines;
diff --git a/src/libstate/engine/amd64_eng/eng_amd64.cpp b/src/engine/amd64_eng/eng_amd64.cpp
index bdc73fdd6..bdc73fdd6 100644
--- a/src/libstate/engine/amd64_eng/eng_amd64.cpp
+++ b/src/engine/amd64_eng/eng_amd64.cpp
diff --git a/src/libstate/engine/amd64_eng/eng_amd64.h b/src/engine/amd64_eng/eng_amd64.h
index efd8c2b76..efd8c2b76 100644
--- a/src/libstate/engine/amd64_eng/eng_amd64.h
+++ b/src/engine/amd64_eng/eng_amd64.h
diff --git a/src/libstate/engine/amd64_eng/info.txt b/src/engine/amd64_eng/info.txt
index 1d0283ad6..1d0283ad6 100644
--- a/src/libstate/engine/amd64_eng/info.txt
+++ b/src/engine/amd64_eng/info.txt
diff --git a/src/libstate/engine/def_engine/def_eng.h b/src/engine/def_engine/def_eng.h
index 0c95c08c5..0c95c08c5 100644
--- a/src/libstate/engine/def_engine/def_eng.h
+++ b/src/engine/def_engine/def_eng.h
diff --git a/src/libstate/engine/def_engine/def_mode.cpp b/src/engine/def_engine/def_mode.cpp
index 7933fbb84..7933fbb84 100644
--- a/src/libstate/engine/def_engine/def_mode.cpp
+++ b/src/engine/def_engine/def_mode.cpp
diff --git a/src/libstate/engine/def_engine/def_pk_ops.cpp b/src/engine/def_engine/def_pk_ops.cpp
index 5e29e110f..5e29e110f 100644
--- a/src/libstate/engine/def_engine/def_pk_ops.cpp
+++ b/src/engine/def_engine/def_pk_ops.cpp
diff --git a/src/libstate/engine/def_engine/def_powm.cpp b/src/engine/def_engine/def_powm.cpp
index 38aca901c..38aca901c 100644
--- a/src/libstate/engine/def_engine/def_powm.cpp
+++ b/src/engine/def_engine/def_powm.cpp
diff --git a/src/libstate/engine/def_engine/info.txt b/src/engine/def_engine/info.txt
index 503a4392f..503a4392f 100644
--- a/src/libstate/engine/def_engine/info.txt
+++ b/src/engine/def_engine/info.txt
diff --git a/src/libstate/engine/def_engine/lookup_block.cpp b/src/engine/def_engine/lookup_block.cpp
index 64a969dce..64a969dce 100644
--- a/src/libstate/engine/def_engine/lookup_block.cpp
+++ b/src/engine/def_engine/lookup_block.cpp
diff --git a/src/libstate/engine/def_engine/lookup_hash.cpp b/src/engine/def_engine/lookup_hash.cpp
index 48ed8bc04..48ed8bc04 100644
--- a/src/libstate/engine/def_engine/lookup_hash.cpp
+++ b/src/engine/def_engine/lookup_hash.cpp
diff --git a/src/libstate/engine/def_engine/lookup_mac.cpp b/src/engine/def_engine/lookup_mac.cpp
index ae44bbe3d..ae44bbe3d 100644
--- a/src/libstate/engine/def_engine/lookup_mac.cpp
+++ b/src/engine/def_engine/lookup_mac.cpp
diff --git a/src/libstate/engine/def_engine/lookup_stream.cpp b/src/engine/def_engine/lookup_stream.cpp
index e7f1ff41d..e7f1ff41d 100644
--- a/src/libstate/engine/def_engine/lookup_stream.cpp
+++ b/src/engine/def_engine/lookup_stream.cpp
diff --git a/src/libstate/engine/engine.h b/src/engine/engine.h
index f25eb0c1d..6cb63fa36 100644
--- a/src/libstate/engine/engine.h
+++ b/src/engine/engine.h
@@ -7,12 +7,12 @@
#define BOTAN_ENGINE_H__
#include <botan/scan_name.h>
-#include <botan/mutex.h>
#include <botan/block_cipher.h>
#include <botan/stream_cipher.h>
#include <botan/hash.h>
#include <botan/mac.h>
+#include <botan/bigint.h>
#include <utility>
#include <map>
@@ -59,14 +59,33 @@ class Modular_Exponentiator;
class BOTAN_DLL Engine
{
public:
- template<typename T>
- class BOTAN_DLL Algorithm_Cache
- {
- public:
- virtual T* get(const std::string&) const = 0;
- virtual void add(T* algo, const std::string& = "") const = 0;
- virtual ~Algorithm_Cache() {}
- };
+ virtual ~Engine() {}
+
+ virtual std::string provider_name() const = 0;
+
+ // Lookup functions
+ virtual BlockCipher*
+ find_block_cipher(const SCAN_Name&, Algorithm_Factory&) const
+ { return 0; }
+
+ virtual StreamCipher*
+ find_stream_cipher(const SCAN_Name&, Algorithm_Factory&) const
+ { return 0; }
+
+ virtual HashFunction*
+ find_hash(const SCAN_Name&, Algorithm_Factory&) const
+ { return 0; }
+
+ virtual MessageAuthenticationCode*
+ find_mac(const SCAN_Name&, Algorithm_Factory&) const
+ { return 0; }
+
+ virtual Modular_Exponentiator*
+ mod_exp(const BigInt&, Power_Mod::Usage_Hints) const
+ { return 0; }
+
+ virtual Keyed_Filter* get_cipher(const std::string&, Cipher_Dir)
+ { return 0; }
#if defined(BOTAN_HAS_IF_PUBLIC_KEY_FAMILY)
virtual IF_Operation* if_op(const BigInt&, const BigInt&, const BigInt&,
@@ -111,68 +130,6 @@ class BOTAN_DLL Engine
const PointGFp&) const
{ return 0; }
#endif
-
- virtual Modular_Exponentiator* mod_exp(const BigInt&,
- Power_Mod::Usage_Hints) const
- { return 0; }
-
- virtual Keyed_Filter* get_cipher(const std::string&, Cipher_Dir)
- { return 0; }
-
- // Prototype object accessors
- const BlockCipher*
- prototype_block_cipher(const SCAN_Name& request,
- Algorithm_Factory& af) const;
-
- const StreamCipher*
- prototype_stream_cipher(const SCAN_Name& request,
- Algorithm_Factory& af) const;
-
- const HashFunction*
- prototype_hash_function(const SCAN_Name& request,
- Algorithm_Factory& af) const;
-
- const MessageAuthenticationCode*
- prototype_mac(const SCAN_Name& request,
- Algorithm_Factory& af) const;
-
- // Lookup functions
- virtual BlockCipher* find_block_cipher(const SCAN_Name&,
- Algorithm_Factory&) const
- { return 0; }
-
- virtual StreamCipher* find_stream_cipher(const SCAN_Name&,
- Algorithm_Factory&) const
- { return 0; }
-
- virtual HashFunction* find_hash(const SCAN_Name&,
- Algorithm_Factory&) const
- { return 0; }
-
- virtual MessageAuthenticationCode* find_mac(const SCAN_Name&,
- Algorithm_Factory&) const
- { return 0; }
-
- // Add new algorithms
- void add_algorithm(BlockCipher*) const;
- void add_algorithm(StreamCipher*) const;
- void add_algorithm(HashFunction*) const;
- void add_algorithm(MessageAuthenticationCode*) const;
-
- // Engine information
- virtual bool can_add_algorithms() { return false; }
- virtual std::string provider_name() const = 0;
-
- void initialize(Mutex_Factory& mf);
-
- Engine();
- virtual ~Engine();
-
- private:
- Algorithm_Cache<BlockCipher>* cache_of_bc;
- Algorithm_Cache<StreamCipher>* cache_of_sc;
- Algorithm_Cache<HashFunction>* cache_of_hf;
- Algorithm_Cache<MessageAuthenticationCode>* cache_of_mac;
};
namespace Engine_Core {
diff --git a/src/libstate/engine/gnump/eng_gmp.h b/src/engine/gnump/eng_gmp.h
index 8edaae374..8edaae374 100644
--- a/src/libstate/engine/gnump/eng_gmp.h
+++ b/src/engine/gnump/eng_gmp.h
diff --git a/src/libstate/engine/gnump/gmp_dh.cpp b/src/engine/gnump/gmp_dh.cpp
index ef2732626..ef2732626 100644
--- a/src/libstate/engine/gnump/gmp_dh.cpp
+++ b/src/engine/gnump/gmp_dh.cpp
diff --git a/src/libstate/engine/gnump/gmp_dsa.cpp b/src/engine/gnump/gmp_dsa.cpp
index 209c6e0a6..209c6e0a6 100644
--- a/src/libstate/engine/gnump/gmp_dsa.cpp
+++ b/src/engine/gnump/gmp_dsa.cpp
diff --git a/src/libstate/engine/gnump/gmp_elg.cpp b/src/engine/gnump/gmp_elg.cpp
index 63e9440ff..63e9440ff 100644
--- a/src/libstate/engine/gnump/gmp_elg.cpp
+++ b/src/engine/gnump/gmp_elg.cpp
diff --git a/src/libstate/engine/gnump/gmp_if.cpp b/src/engine/gnump/gmp_if.cpp
index a4a4d0476..a4a4d0476 100644
--- a/src/libstate/engine/gnump/gmp_if.cpp
+++ b/src/engine/gnump/gmp_if.cpp
diff --git a/src/libstate/engine/gnump/gmp_mem.cpp b/src/engine/gnump/gmp_mem.cpp
index 91ba94dd7..91ba94dd7 100644
--- a/src/libstate/engine/gnump/gmp_mem.cpp
+++ b/src/engine/gnump/gmp_mem.cpp
diff --git a/src/libstate/engine/gnump/gmp_nr.cpp b/src/engine/gnump/gmp_nr.cpp
index 97b7e5554..97b7e5554 100644
--- a/src/libstate/engine/gnump/gmp_nr.cpp
+++ b/src/engine/gnump/gmp_nr.cpp
diff --git a/src/libstate/engine/gnump/gmp_powm.cpp b/src/engine/gnump/gmp_powm.cpp
index a5e3d1c0d..a5e3d1c0d 100644
--- a/src/libstate/engine/gnump/gmp_powm.cpp
+++ b/src/engine/gnump/gmp_powm.cpp
diff --git a/src/libstate/engine/gnump/gmp_wrap.cpp b/src/engine/gnump/gmp_wrap.cpp
index 4c73c2562..4c73c2562 100644
--- a/src/libstate/engine/gnump/gmp_wrap.cpp
+++ b/src/engine/gnump/gmp_wrap.cpp
diff --git a/src/libstate/engine/gnump/gmp_wrap.h b/src/engine/gnump/gmp_wrap.h
index e2a420e6b..e2a420e6b 100644
--- a/src/libstate/engine/gnump/gmp_wrap.h
+++ b/src/engine/gnump/gmp_wrap.h
diff --git a/src/libstate/engine/gnump/info.txt b/src/engine/gnump/info.txt
index 33fa720f5..33fa720f5 100644
--- a/src/libstate/engine/gnump/info.txt
+++ b/src/engine/gnump/info.txt
diff --git a/src/libstate/engine/ia32_eng/eng_ia32.cpp b/src/engine/ia32_eng/eng_ia32.cpp
index 0378c094e..0378c094e 100644
--- a/src/libstate/engine/ia32_eng/eng_ia32.cpp
+++ b/src/engine/ia32_eng/eng_ia32.cpp
diff --git a/src/libstate/engine/ia32_eng/eng_ia32.h b/src/engine/ia32_eng/eng_ia32.h
index 587728f2f..587728f2f 100644
--- a/src/libstate/engine/ia32_eng/eng_ia32.h
+++ b/src/engine/ia32_eng/eng_ia32.h
diff --git a/src/libstate/engine/ia32_eng/info.txt b/src/engine/ia32_eng/info.txt
index b9e3bddd5..b9e3bddd5 100644
--- a/src/libstate/engine/ia32_eng/info.txt
+++ b/src/engine/ia32_eng/info.txt
diff --git a/src/libstate/engine/info.txt b/src/engine/info.txt
index f66d231e3..0a22ec285 100644
--- a/src/libstate/engine/info.txt
+++ b/src/engine/info.txt
@@ -5,7 +5,5 @@ define ENGINES
load_on auto
<add>
-pk_engine.cpp
-engine.cpp
engine.h
</add>
diff --git a/src/libstate/engine/openssl/arc4_openssl.cpp b/src/engine/openssl/arc4_openssl.cpp
index 09fb52919..09fb52919 100644
--- a/src/libstate/engine/openssl/arc4_openssl.cpp
+++ b/src/engine/openssl/arc4_openssl.cpp
diff --git a/src/libstate/engine/openssl/bn_powm.cpp b/src/engine/openssl/bn_powm.cpp
index f54411240..f54411240 100644
--- a/src/libstate/engine/openssl/bn_powm.cpp
+++ b/src/engine/openssl/bn_powm.cpp
diff --git a/src/libstate/engine/openssl/bn_wrap.cpp b/src/engine/openssl/bn_wrap.cpp
index 4f7ea0078..4f7ea0078 100644
--- a/src/libstate/engine/openssl/bn_wrap.cpp
+++ b/src/engine/openssl/bn_wrap.cpp
diff --git a/src/libstate/engine/openssl/bn_wrap.h b/src/engine/openssl/bn_wrap.h
index e8464e74e..e8464e74e 100644
--- a/src/libstate/engine/openssl/bn_wrap.h
+++ b/src/engine/openssl/bn_wrap.h
diff --git a/src/libstate/engine/openssl/eng_ossl.h b/src/engine/openssl/eng_ossl.h
index 7f345f0ff..7f345f0ff 100644
--- a/src/libstate/engine/openssl/eng_ossl.h
+++ b/src/engine/openssl/eng_ossl.h
diff --git a/src/libstate/engine/openssl/info.txt b/src/engine/openssl/info.txt
index 1d8ff7fce..1d8ff7fce 100644
--- a/src/libstate/engine/openssl/info.txt
+++ b/src/engine/openssl/info.txt
diff --git a/src/libstate/engine/openssl/ossl_bc.cpp b/src/engine/openssl/ossl_bc.cpp
index a9110f008..a9110f008 100644
--- a/src/libstate/engine/openssl/ossl_bc.cpp
+++ b/src/engine/openssl/ossl_bc.cpp
diff --git a/src/libstate/engine/openssl/ossl_dh.cpp b/src/engine/openssl/ossl_dh.cpp
index 290b95622..290b95622 100644
--- a/src/libstate/engine/openssl/ossl_dh.cpp
+++ b/src/engine/openssl/ossl_dh.cpp
diff --git a/src/libstate/engine/openssl/ossl_dsa.cpp b/src/engine/openssl/ossl_dsa.cpp
index 2757234e2..2757234e2 100644
--- a/src/libstate/engine/openssl/ossl_dsa.cpp
+++ b/src/engine/openssl/ossl_dsa.cpp
diff --git a/src/libstate/engine/openssl/ossl_elg.cpp b/src/engine/openssl/ossl_elg.cpp
index 25d628ba8..25d628ba8 100644
--- a/src/libstate/engine/openssl/ossl_elg.cpp
+++ b/src/engine/openssl/ossl_elg.cpp
diff --git a/src/libstate/engine/openssl/ossl_if.cpp b/src/engine/openssl/ossl_if.cpp
index 08a43e63e..08a43e63e 100644
--- a/src/libstate/engine/openssl/ossl_if.cpp
+++ b/src/engine/openssl/ossl_if.cpp
diff --git a/src/libstate/engine/openssl/ossl_md.cpp b/src/engine/openssl/ossl_md.cpp
index 4e28c515e..4e28c515e 100644
--- a/src/libstate/engine/openssl/ossl_md.cpp
+++ b/src/engine/openssl/ossl_md.cpp
diff --git a/src/libstate/engine/openssl/ossl_nr.cpp b/src/engine/openssl/ossl_nr.cpp
index 210e2fec2..210e2fec2 100644
--- a/src/libstate/engine/openssl/ossl_nr.cpp
+++ b/src/engine/openssl/ossl_nr.cpp
diff --git a/src/libstate/engine/sse2_eng/eng_sse2.cpp b/src/engine/sse2_eng/eng_sse2.cpp
index cf5a65114..cf5a65114 100644
--- a/src/libstate/engine/sse2_eng/eng_sse2.cpp
+++ b/src/engine/sse2_eng/eng_sse2.cpp
diff --git a/src/libstate/engine/sse2_eng/eng_sse2.h b/src/engine/sse2_eng/eng_sse2.h
index affbaff2e..affbaff2e 100644
--- a/src/libstate/engine/sse2_eng/eng_sse2.h
+++ b/src/engine/sse2_eng/eng_sse2.h
diff --git a/src/libstate/engine/sse2_eng/info.txt b/src/engine/sse2_eng/info.txt
index c44180ca4..c44180ca4 100644
--- a/src/libstate/engine/sse2_eng/info.txt
+++ b/src/engine/sse2_eng/info.txt
diff --git a/src/libstate/engine/engine.cpp b/src/libstate/engine/engine.cpp
deleted file mode 100644
index c6a82f5fc..000000000
--- a/src/libstate/engine/engine.cpp
+++ /dev/null
@@ -1,202 +0,0 @@
-/**
-* Engine Base Class
-* (C) 1999-2007 Jack Lloyd
-*/
-
-#include <botan/engine.h>
-#include <botan/stl_util.h>
-#include <botan/mode_pad.h>
-
-namespace Botan {
-
-namespace {
-
-/*************************************************
-* Algorithm Cache *
-*************************************************/
-template<typename T>
-class Algorithm_Cache_Impl : public Engine::Algorithm_Cache<T>
- {
- public:
- T* get(const std::string& name) const
- {
- Mutex_Holder lock(mutex);
- return search_map(mappings, name);
- }
-
- void add(T* algo, const std::string& index_name = "") const
- {
- if(!algo)
- return;
-
- Mutex_Holder lock(mutex);
-
- const std::string name =
- (index_name != "" ? index_name : algo->name());
-
- if(mappings.find(name) != mappings.end())
- delete mappings[name];
- mappings[name] = algo;
- }
-
- Algorithm_Cache_Impl(Mutex* m) : mutex(m) {}
-
- ~Algorithm_Cache_Impl()
- {
- typename std::map<std::string, T*>::iterator i = mappings.begin();
-
- while(i != mappings.end())
- {
- delete i->second;
- ++i;
- }
- delete mutex;
- }
- private:
- Mutex* mutex;
- mutable std::map<std::string, T*> mappings;
- };
-
-}
-
-/*************************************************
-* Acquire a BlockCipher *
-*************************************************/
-const BlockCipher*
-Engine::prototype_block_cipher(const SCAN_Name& request,
- Algorithm_Factory& af) const
- {
- // This needs to respect provider settings
- BlockCipher* algo = cache_of_bc->get(request.as_string());
- if(algo)
- return algo;
-
- // cache miss: do full search
- algo = find_block_cipher(request, af);
- if(algo)
- cache_of_bc->add(algo, request.as_string());
-
- return algo;
- }
-
-/*************************************************
-* Acquire a StreamCipher *
-*************************************************/
-const StreamCipher*
-Engine::prototype_stream_cipher(const SCAN_Name& request,
- Algorithm_Factory& af) const
- {
- // This needs to respect provider settings
- StreamCipher* algo = cache_of_sc->get(request.as_string());
- if(algo)
- return algo;
-
- // cache miss: do full search
- algo = find_stream_cipher(request, af);
- if(algo)
- cache_of_sc->add(algo, request.as_string());
-
- return algo;
- }
-
-/*************************************************
-* Acquire a HashFunction *
-*************************************************/
-const HashFunction*
-Engine::prototype_hash_function(const SCAN_Name& request,
- Algorithm_Factory& af) const
- {
- // This needs to respect provider settings
- HashFunction* algo = cache_of_hf->get(request.as_string());
- if(algo)
- return algo;
-
- // cache miss: do full search
- algo = find_hash(request, af);
- if(algo)
- cache_of_hf->add(algo, request.as_string());
-
- return algo;
- }
-
-/*************************************************
-* Acquire a MessageAuthenticationCode *
-*************************************************/
-const MessageAuthenticationCode*
-Engine::prototype_mac(const SCAN_Name& request,
- Algorithm_Factory& af) const
- {
- // This needs to respect provider settings
- MessageAuthenticationCode* algo = cache_of_mac->get(request.as_string());
- if(algo)
- return algo;
-
- // cache miss: do full search
- algo = find_mac(request, af);
- if(algo)
- cache_of_mac->add(algo, request.as_string());
-
- return algo;
- }
-
-/*************************************************
-* Add a block cipher to the lookup table *
-*************************************************/
-void Engine::add_algorithm(BlockCipher* algo) const
- {
- cache_of_bc->add(algo);
- }
-
-/*************************************************
-* Add a stream cipher to the lookup table *
-*************************************************/
-void Engine::add_algorithm(StreamCipher* algo) const
- {
- cache_of_sc->add(algo);
- }
-
-/*************************************************
-* Add a hash function to the lookup table *
-*************************************************/
-void Engine::add_algorithm(HashFunction* algo) const
- {
- cache_of_hf->add(algo);
- }
-
-/*************************************************
-* Add a MAC to the lookup table *
-*************************************************/
-void Engine::add_algorithm(MessageAuthenticationCode* algo) const
- {
- cache_of_mac->add(algo);
- }
-
-void Engine::initialize(Mutex_Factory& mf)
- {
- cache_of_bc = new Algorithm_Cache_Impl<BlockCipher>(mf.make());
- cache_of_sc = new Algorithm_Cache_Impl<StreamCipher>(mf.make());
- cache_of_hf = new Algorithm_Cache_Impl<HashFunction>(mf.make());
- cache_of_mac =
- new Algorithm_Cache_Impl<MessageAuthenticationCode>(mf.make());
- }
-
-Engine::Engine()
- {
- cache_of_bc = 0;
- cache_of_sc = 0;
- cache_of_hf = 0;
- cache_of_mac = 0;
- }
-
-/*************************************************
-* Destroy an Engine *
-*************************************************/
-Engine::~Engine()
- {
- delete cache_of_bc;
- delete cache_of_sc;
- delete cache_of_hf;
- delete cache_of_mac;
- }
-
-}
diff --git a/src/libstate/info.txt b/src/libstate/info.txt
index 409b54343..1ac76f1a4 100644
--- a/src/libstate/info.txt
+++ b/src/libstate/info.txt
@@ -23,4 +23,6 @@ libstate.h
lookup.cpp
lookup.h
policy.cpp
+pk_engine.h
+pk_engine.cpp
</add>
diff --git a/src/libstate/engine/pk_engine.cpp b/src/libstate/pk_engine.cpp
index 69a319f9d..7b8e7d8fc 100644
--- a/src/libstate/engine/pk_engine.cpp
+++ b/src/libstate/pk_engine.cpp
@@ -3,8 +3,9 @@
* (C) 1999-2007 Jack Lloyd *
*************************************************/
-#include <botan/engine.h>
+#include <botan/pk_engine.h>
#include <botan/libstate.h>
+#include <botan/engine.h>
namespace Botan {
diff --git a/src/libstate/pk_engine.h b/src/libstate/pk_engine.h
new file mode 100644
index 000000000..4c54f46e1
--- /dev/null
+++ b/src/libstate/pk_engine.h
@@ -0,0 +1,92 @@
+/**
+* Engine for PK
+* (C) 1999-2007 Jack Lloyd
+*/
+
+#ifndef BOTAN_ENGINE_PK_LOOKUP_H__
+#define BOTAN_ENGINE_PK_LOOKUP_H__
+
+#include <botan/bigint.h>
+
+#if defined(BOTAN_HAS_IF_PUBLIC_KEY_FAMILY)
+ #include <botan/if_op.h>
+#endif
+
+#if defined(BOTAN_HAS_DSA)
+ #include <botan/dsa_op.h>
+#endif
+
+#if defined(BOTAN_HAS_DIFFIE_HELLMAN)
+ #include <botan/dh_op.h>
+#endif
+
+#if defined(BOTAN_HAS_NYBERG_RUEPPEL)
+ #include <botan/nr_op.h>
+#endif
+
+#if defined(BOTAN_HAS_ELGAMAL)
+ #include <botan/elg_op.h>
+#endif
+
+#if defined(BOTAN_HAS_ECDSA)
+ #include <botan/ecdsa_op.h>
+ #include <botan/ec_dompar.h>
+#endif
+
+#if defined(BOTAN_HAS_ECKAEG)
+ #include <botan/eckaeg_op.h>
+ #include <botan/ec_dompar.h>
+#endif
+
+namespace Botan {
+
+class Algorithm_Factory;
+class Keyed_Filter;
+class Modular_Exponentiator;
+
+namespace Engine_Core {
+
+/*************************************************
+* Get an operation from an Engine *
+*************************************************/
+Modular_Exponentiator* mod_exp(const BigInt&, Power_Mod::Usage_Hints);
+
+#if defined(BOTAN_HAS_IF_PUBLIC_KEY_FAMILY)
+IF_Operation* if_op(const BigInt&, const BigInt&, const BigInt&,
+ const BigInt&, const BigInt&, const BigInt&,
+ const BigInt&, const BigInt&);
+#endif
+
+#if defined(BOTAN_HAS_DSA)
+DSA_Operation* dsa_op(const DL_Group&, const BigInt&, const BigInt&);
+#endif
+
+#if defined(BOTAN_HAS_NYBERG_RUEPPEL)
+NR_Operation* nr_op(const DL_Group&, const BigInt&, const BigInt&);
+#endif
+
+#if defined(BOTAN_HAS_ELGAMAL)
+ELG_Operation* elg_op(const DL_Group&, const BigInt&, const BigInt&);
+#endif
+
+#if defined(BOTAN_HAS_DIFFIE_HELLMAN)
+DH_Operation* dh_op(const DL_Group&, const BigInt&);
+#endif
+
+#if defined(BOTAN_HAS_ECDSA)
+ECDSA_Operation* ecdsa_op(const EC_Domain_Params& dom_pars,
+ const BigInt& priv_key,
+ const PointGFp& pub_key);
+#endif
+
+#if defined(BOTAN_HAS_ECKAEG)
+ECKAEG_Operation* eckaeg_op(const EC_Domain_Params& dom_pars,
+ const BigInt& priv_key,
+ const PointGFp& pub_key);
+#endif
+
+}
+
+}
+
+#endif