aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstate.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2006-07-01 18:49:24 +0000
committerlloyd <[email protected]>2006-07-01 18:49:24 +0000
commit3d1d14cf405111e30643cf4c7674d441cc07a2e0 (patch)
treef3cdca0476a082634e97a4117c88e61c5a13036e /src/libstate.cpp
parent8192e9fde8060c740a2e03c9d0def6e87d10b86b (diff)
Clean up initialization a little bit more
Diffstat (limited to 'src/libstate.cpp')
-rw-r--r--src/libstate.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/libstate.cpp b/src/libstate.cpp
index 92dfd2913..36d6299ad 100644
--- a/src/libstate.cpp
+++ b/src/libstate.cpp
@@ -4,6 +4,7 @@
*************************************************/
#include <botan/libstate.h>
+#include <botan/modules.h>
#include <botan/engine.h>
#include <botan/x509stat.h>
#include <botan/stl_util.h>
@@ -321,6 +322,28 @@ X509_GlobalState& Library_State::x509_state()
}
/*************************************************
+* Load modules *
+*************************************************/
+void Library_State::load(Modules& modules)
+ {
+ set_timer(modules.timer());
+
+ std::vector<Allocator*> allocators = modules.allocators();
+
+ for(u32bit j = 0; j != allocators.size(); j++)
+ add_allocator(allocators[j],
+ allocators[j]->type() == modules.default_allocator());
+
+ std::vector<Engine*> engines = modules.engines();
+ for(u32bit j = 0; j != engines.size(); ++j)
+ add_engine(engines[j]);
+
+ std::vector<EntropySource*> sources = modules.entropy_sources();
+ for(u32bit j = 0; j != sources.size(); ++j)
+ add_entropy_source(sources[j]);
+ }
+
+/*************************************************
* Library_State Constructor *
*************************************************/
Library_State::Library_State(Mutex_Factory* mutex_factory)