[pkg-opensc-commit] [libp11] 127/239: 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
Sat Oct 17 06:21:17 UTC 2015
This is an automated email from the git hooks/post-receive script.
eric pushed a commit to branch master
in repository libp11.
commit 887f35a8bd69c3582bee6e06f929c404ac2ef3d3
Author: Andreas Jellinghaus <andreas at ionisiert.de>
Date: Wed Jul 30 12:11:42 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/libp11-int.h | 1 +
src/libp11.h | 7 +++++++
src/p11_load.c | 12 +++++++++++-
3 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/src/libp11-int.h b/src/libp11-int.h
index 9d7e60a..be3965f 100644
--- a/src/libp11-int.h
+++ b/src/libp11-int.h
@@ -42,6 +42,7 @@ typedef struct pkcs11_ctx_private {
CK_FUNCTION_LIST_PTR method;
CK_SESSION_HANDLE session;
+ char *init_args;
} PKCS11_CTX_private;
#define PRIVCTX(ctx) ((PKCS11_CTX_private *) (ctx->_private))
diff --git a/src/libp11.h b/src/libp11.h
index f326240..ad9b430 100644
--- a/src/libp11.h
+++ b/src/libp11.h
@@ -108,6 +108,13 @@ typedef struct PKCS11_ctx_st {
extern PKCS11_CTX *PKCS11_CTX_new(void);
/**
+ * Specify any private PKCS#11 module initializtion args, if necessary
+ *
+ * @return none
+ */
+extern void *PKCS11_CTX_init_args(PKCS11_CTX * ctx, const char * init_args);
+
+/**
* Load a PKCS#11 module
*
* @param ctx context allocated by PKCS11_CTX_new()
diff --git a/src/p11_load.c b/src/p11_load.c
index 616d629..02ecdb6 100644
--- a/src/p11_load.c
+++ b/src/p11_load.c
@@ -41,11 +41,21 @@ PKCS11_CTX *PKCS11_CTX_new(void)
}
/*
+ * Set private init args for module
+ */
+void *PKCS11_CTX_init_args(PKCS11_CTX * ctx, const char *init_args)
+{
+ PKCS11_CTX_private *priv = PRIVCTX(ctx);
+ priv->init_args = strdup(init_args);
+}
+
+/*
* Load the shared library, and initialize it.
*/
int PKCS11_CTX_load(PKCS11_CTX * ctx, const char *name)
{
PKCS11_CTX_private *priv = PRIVCTX(ctx);
+ CK_C_INITIALIZE_ARGS args = { .pReserved = priv->init_args, };
CK_INFO ck_info;
int rv;
@@ -60,7 +70,7 @@ int PKCS11_CTX_load(PKCS11_CTX * ctx, const char *name)
}
/* Tell the PKCS11 to initialize itself */
- rv = priv->method->C_Initialize(NULL);
+ rv = priv->method->C_Initialize(&args);
CRYPTOKI_checkerr(PKCS11_F_PKCS11_CTX_LOAD, rv);
/* Get info on the library */
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-opensc/libp11.git
More information about the pkg-opensc-commit
mailing list