diff options
author | lloyd <[email protected]> | 2007-10-13 20:11:51 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2007-10-13 20:11:51 +0000 |
commit | e0fe7b1a473dd862e41a662d4bb9edab381370cf (patch) | |
tree | e4820c0fe53636fa9d640f0a8fa7b4987fbc3796 /src/init_def.cpp | |
parent | 0fcaf44cec8d534f070ae336785f7d4889a8b1ad (diff) |
Move most of the initializer code directly into the Library_State constructor
Diffstat (limited to 'src/init_def.cpp')
-rw-r--r-- | src/init_def.cpp | 71 |
1 files changed, 22 insertions, 49 deletions
diff --git a/src/init_def.cpp b/src/init_def.cpp index 7f465d3eb..50365b3d6 100644 --- a/src/init_def.cpp +++ b/src/init_def.cpp @@ -6,67 +6,19 @@ #include <botan/init.h> #include <botan/libstate.h> #include <botan/modules.h> -#include <botan/config.h> -#include <botan/defalloc.h> #include <botan/fips140.h> -#include <botan/x931_rng.h> -#include <botan/def_char.h> namespace Botan { /************************************************* * Library Initialization * *************************************************/ -void LibraryInitializer::initialize(const std::string& arg_string) - { - InitializerOptions args(arg_string); - initialize(args); - } - -/************************************************* -* Library Initialization * -*************************************************/ -void LibraryInitializer::initialize(const InitializerOptions& args) - { - Builtin_Modules modules(args); - initialize(args, modules); - } - -/************************************************* -* Library Initialization * -*************************************************/ void LibraryInitializer::initialize(const InitializerOptions& args, Modules& modules) { try { - set_global_state( - new Library_State( - args.thread_safe() ? - modules.mutex_factory() : - new Default_Mutex_Factory - ) - ); - - global_state().config().load_defaults(); - if(args.config_file() != "") - global_config().load_inifile(args.config_file()); - - global_state().load(modules); - global_state().set_prng(new ANSI_X931_RNG); - - if(args.seed_rng()) - { - for(u32bit j = 0; j != 4; ++j) - { - global_state().seed_prng(true, 384); - if(global_state().rng_is_seeded()) - break; - } - - if(!global_state().rng_is_seeded()) - throw PRNG_Unseeded("Unable to collect sufficient entropy"); - } + set_global_state(new Library_State(args, modules)); if(args.fips_mode() || args.self_test()) { @@ -89,4 +41,25 @@ void LibraryInitializer::deinitialize() set_global_state(0); } +/************************************************* +* Library Initialization * +*************************************************/ +void LibraryInitializer::initialize(const std::string& arg_string) + { + InitializerOptions args(arg_string); + Builtin_Modules modules(args); + + initialize(args, modules); + } + +/************************************************* +* Library Initialization * +*************************************************/ +void LibraryInitializer::initialize(const InitializerOptions& args) + { + Builtin_Modules modules(args); + + initialize(args, modules); + } + } |