libtpmtss: Load X.509 certificates from TPM 2.0 NV RAM
[strongswan.git] / src / libtpmtss / plugins / tpm / tpm_plugin.c
index b9a4c12..e988998 100644 (file)
@@ -15,6 +15,7 @@
 
 #include "tpm_plugin.h"
 #include "tpm_private_key.h"
+#include "tpm_cert.h"
 #include "tpm_rng.h"
 
 #include <library.h>
@@ -50,13 +51,19 @@ METHOD(plugin_t, get_features, int,
                PLUGIN_REGISTER(PRIVKEY, tpm_private_key_connect, FALSE),
                        PLUGIN_PROVIDE(PRIVKEY, KEY_ANY),
        };
-       static plugin_feature_t f[countof(f_rng) + countof(f_privkey)] = {};
-
+       static plugin_feature_t f_cert[] = {
+               PLUGIN_REGISTER(CERT_DECODE, tpm_cert_load, FALSE),
+                       PLUGIN_PROVIDE(CERT_DECODE, CERT_X509),
+                               PLUGIN_DEPENDS(CERT_DECODE, CERT_X509),
+       };
+       static plugin_feature_t f[countof(f_rng) + countof(f_privkey) +
+                                                         countof(f_cert)] = {};
        static int count = 0;
 
        if (!count)
        {
                plugin_features_add(f, f_privkey, countof(f_privkey), &count);
+               plugin_features_add(f, f_cert, countof(f_cert), &count);
 
                if (lib->settings->get_bool(lib->settings,
                                                                "%s.plugins.tpm.use_rng", FALSE, lib->ns))