summaryrefslogtreecommitdiff
path: root/src/libstrongswan/library.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstrongswan/library.c')
-rw-r--r--src/libstrongswan/library.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/libstrongswan/library.c b/src/libstrongswan/library.c
index 832c8b607..4e8bb87d0 100644
--- a/src/libstrongswan/library.c
+++ b/src/libstrongswan/library.c
@@ -21,6 +21,7 @@
#include <utils.h>
#include <chunk.h>
#include <debug.h>
+#include <threading/thread.h>
#include <utils/identification.h>
#include <utils/host.h>
#ifdef LEAK_DETECTIVE
@@ -64,21 +65,26 @@ void library_deinit()
this->public.plugins->destroy(this->public.plugins);
this->public.settings->destroy(this->public.settings);
this->public.creds->destroy(this->public.creds);
+ this->public.encoding->destroy(this->public.encoding);
this->public.crypto->destroy(this->public.crypto);
this->public.fetcher->destroy(this->public.fetcher);
+ this->public.attributes->destroy(this->public.attributes);
this->public.db->destroy(this->public.db);
this->public.printf_hook->destroy(this->public.printf_hook);
if (this->public.integrity)
{
this->public.integrity->destroy(this->public.integrity);
}
-
+
#ifdef LEAK_DETECTIVE
if (this->detective)
{
this->detective->destroy(this->detective);
}
#endif /* LEAK_DETECTIVE */
+
+ threads_deinit();
+
free(this);
lib = NULL;
}
@@ -91,16 +97,18 @@ bool library_init(char *settings)
printf_hook_t *pfh;
private_library_t *this = malloc_thing(private_library_t);
lib = &this->public;
-
+
+ threads_init();
+
lib->leak_detective = FALSE;
-
+
#ifdef LEAK_DETECTIVE
this->detective = leak_detective_create();
#endif /* LEAK_DETECTIVE */
pfh = printf_hook_create();
this->public.printf_hook = pfh;
-
+
pfh->add_handler(pfh, 'b', mem_printf_hook,
PRINTF_HOOK_ARGTYPE_POINTER, PRINTF_HOOK_ARGTYPE_INT,
PRINTF_HOOK_ARGTYPE_END);
@@ -119,15 +127,17 @@ bool library_init(char *settings)
PRINTF_HOOK_ARGTYPE_END);
pfh->add_handler(pfh, 'Y', identification_printf_hook,
PRINTF_HOOK_ARGTYPE_POINTER, PRINTF_HOOK_ARGTYPE_END);
-
+
this->public.settings = settings_create(settings);
this->public.crypto = crypto_factory_create();
this->public.creds = credential_factory_create();
+ this->public.encoding = key_encoding_create();
this->public.fetcher = fetcher_manager_create();
+ this->public.attributes = attribute_manager_create();
this->public.db = database_factory_create();
this->public.plugins = plugin_loader_create();
this->public.integrity = NULL;
-
+
if (lib->settings->get_bool(lib->settings,
"libstrongswan.integrity_test", FALSE))
{