[pkg-opensc-commit] [engine-pkcs11] 67/152: David Smith: While working on adding PKCS#11 support to Gnome's Network Manager project, it was found that being able to specify the pReserved member of CK_C_INITIALIZE_ARGS_PTR to C_Initialize is probably necessary in wpasupplicant, an engine-pkcs11 consumer. This support did not exist in libp11 and engine-pkcs11, so I've attached a patch that adds a new function in libp11, PKCS11_CTX_init_args, and a new engine command, CMD_INIT_ARGS.
Eric Dorland
eric at moszumanska.debian.org
Mon Oct 19 03:11:16 UTC 2015
This is an automated email from the git hooks/post-receive script.
eric pushed a commit to branch master
in repository engine-pkcs11.
commit bd269881b08959c6a70ad426191099ed294c6a92
Author: Andreas Jellinghaus <andreas at ionisiert.de>
Date: Wed Jul 30 12:13:26 2008 +0000
David Smith: While working on adding PKCS#11 support to Gnome's Network Manager
project, it was found that being able to specify the pReserved member of
CK_C_INITIALIZE_ARGS_PTR to C_Initialize is probably necessary in
wpasupplicant, an engine-pkcs11 consumer. This support did not exist in
libp11 and engine-pkcs11, so I've attached a patch that adds a new
function in libp11, PKCS11_CTX_init_args, and a new engine command,
CMD_INIT_ARGS.
---
src/engine_pkcs11.c | 9 +++++++++
src/hw_pkcs11.c | 7 +++++++
2 files changed, 16 insertions(+)
diff --git a/src/engine_pkcs11.c b/src/engine_pkcs11.c
index 35d087a..b29ceb7 100644
--- a/src/engine_pkcs11.c
+++ b/src/engine_pkcs11.c
@@ -59,6 +59,8 @@ static int verbose = 0;
static char *module = NULL;
+static char *init_args = NULL;
+
int set_module(const char *modulename)
{
module = strdup(modulename);
@@ -141,6 +143,12 @@ static int get_pin(UI_METHOD * ui_method, void *callback_data)
return 1;
}
+int set_init_args(const char *init_args_orig)
+{
+ init_args = strdup(init_args_orig);
+ return 1;
+}
+
int pkcs11_finish(ENGINE * engine)
{
if (ctx) {
@@ -162,6 +170,7 @@ int pkcs11_init(ENGINE * engine)
fprintf(stderr, "initializing engine\n");
}
ctx = PKCS11_CTX_new();
+ PKCS11_CTX_init_args(ctx, init_args);
if (PKCS11_CTX_load(ctx, module) < 0) {
fprintf(stderr, "unable to load module %s\n", module);
return 0;
diff --git a/src/hw_pkcs11.c b/src/hw_pkcs11.c
index 74bd4ea..24806ff 100644
--- a/src/hw_pkcs11.c
+++ b/src/hw_pkcs11.c
@@ -81,6 +81,7 @@
#define CMD_VERBOSE (ENGINE_CMD_BASE+3)
#define CMD_QUIET (ENGINE_CMD_BASE+4)
#define CMD_LOAD_CERT_CTRL (ENGINE_CMD_BASE+5)
+#define CMD_INIT_ARGS (ENGINE_CMD_BASE+6)
static int pkcs11_engine_destroy(ENGINE * e);
static int pkcs11_engine_ctrl(ENGINE * e, int cmd, long i, void *p,
@@ -115,6 +116,10 @@ static const ENGINE_CMD_DEFN pkcs11_cmd_defns[] = {
"LOAD_CERT_CTRL",
"Get the certificate from card",
ENGINE_CMD_FLAG_INTERNAL},
+ {CMD_INIT_ARGS,
+ "INIT_ARGS",
+ "Specifies additional initialization arguments to the pkcs11 module",
+ ENGINE_CMD_FLAG_STRING},
{0, NULL, NULL, 0}
};
@@ -137,6 +142,8 @@ static int pkcs11_engine_ctrl(ENGINE * e, int cmd, long i, void *p,
return inc_verbose();
case CMD_LOAD_CERT_CTRL:
return load_cert_ctrl(e, p);
+ case CMD_INIT_ARGS:
+ return set_init_args((const char *)p);
default:
break;
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-opensc/engine-pkcs11.git
More information about the pkg-opensc-commit
mailing list