]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
Allow gnutls-cli to be used with tpmkey urls
authorNikos Mavrogiannopoulos <nmav@gnutls.org>
Fri, 13 Jul 2012 15:36:19 +0000 (17:36 +0200)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Fri, 13 Jul 2012 15:36:19 +0000 (17:36 +0200)
src/certtool-common.c
src/cli.c

index f8c05bc83901f2601f4cbfdb289441cb97b00a32..9dcca84cecddd9521765d336e61bf1aab88ab95e 100644 (file)
@@ -516,7 +516,7 @@ load_ca_private_key (common_info_st * info)
 #endif
 
 #ifdef HAVE_TROUSERS
-  if (strncmp(info->privkey, "tpmkey:", 7) == 0)
+  if (strncmp(info->ca_privkey, "tpmkey:", 7) == 0)
     return _load_tpm_privkey(info->privkey);
 #endif
 
index 980c50527dfc4e87c933cadb17f2768aeb20ae16..0e5f34960b07bbd6727063cecf92e31f6d1791ed 100644 (file)
--- a/src/cli.c
+++ b/src/cli.c
@@ -242,6 +242,20 @@ load_keys (void)
         }
       else
 #endif /* ENABLE_PKCS11 */
+#ifdef HAVE_TROUSERS
+      if (strncmp (x509_keyfile, "tpmkey:", 7) == 0)
+        {
+          ret =
+            gnutls_privkey_import_tpm_url (x509_key, x509_keyfile, NULL, NULL, 0);
+          if (ret < 0)
+            {
+              fprintf (stderr, "*** Error loading url: %s\n",
+                       gnutls_strerror (ret));
+              exit (1);
+            }
+        }
+      else
+#endif /* HAVE_TROUSERS */
         {
           ret = gnutls_load_file (x509_keyfile, &data);
           if (ret < 0)