Skip to content
Browse files

pkcs11: Fixed SIGV when deleting public key objects via PKCS#11

Thanks to Andreas Schwier.
  • Loading branch information...
1 parent c91f0e8 commit 40ff0e4ede64b28a060b97fe79c3aad06fb0296b @viktorTarasov viktorTarasov committed Oct 2, 2012
Showing with 4 additions and 3 deletions.
  1. +4 −3 src/pkcs11/framework-pkcs15.c
View
7 src/pkcs11/framework-pkcs15.c
@@ -2731,7 +2731,7 @@ pkcs15_any_destroy(struct sc_pkcs11_session *session, void *object)
if(slot->app_info)
aid = &slot->app_info->aid;
rv = sc_pkcs15init_finalize_profile(p11card->card, profile, aid);
- if (rv != CKR_OK) {
+ if (rv) {
sc_log(context, "Cannot finalize profile: %i", rv);
return sc_to_cryptoki_error(rv, "C_DestroyObject");
}
@@ -2756,8 +2756,9 @@ pkcs15_any_destroy(struct sc_pkcs11_session *session, void *object)
}
}
- /* Delete object in smartcard */
- rv = sc_pkcs15init_delete_object(fw_data->p15_card, profile, obj->base.p15_object);
+ /* Delete object in smartcard (if corresponding PKCS#15 object exists) */
+ if (obj->base.p15_object)
+ rv = sc_pkcs15init_delete_object(fw_data->p15_card, profile, obj->base.p15_object);
if (rv >= 0) {
/* Oppose to pkcs15_add_object */
--any_obj->refcount; /* correct refcont */

0 comments on commit 40ff0e4

Please sign in to comment.
Something went wrong with that request. Please try again.