Re: [opensc-devel] Patch for libp11 to fix compatibility with AET SafeSign PKCS#11 library

2011-06-17 Thread Alon Bar-Lev
Right.
But you forgot to free the memory.
I've applied similar solution at r201.

On Fri, Jun 17, 2011 at 2:55 PM, Jonathan Giannuzzi
 wrote:
> Hello,
> When using libp11 to wrap around the AET SafeSign PKCS#11 library, C_GetInfo
> fails with CKR_MUTEX_BAD. This is because an empty CK_C_INITIALIZE_ARGS
> structure is passed to C_Initialize.
> I made a change in PKCS11_CTX_load so that when no init_args have been set,
> no CK_C_INITIALIZE_ARGS is given to C_Initialize.
> It should not break any other P11 library loading.
> Cheers,
> Jonathan
> ___
> opensc-devel mailing list
> opensc-devel@lists.opensc-project.org
> http://www.opensc-project.org/mailman/listinfo/opensc-devel
>
___
opensc-devel mailing list
opensc-devel@lists.opensc-project.org
http://www.opensc-project.org/mailman/listinfo/opensc-devel


Re: [opensc-devel] OT: Today's Github sweetness

2011-06-17 Thread Anders Rundgren
On 2011-06-17 13:08, Martin Paljak wrote:
> https://github.com/MrMEEE/bumblebee/commit/a047be85247755cdbe0acce6#diff-1
> 
> A nice example of fine Gtihub code commenting (mis?)use :)

Martin,
You mean that programming really is fun?  :-) :-)

Deleting /usr must for and old Windows-hack like me
almost be like dropping C:\

Cheers,
Anders

> 
> Cheers,
> Martin
> ___
> opensc-devel mailing list
> opensc-devel@lists.opensc-project.org
> http://www.opensc-project.org/mailman/listinfo/opensc-devel
> 

___
opensc-devel mailing list
opensc-devel@lists.opensc-project.org
http://www.opensc-project.org/mailman/listinfo/opensc-devel


[opensc-devel] Patch for libp11 to fix compatibility with AET SafeSign PKCS#11 library

2011-06-17 Thread Jonathan Giannuzzi
Hello,

When using libp11 to wrap around the AET SafeSign PKCS#11 library, C_GetInfo
fails with CKR_MUTEX_BAD. This is because an empty CK_C_INITIALIZE_ARGS
structure is passed to C_Initialize.

I made a change in PKCS11_CTX_load so that when no init_args have been set,
no CK_C_INITIALIZE_ARGS is given to C_Initialize.
It should not break any other P11 library loading.

Cheers,
Jonathan
diff -urN libp11.orig//src/p11_load.c libp11.new//src/p11_load.c
--- libp11.orig//src/p11_load.c	2011-06-17 10:54:05.553270923 +0200
+++ libp11.new//src/p11_load.c	2011-06-17 11:53:18.089476019 +0200
@@ -55,7 +55,7 @@
 int PKCS11_CTX_load(PKCS11_CTX * ctx, const char *name)
 {
 	PKCS11_CTX_private *priv = PRIVCTX(ctx);
-	CK_C_INITIALIZE_ARGS args;
+	CK_C_INITIALIZE_ARGS *args = NULL;
 	CK_INFO ck_info;
 	int rv;
 
@@ -70,9 +70,11 @@
 	}
 
 	/* Tell the PKCS11 to initialize itself */
-	memset(&args, 0, sizeof(args));
-	args.pReserved = priv->init_args;
-	rv = priv->method->C_Initialize(&args);
+	if (priv->init_args != NULL) {
+		args = (CK_C_INITIALIZE_ARGS *) calloc(1, sizeof(CK_C_INITIALIZE_ARGS));
+		args->pReserved = priv->init_args;
+	}
+	rv = priv->method->C_Initialize(args);
 	if (rv && rv != CKR_CRYPTOKI_ALREADY_INITIALIZED) {
 		PKCS11err(PKCS11_F_PKCS11_CTX_LOAD, rv);
 		return -1;
___
opensc-devel mailing list
opensc-devel@lists.opensc-project.org
http://www.opensc-project.org/mailman/listinfo/opensc-devel

[opensc-devel] OT: Today's Github sweetness

2011-06-17 Thread Martin Paljak
https://github.com/MrMEEE/bumblebee/commit/a047be85247755cdbe0acce6#diff-1

A nice example of fine Gtihub code commenting (mis?)use :)

Cheers,
Martin
___
opensc-devel mailing list
opensc-devel@lists.opensc-project.org
http://www.opensc-project.org/mailman/listinfo/opensc-devel