libtpmtss: Support for TSS2 v2 libraries
[strongswan.git] / src / libtpmtss / plugins / tpm / tpm_plugin.c
index e988998..a00f46e 100644 (file)
@@ -18,6 +18,7 @@
 #include "tpm_cert.h"
 #include "tpm_rng.h"
 
+#include <tpm_tss.h>
 #include <library.h>
 
 typedef struct private_tpm_plugin_t private_tpm_plugin_t;
@@ -80,6 +81,7 @@ METHOD(plugin_t, destroy, void,
        private_tpm_plugin_t *this)
 {
        free(this);
+       libtpmtss_deinit();
 }
 
 /*
@@ -89,6 +91,11 @@ plugin_t *tpm_plugin_create()
 {
        private_tpm_plugin_t *this;
 
+       if (!libtpmtss_init())
+       {
+               return NULL;
+       }
+
        INIT(this,
                .public = {
                        .plugin = {