Hi,

regarding to our problem with accessing multiple PIN protected  
storages with pkcs11, we investigated the problem.
It seems that the keycache may get entries, with an invalid length  
arguments.


Problem that has been solved with the attached patch:

Prerequisite: 2 PIN protected areas on CryptoToken ( We used the  
Alladin eToken32  )

If you have logged into PIN1 and closed the session,  and immediately  
log into PIN2, creating Objects may fail with different error  
messages. ( Internal OpenSC Error / Free space too small etc ... )


Index: opensc-0.11.9/src/pkcs15init/keycache.c
===================================================================
--- opensc-0.11.9/src/pkcs15init/keycache.c     (revision 21)
+++ opensc-0.11.9/src/pkcs15init/keycache.c     (working copy)
@@ -264,6 +264,10 @@
                        s = new_entry(path, SC_AC_CHV, ref);
                        if (s == NULL)
                                return SC_ERROR_OUT_OF_MEMORY;
+       
+                       s->len = sc_keycache_get_key(path, SC_AC_CHV, -1, 
s->value,  
MAX_SECRET);
+                       if(s->len < 0)
+                               return SC_ERROR_OBJECT_NOT_FOUND;
                }

                /* Set the pin name */

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

Reply via email to