diff options
Diffstat (limited to 'src/engine/dyn_engine')
-rw-r--r-- | src/engine/dyn_engine/dyn_engine.cpp | 63 | ||||
-rw-r--r-- | src/engine/dyn_engine/dyn_engine.h | 115 | ||||
-rw-r--r-- | src/engine/dyn_engine/info.txt | 14 |
3 files changed, 0 insertions, 192 deletions
diff --git a/src/engine/dyn_engine/dyn_engine.cpp b/src/engine/dyn_engine/dyn_engine.cpp deleted file mode 100644 index 078ec4b83..000000000 --- a/src/engine/dyn_engine/dyn_engine.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/** -* Dynamically Loaded Engine -* (C) 2010 Jack Lloyd -* -* Distributed under the terms of the Botan license -*/ - -#include <botan/dyn_engine.h> -#include <botan/internal/dyn_load.h> - -namespace Botan { - -namespace { - -extern "C" { - typedef Engine* (*creator_func)(void); - typedef u32bit (*module_version_func)(void); -} - -} - -Dynamically_Loaded_Engine::Dynamically_Loaded_Engine( - const std::string& library_path) : - engine(nullptr) - { - lib = new Dynamically_Loaded_Library(library_path); - - try - { - module_version_func get_version = - lib->resolve<module_version_func>("module_version"); - - const u32bit mod_version = get_version(); - - if(mod_version != 20101003) - throw std::runtime_error("Incompatible version in " + - library_path + " of " + - std::to_string(mod_version)); - - creator_func creator = - lib->resolve<creator_func>("create_engine"); - - engine = creator(); - - if(!engine) - throw std::runtime_error("Creator function in " + - library_path + " failed"); - } - catch(...) - { - delete lib; - lib = nullptr; - throw; - } - } - -Dynamically_Loaded_Engine::~Dynamically_Loaded_Engine() - { - delete engine; - delete lib; - } - -} diff --git a/src/engine/dyn_engine/dyn_engine.h b/src/engine/dyn_engine/dyn_engine.h deleted file mode 100644 index 39e13ab36..000000000 --- a/src/engine/dyn_engine/dyn_engine.h +++ /dev/null @@ -1,115 +0,0 @@ -/** -* Dynamically Loaded Engine -* (C) 2010 Jack Lloyd -* -* Distributed under the terms of the Botan license -*/ - -#ifndef BOTAN_DYN_LOADED_ENGINE_H__ -#define BOTAN_DYN_LOADED_ENGINE_H__ - -#include <botan/engine.h> - -namespace Botan { - -/** -* Dynamically_Loaded_Engine just proxies the requests to the underlying -* Engine object, and handles load/unload details -*/ -class BOTAN_DLL Dynamically_Loaded_Engine : public Engine - { - public: - /** - * @param lib_path full pathname to DLL to load - */ - Dynamically_Loaded_Engine(const std::string& lib_path); - - Dynamically_Loaded_Engine(const Dynamically_Loaded_Engine&) = delete; - - Dynamically_Loaded_Engine& operator=(const Dynamically_Loaded_Engine&) = delete; - - ~Dynamically_Loaded_Engine(); - - std::string provider_name() const override { return engine->provider_name(); } - - BlockCipher* find_block_cipher(const SCAN_Name& algo_spec, - Algorithm_Factory& af) const override - { - return engine->find_block_cipher(algo_spec, af); - } - - StreamCipher* find_stream_cipher(const SCAN_Name& algo_spec, - Algorithm_Factory& af) const override - { - return engine->find_stream_cipher(algo_spec, af); - } - - HashFunction* find_hash(const SCAN_Name& algo_spec, - Algorithm_Factory& af) const override - { - return engine->find_hash(algo_spec, af); - } - - MessageAuthenticationCode* find_mac(const SCAN_Name& algo_spec, - Algorithm_Factory& af) const override - { - return engine->find_mac(algo_spec, af); - } - - PBKDF* find_pbkdf(const SCAN_Name& algo_spec, - Algorithm_Factory& af) const override - { - return engine->find_pbkdf(algo_spec, af); - } - - Modular_Exponentiator* mod_exp(const BigInt& n, - Power_Mod::Usage_Hints hints) const override - { - return engine->mod_exp(n, hints); - } - - Keyed_Filter* get_cipher(const std::string& algo_spec, - Cipher_Dir dir, - Algorithm_Factory& af) - { - return engine->get_cipher(algo_spec, dir, af); - } - - PK_Ops::Key_Agreement* - get_key_agreement_op(const Private_Key& key, RandomNumberGenerator& rng) const override - { - return engine->get_key_agreement_op(key, rng); - } - - PK_Ops::Signature* - get_signature_op(const Private_Key& key, RandomNumberGenerator& rng) const override - { - return engine->get_signature_op(key, rng); - } - - PK_Ops::Verification* - get_verify_op(const Public_Key& key, RandomNumberGenerator& rng) const override - { - return engine->get_verify_op(key, rng); - } - - PK_Ops::Encryption* - get_encryption_op(const Public_Key& key, RandomNumberGenerator& rng) const override - { - return engine->get_encryption_op(key, rng); - } - - PK_Ops::Decryption* - get_decryption_op(const Private_Key& key, RandomNumberGenerator& rng) const override - { - return engine->get_decryption_op(key, rng); - } - - private: - class Dynamically_Loaded_Library* lib; - Engine* engine; - }; - -} - -#endif diff --git a/src/engine/dyn_engine/info.txt b/src/engine/dyn_engine/info.txt deleted file mode 100644 index 54379f501..000000000 --- a/src/engine/dyn_engine/info.txt +++ /dev/null @@ -1,14 +0,0 @@ -define DYNAMICALLY_LOADED_ENGINE 20131128 - -<header:public> -dyn_engine.h -</header:public> - -<source> -dyn_engine.cpp -</source> - -<requires> -engine -dyn_load -</requires> |