aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstate/init.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstate/init.cpp')
-rw-r--r--src/libstate/init.cpp32
1 files changed, 31 insertions, 1 deletions
diff --git a/src/libstate/init.cpp b/src/libstate/init.cpp
index 0256d70dc..890871411 100644
--- a/src/libstate/init.cpp
+++ b/src/libstate/init.cpp
@@ -4,6 +4,7 @@
*/
#include <botan/init.h>
+#include <botan/parsing.h>
#include <botan/libstate.h>
namespace Botan {
@@ -11,8 +12,37 @@ namespace Botan {
/*************************************************
* Library Initialization *
*************************************************/
-void LibraryInitializer::initialize(bool thread_safe)
+void LibraryInitializer::initialize(const std::string& arg_string)
{
+ bool thread_safe = true;
+
+ const std::vector<std::string> arg_list = split_on(arg_string, ' ');
+ for(u32bit j = 0; j != arg_list.size(); ++j)
+ {
+ if(arg_list[j].size() == 0)
+ continue;
+
+ std::string name, value;
+
+ if(arg_list[j].find('=') == std::string::npos)
+ {
+ name = arg_list[j];
+ value = "true";
+ }
+ else
+ {
+ std::vector<std::string> name_and_value = split_on(arg_list[j], '=');
+ name = name_and_value[0];
+ value = name_and_value[1];
+ }
+
+ bool is_on =
+ (value == "1" || value == "true" || value == "yes" || value == "on");
+
+ if(name == "thread_safe")
+ thread_safe = is_on;
+ }
+
try
{
/*