]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
p11tool: added the --provider-opts option
authorNikos Mavrogiannopoulos <nmav@redhat.com>
Wed, 10 May 2017 14:40:10 +0000 (16:40 +0200)
committerNikos Mavrogiannopoulos <nmav@redhat.com>
Wed, 10 May 2017 15:20:58 +0000 (17:20 +0200)
This option allows passing parameters to the PKCS#11 module
loading process, i.e., passed to gnutls_pkcs11_add_provider().

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
src/p11tool-args.def
src/p11tool.c

index f6910d8842b1632d74a7911738b480caa56d6f0d..66ba2f5151f5b788b491a94fe86c7cd1025ee9b4 100644 (file)
@@ -459,6 +459,14 @@ flag = {
     doc      = "This will override the default options in /etc/gnutls/pkcs11.conf";
 };
 
+flag = {
+    name      = provider-opts;
+    arg-type  = string;
+    descrip   = "Specify parameters for the PKCS #11 provider library";
+    doc      = "This is a PKCS#11 internal option used by few modules.
+    Mainly for testing PKCS#11 modules.";
+};
+
 flag = {
     name      = detailed-url;
     descrip   = "Print detailed URLs";
index 7bb7164cba1459155e010254fdf27c270b1aa1a6..6b9718e37497103d365d7fc420eac8a4af4d59ca 100644 (file)
@@ -164,6 +164,11 @@ static void cmd_parser(int argc, char **argv)
        }
 
        if (HAVE_OPT(PROVIDER)) {
+               const char *params = NULL;
+
+               if (HAVE_OPT(PROVIDER_OPTS))
+                       params = OPT_ARG(PROVIDER_OPTS);
+
                ret = gnutls_pkcs11_init(GNUTLS_PKCS11_FLAG_MANUAL, NULL);
                if (ret < 0)
                        fprintf(stderr, "pkcs11_init: %s\n",
@@ -171,7 +176,7 @@ static void cmd_parser(int argc, char **argv)
                else {
                        ret =
                            gnutls_pkcs11_add_provider(OPT_ARG(PROVIDER),
-                                                      NULL);
+                                                      params);
                        if (ret < 0) {
                                fprintf(stderr, "pkcs11_add_provider: %s\n",
                                        gnutls_strerror(ret));