Geoff,
I think you added that code in the wrong spot. The function you
added it to is an internal function which deletes memory. This is
likely why you are seeing the strange behavior. Take that same code
and add it to p11_object.c in C_DestroyObject. This is where you
want to put that ....
Put your code before the object_FreeObject(session->session.slotID,
(P11_Object *)hObject);
Thanks,
Dave
On May 25, 2005, at 11:01 AM, Geoffrey Elgey wrote:
G'day,
Chris Osgood wrote:
C_Destroy is currently not implemented for objects stored on the
token.
I think that would be relatively easy to add since it would just
require
looking up the OID and calling MSCDeleteObject.
I added the following patch, which seemed to work (at least, my
test program ran successfully, and muscleTool showed no objects on
the card).
However, now my card returns "token not initialized" when I call
C_GetTokenInfo or C_OpenSession. Strangely, other tools such as
opensc's pkcs11-tool still work, and I haven't figured out why this
is occurring.
So I'm not sure if this patch has any side-effects, but perhaps
someone can else can verify whether it works or fails.
-- Geoff
--- libmusclepkcs11/src/p11x_object.c 2003-11-28
19:47:13.000000000 +1000
+++ libmusclepkcs11/src/p11x_object.c 2005-05-25
23:57:57.000000000 +1000
@@ -79,8 +79,33 @@
if (!object->prev && !object->next)
st.slots[slotID].objects = 0x00;
- if (object->msc_obj)
+ if (object->msc_obj)
+ {
+ char obj_id[MSC_MAXSIZE_OBJID];
+
+ /*
+ * The PKCS#11 object is stored under two MSC object
IDs. The
+ * first MSC object contains the value of the
CKA_VALUE attribute,
+ * and has an ID such as "O0". The second MSC object
contains the
+ * values of the remaining PKCS#11 data object
attributes (such
+ * as CKA_APPLICATION, CKA_LABEL, etc) and has an ID
such as
+ * "o0" (that is, the ID of the first object, with the
initial
+ * letter converted to lower case).
+ */
+
+ /* Get a copy of the object ID */
+ strncpy((char *) obj_id, object->msc_obj->objectID,
+ sizeof (obj_id));
+
+ /* Delete the first MSC object (ie, the CKA_VALUE) */
+ msc_DeleteObject(&st.slots[slotID].conn, (char *)
obj_id, 0);
+
+ /* Delete the second MSC object (ie, the other
attributes) */
+ obj_id[0] = tolower(obj_id[0]);
+ msc_DeleteObject(&st.slots[slotID].conn, (char *)
obj_id, 0);
+
free(object->msc_obj);
+ }
_______________________________________________
Muscle mailing list
[email protected]
http://lists.drizzle.com/mailman/listinfo/muscle
------------------------------------------------------------------------
------------
David Corcoran [EMAIL PROTECTED]
Identity Alliance http://www.identityalliance.com
phone: 260-488-3099 fax: 260-488-2455
Smart Cards, Biometrics, Training, Identity Management
------------------------------------------------------------------------
-------------
_______________________________________________
Muscle mailing list
[email protected]
http://lists.drizzle.com/mailman/listinfo/muscle