aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstate/libstate.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-11-10 22:33:35 +0000
committerlloyd <[email protected]>2008-11-10 22:33:35 +0000
commita4804e1e606424b8b9421eadb86ffde0a995382c (patch)
tree9d2e007e818b3a796f288ab6158a4bc762d0ad52 /src/libstate/libstate.cpp
parent675aa7bcc476d8445b6eb2bc3c6b0a2f3ce12958 (diff)
Drop all options except thread safety. Also remove InitializerOptions, etc
and reduce all the arguments to just a bool specifying threads. selftests: off (if desired, run passes_self_test in selftest.h) fips140: Just ran the self tests, totally bogus option. use_engine: On by default (that is, if OpenSSL or asm code is compiled in, it's used by default). One can get better control over this using the provider feature of SCAN_Name (though this doesn't handle cases like nested algorithms yet). secure_memory: On by default.
Diffstat (limited to 'src/libstate/libstate.cpp')
-rw-r--r--src/libstate/libstate.cpp18
1 files changed, 5 insertions, 13 deletions
diff --git a/src/libstate/libstate.cpp b/src/libstate/libstate.cpp
index ebda40121..9096d98e6 100644
--- a/src/libstate/libstate.cpp
+++ b/src/libstate/libstate.cpp
@@ -228,12 +228,12 @@ Algorithm_Factory& Library_State::algo_factory()
/*************************************************
* Load a set of modules *
*************************************************/
-void Library_State::initialize(const InitializerOptions& args)
+void Library_State::initialize(bool thread_safe)
{
if(mutex_factory)
throw Invalid_State("Library_State has already been initialized");
- if(args.thread_safe() == false)
+ if(!thread_safe)
{
mutex_factory = new Noop_Mutex_Factory;
}
@@ -255,15 +255,15 @@ void Library_State::initialize(const InitializerOptions& args)
cached_default_allocator = 0;
- add_allocator(new Locking_Allocator(mutex_factory->make()));
add_allocator(new Malloc_Allocator);
- set_default_allocator("locking");
+ add_allocator(new Locking_Allocator(mutex_factory->make()));
#if defined(BOTAN_HAS_ALLOC_MMAP)
add_allocator(new MemoryMapping_Allocator(mutex_factory->make()));
- set_default_allocator("mmap");
#endif
+ set_default_allocator("locking");
+
load_default_config();
algorithm_factory = new Algorithm_Factory;
@@ -281,14 +281,6 @@ void Library_State::initialize(const InitializerOptions& args)
#endif
algorithm_factory->add_engine(new Default_Engine);
-
-#if defined(BOTAN_HAS_SELFTEST)
- if(args.fips_mode() || args.self_test())
- {
- if(!passes_self_tests())
- throw Self_Test_Failure("Initialization self-tests");
- }
-#endif
}
/*************************************************