]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
gnutls-serv: added the --provider option
authorNikos Mavrogiannopoulos <nmav@redhat.com>
Fri, 19 Sep 2014 08:40:14 +0000 (10:40 +0200)
committerNikos Mavrogiannopoulos <nmav@redhat.com>
Fri, 19 Sep 2014 08:51:55 +0000 (10:51 +0200)
src/serv-args.def
src/serv.c

index 141984a52d340d1046c9a3d59ae5177041eb4517..44b67f1abecb71511b4fb6beae6a67907ea2785f 100644 (file)
@@ -264,6 +264,14 @@ flag = {
     doc      = "Print a list of the supported algorithms and modes. If a priority string is given then only the enabled ciphersuites are shown.";
 };
 
+flag = {
+    name      = provider;
+    arg-type  = file;
+    file-exists = yes;
+    descrip   = "Specify the PKCS #11 provider library";
+    doc      = "This will override the default options in /etc/gnutls/pkcs11.conf";
+};
+
 doc-section = {
   ds-type   = 'SEE ALSO'; // or anything else
   ds-format = 'texi';      // or texi or mdoc format
index de03c4ee1c375b5d9bacfa41a071719c9d47e23f..74dd1af2a9294cf9861cceb51fe7c4e5a17e1027 100644 (file)
@@ -951,6 +951,22 @@ int main(int argc, char **argv)
                exit(1);
        }
 #ifdef ENABLE_PKCS11
+       if (HAVE_OPT(PROVIDER)) {
+               ret = gnutls_pkcs11_init(GNUTLS_PKCS11_FLAG_MANUAL, NULL);
+               if (ret < 0)
+                       fprintf(stderr, "pkcs11_init: %s",
+                               gnutls_strerror(ret));
+               else {
+                       ret =
+                           gnutls_pkcs11_add_provider(OPT_ARG(PROVIDER),
+                                                      NULL);
+                       if (ret < 0) {
+                               fprintf(stderr, "pkcs11_add_provider: %s",
+                                       gnutls_strerror(ret));
+                               exit(1);
+                       }
+               }
+       }
        pkcs11_common(NULL);
 #endif