aboutsummaryrefslogtreecommitdiffstats
path: root/src/init_def.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/init_def.cpp')
-rw-r--r--src/init_def.cpp38
1 files changed, 17 insertions, 21 deletions
diff --git a/src/init_def.cpp b/src/init_def.cpp
index 1388445f5..6faa5d86f 100644
--- a/src/init_def.cpp
+++ b/src/init_def.cpp
@@ -17,39 +17,37 @@ namespace Botan {
/*************************************************
* Library Initialization *
*************************************************/
-LibraryInitializer::LibraryInitializer(const std::string& arg_string)
+void LibraryInitializer::initialize(const std::string& arg_string)
{
InitializerOptions args(arg_string);
- Init::initialize(args);
+ initialize(args);
}
/*************************************************
* Library Initialization *
*************************************************/
-LibraryInitializer::LibraryInitializer(const InitializerOptions& args)
+void LibraryInitializer::initialize(const InitializerOptions& args)
{
- Init::initialize(args);
- }
-
-/*************************************************
-* Library Shutdown *
-*************************************************/
-LibraryInitializer::~LibraryInitializer()
- {
- Init::deinitialize();
+ try
+ {
+ Builtin_Modules modules(args);
+ initialize(args, modules);
+ }
+ catch(...)
+ {
+ deinitialize();
+ throw;
+ }
}
-namespace Init {
-
/*************************************************
* Library Initialization *
*************************************************/
-void initialize(const InitializerOptions& args)
+void LibraryInitializer::initialize(const InitializerOptions& args,
+ Modules& modules)
{
try
{
- Builtin_Modules modules(args);
-
set_global_state(
new Library_State(
args.thread_safe() ?
@@ -95,7 +93,7 @@ void initialize(const InitializerOptions& args)
throw Self_Test_Failure("FIPS-140 startup tests");
}
}
- catch(std::exception)
+ catch(...)
{
deinitialize();
throw;
@@ -105,11 +103,9 @@ void initialize(const InitializerOptions& args)
/*************************************************
* Library Shutdown *
*************************************************/
-void deinitialize()
+void LibraryInitializer::deinitialize()
{
set_global_state(0);
}
}
-
-}