@@ -853,9 +853,7 @@ __open_object(
853853 const bool private_object ,
854854 const CK_ATTRIBUTE * const filter ,
855855 const CK_ULONG filter_size ,
856- CK_OBJECT_HANDLE * const handle ,
857- CK_ATTRIBUTE * attrs ,
858- const CK_ULONG attrs_size
856+ CK_OBJECT_HANDLE * const handle
859857) {
860858 mycms_system system = NULL ;
861859 __mycms_certificate_driver_pkcs11 certificate_pkcs11 = NULL ;
@@ -943,16 +941,6 @@ __open_object(
943941 }
944942 }
945943
946- if (__get_object_attributes (
947- system ,
948- certificate_pkcs11 ,
949- * handle ,
950- attrs ,
951- attrs_size
952- ) != CKR_OK ) {
953- goto cleanup ;
954- }
955-
956944 ret = true;
957945
958946cleanup :
@@ -998,14 +986,22 @@ __open_certificate(
998986 private ,
999987 filter ,
1000988 sizeof (filter ) / sizeof (* filter ),
1001- & h ,
1002- attrs ,
1003- sizeof (attrs ) / sizeof (* attrs )
989+ & h
1004990 )
1005991 ) {
1006992 goto cleanup ;
1007993 }
1008994
995+ if (__get_object_attributes (
996+ system ,
997+ certificate_pkcs11 ,
998+ h ,
999+ attrs ,
1000+ sizeof (attrs ) / sizeof (* attrs )
1001+ ) != CKR_OK ) {
1002+ goto cleanup ;
1003+ }
1004+
10091005 if (attrs [CERT_ATTRS_ID ].ulValueLen == CK_UNAVAILABLE_INFORMATION ) {
10101006 goto cleanup ;
10111007 }
@@ -1075,16 +1071,22 @@ __open_private_key(
10751071 true,
10761072 filter ,
10771073 sizeof (filter ) / sizeof (* filter ),
1078- & certificate_pkcs11 -> key_handle ,
1079- attrs ,
1080- sizeof (attrs ) / sizeof (* attrs )
1074+ & certificate_pkcs11 -> key_handle
10811075 )
10821076 ) {
10831077 goto cleanup ;
10841078 }
10851079
1086- if (attrs [0 ].ulValueLen != CK_UNAVAILABLE_INFORMATION ) {
1087- certificate_pkcs11 -> always_authenticate = * (CK_BBOOL * )attrs [0 ].pValue != CK_FALSE ;
1080+ if (__get_object_attributes (
1081+ system ,
1082+ certificate_pkcs11 ,
1083+ certificate_pkcs11 -> key_handle ,
1084+ attrs ,
1085+ sizeof (attrs ) / sizeof (* attrs )
1086+ ) == CKR_OK ) {
1087+ if (attrs [0 ].ulValueLen != CK_UNAVAILABLE_INFORMATION ) {
1088+ certificate_pkcs11 -> always_authenticate = * (CK_BBOOL * )attrs [0 ].pValue != CK_FALSE ;
1089+ }
10881090 }
10891091
10901092 ret = true;
0 commit comments