From 1c7f4ac5cade236cf53598abf5c043945cbc9a8f Mon Sep 17 00:00:00 2001 From: lloyd Date: Wed, 12 Nov 2008 21:19:47 +0000 Subject: 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). --- src/libstate/libstate.cpp | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) (limited to 'src/libstate/libstate.cpp') 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 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); } /************************************************* -- cgit v1.2.3