diff options
author | lloyd <[email protected]> | 2008-11-12 21:19:47 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-11-12 21:19:47 +0000 |
commit | 1c7f4ac5cade236cf53598abf5c043945cbc9a8f (patch) | |
tree | b68fb295f9c01255f7a0e196d9201dbb2c4c64b6 /src/libstate | |
parent | 36b82adcae6e0f6b2b9e5f588f6c81477847eaaf (diff) |
Remove Library_State::add_engine and Algorithm_Factory::add_engine,
replacing with an updated constructor to Algorithm_Factory taking a
vector of Engine*. The semantics of adding engines at runtime were not
defined nor very clear, it seems best to prohibit this unless and
until it is explicitly thought through (and until a need for it
presents itself).
Diffstat (limited to 'src/libstate')
-rw-r--r-- | src/libstate/libstate.cpp | 31 | ||||
-rw-r--r-- | src/libstate/libstate.h | 2 |
2 files changed, 12 insertions, 21 deletions
diff --git a/src/libstate/libstate.cpp b/src/libstate/libstate.cpp index 160f07678..b75fbae88 100644 --- a/src/libstate/libstate.cpp +++ b/src/libstate/libstate.cpp @@ -275,38 +275,31 @@ void Library_State::initialize(bool thread_safe) load_default_config(); - m_algorithm_factory = new Algorithm_Factory(*mutex_factory); + std::vector<Engine*> engines; - m_algorithm_factory->add_engine(new Default_Engine); - -#if defined(BOTAN_HAS_ENGINE_IA32_ASSEMBLER) - m_algorithm_factory->add_engine(new IA32_Assembler_Engine); +#if defined(BOTAN_HAS_ENGINE_GNU_MP) + engines.push_back(new GMP_Engine); #endif -#if defined(BOTAN_HAS_ENGINE_AMD64_ASSEMBLER) - m_algorithm_factory->add_engine(new AMD64_Assembler_Engine); +#if defined(BOTAN_HAS_ENGINE_OPENSSL) + engines.push_back(new OpenSSL_Engine); #endif #if defined(BOTAN_HAS_ENGINE_SSE2_ASSEMBLER) - m_algorithm_factory->add_engine(new SSE2_Assembler_Engine); + engines.push_back(new SSE2_Assembler_Engine); #endif -#if defined(BOTAN_HAS_ENGINE_OPENSSL) - m_algorithm_factory->add_engine(new OpenSSL_Engine); +#if defined(BOTAN_HAS_ENGINE_AMD64_ASSEMBLER) + engines.push_back(new AMD64_Assembler_Engine); #endif -#if defined(BOTAN_HAS_ENGINE_GNU_MP) - m_algorithm_factory->add_engine(new GMP_Engine); +#if defined(BOTAN_HAS_ENGINE_IA32_ASSEMBLER) + engines.push_back(new IA32_Assembler_Engine); #endif - } + engines.push_back(new Default_Engine); -/** -* Add a new engine -*/ -void Library_State::add_engine(Engine* engine) - { - m_algorithm_factory->add_engine(engine); + m_algorithm_factory = new Algorithm_Factory(engines, *mutex_factory); } /************************************************* diff --git a/src/libstate/libstate.h b/src/libstate/libstate.h index 53a70a636..e45d1a7f3 100644 --- a/src/libstate/libstate.h +++ b/src/libstate/libstate.h @@ -29,8 +29,6 @@ class BOTAN_DLL Library_State Algorithm_Factory& algorithm_factory(); - void add_engine(class Engine*); - Allocator* get_allocator(const std::string& = "") const; void add_allocator(Allocator*); void set_default_allocator(const std::string&); |