gnome-keyring [PATCH] gp11: fix for C_Initialize use
- From: Joe Orton <jorton redhat com>
- To: gnome-keyring-list gnome org
- Subject: gnome-keyring [PATCH] gp11: fix for C_Initialize use
- Date: Fri, 12 Sep 2008 21:09:57 +0100
Hi folks, I had a quick play with seahorse to see what was happening
with PKCS#11 support and notice that gp11 dumps core if the OpenSC
PKCS#11 module is configured; the OpenSC module expects that the
argument to C_Initialize persists beyond the function call.
The spec doesn't seem clear about whether or not that's valid; it's
simple enough to work around, so here's a patch:
Index: ChangeLog
===================================================================
--- ChangeLog (revision 1319)
+++ ChangeLog (working copy)
@@ -1,3 +1,10 @@
+2008-09-12 Joe Orton <jorton redhat com>
+
+ * gp11/gp11-module.c (GP11ModulePrivate): Add init_args field.
+ (gp11_module_initialize): Use init_args structure from private
+ structure since at least one PKCS#11 module (opensc) requires
+ that the init_args argument persists in memory.
+
2008-09-11 Stef Walter <stef memberwebs com>
* daemon/ui/gkr-ask-request.c:
Index: gp11/gp11-module.c
===================================================================
--- gp11/gp11-module.c (revision 1319)
+++ gp11/gp11-module.c (working copy)
@@ -34,6 +34,8 @@
typedef struct _GP11ModulePrivate {
GModule *module;
+
+ CK_C_INITIALIZE_ARGS init_args;
} GP11ModulePrivate;
#define GP11_MODULE_GET_PRIVATE(o) \
@@ -216,7 +218,6 @@
GP11Module*
gp11_module_initialize (const gchar *path, gpointer reserved, GError **err)
{
- CK_C_INITIALIZE_ARGS init_args;
CK_C_GetFunctionList get_function_list;
GP11ModulePrivate *pv;
GP11Module *mod;
@@ -264,16 +265,16 @@
return NULL;
}
- memset (&init_args, 0, sizeof (init_args));
- init_args.flags = CKF_OS_LOCKING_OK;
- init_args.CreateMutex = create_mutex;
- init_args.DestroyMutex = destroy_mutex;
- init_args.LockMutex = lock_mutex;
- init_args.UnlockMutex = unlock_mutex;
- init_args.pReserved = reserved;
+ memset (&pv->init_args, 0, sizeof (pv->init_args));
+ pv->init_args.flags = CKF_OS_LOCKING_OK;
+ pv->init_args.CreateMutex = create_mutex;
+ pv->init_args.DestroyMutex = destroy_mutex;
+ pv->init_args.LockMutex = lock_mutex;
+ pv->init_args.UnlockMutex = unlock_mutex;
+ pv->init_args.pReserved = reserved;
/* Now initialize the module */
- rv = (mod->funcs->C_Initialize) (&init_args);
+ rv = (mod->funcs->C_Initialize) (&pv->init_args);
if (rv != CKR_OK) {
g_set_error (err, GP11_ERROR, rv, "Couldn't initialize module: %s",
gp11_message_from_rv (rv));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]