aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstate/libstate.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-11-12 21:19:47 +0000
committerlloyd <[email protected]>2008-11-12 21:19:47 +0000
commit1c7f4ac5cade236cf53598abf5c043945cbc9a8f (patch)
treeb68fb295f9c01255f7a0e196d9201dbb2c4c64b6 /src/libstate/libstate.cpp
parent36b82adcae6e0f6b2b9e5f588f6c81477847eaaf (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/libstate.cpp')
-rw-r--r--src/libstate/libstate.cpp31
1 files changed, 12 insertions, 19 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);
}
/*************************************************