summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/lib/pkcs11/pkcs11_softtoken/common/softKeystore.c6
-rw-r--r--usr/src/lib/pkcs11/pkcs11_softtoken/common/softObjectUtil.c14
2 files changed, 17 insertions, 3 deletions
diff --git a/usr/src/lib/pkcs11/pkcs11_softtoken/common/softKeystore.c b/usr/src/lib/pkcs11/pkcs11_softtoken/common/softKeystore.c
index a641fc9527..b0ee8d2acb 100644
--- a/usr/src/lib/pkcs11/pkcs11_softtoken/common/softKeystore.c
+++ b/usr/src/lib/pkcs11/pkcs11_softtoken/common/softKeystore.c
@@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -1814,19 +1814,23 @@ soft_put_object_to_keystore(soft_object_t *objp)
if (rv != CKR_OK)
return (rv);
+ (void) pthread_mutex_lock(&soft_slot.slot_mutex);
if (objp->object_type == TOKEN_PUBLIC) {
if ((soft_keystore_put_new_obj(buf, len, B_TRUE,
B_FALSE, &objp->ks_handle)) == -1) {
+ (void) pthread_mutex_unlock(&soft_slot.slot_mutex);
free(buf);
return (CKR_FUNCTION_FAILED);
}
} else {
if ((soft_keystore_put_new_obj(buf, len, B_FALSE,
B_FALSE, &objp->ks_handle)) == -1) {
+ (void) pthread_mutex_unlock(&soft_slot.slot_mutex);
free(buf);
return (CKR_FUNCTION_FAILED);
}
}
+ (void) pthread_mutex_unlock(&soft_slot.slot_mutex);
free(buf);
return (CKR_OK);
diff --git a/usr/src/lib/pkcs11/pkcs11_softtoken/common/softObjectUtil.c b/usr/src/lib/pkcs11/pkcs11_softtoken/common/softObjectUtil.c
index 6dcc201459..7bfb92c529 100644
--- a/usr/src/lib/pkcs11/pkcs11_softtoken/common/softObjectUtil.c
+++ b/usr/src/lib/pkcs11/pkcs11_softtoken/common/softObjectUtil.c
@@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -871,12 +871,16 @@ soft_delete_token_object(soft_object_t *objp, boolean_t persistent,
boolean_t lock_held)
{
+ if (!lock_held)
+ (void) pthread_mutex_lock(&soft_slot.slot_mutex);
if (persistent)
/* Delete the object from the keystore. */
(void) soft_keystore_del_obj(&objp->ks_handle, B_FALSE);
/* Remove the object from the slot's token object list. */
- soft_remove_token_object_from_slot(objp, lock_held);
+ soft_remove_token_object_from_slot(objp, B_TRUE);
+ if (!lock_held)
+ (void) pthread_mutex_unlock(&soft_slot.slot_mutex);
soft_delete_object_cleanup(objp);
}
@@ -1341,6 +1345,12 @@ refresh_token_objects()
ondisk_obj = on_disk_list;
prev_ondisk_obj = NULL;
+ /* larval object that has not been written to disk */
+ if (in_core_obj->ks_handle.name[0] == '\0') {
+ in_core_obj = in_core_obj->next;
+ continue;
+ }
+
while ((!found) && (ondisk_obj != NULL)) {
if (strcmp((char *)((ondisk_obj->ks_handle).name),