summaryrefslogtreecommitdiff
path: root/ckcapi-key.c
diff options
context:
space:
mode:
Diffstat (limited to 'ckcapi-key.c')
-rw-r--r--ckcapi-key.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/ckcapi-key.c b/ckcapi-key.c
index 88e769e..d36a4c9 100644
--- a/ckcapi-key.c
+++ b/ckcapi-key.c
@@ -898,12 +898,18 @@ find_certificate_key(CkCapiSession* session, CK_OBJECT_CLASS cls,
KeyObjectData kdata;
CkCapiObject* obj;
DWORD prov_length;
- CK_RV ret;
+ DWORD error;
+ CK_RV ret = CKR_OK;
/* Look up the key provider info and identifier */
if(!CertGetCertificateContextProperty(cert, CERT_KEY_PROV_INFO_PROP_ID, NULL, &prov_length) ||
!CertGetCertificateContextProperty(cert, CERT_KEY_IDENTIFIER_PROP_ID, NULL, &key_identifier.cbData))
- return ckcapi_winerr_to_ckr(GetLastError());
+ {
+ error = GetLastError();
+ if(error == CRYPT_E_NOT_FOUND)
+ return CKR_OK;
+ return ckcapi_winerr_to_ckr(error);
+ }
/* We own the info memory */
prov_info = malloc(prov_length);
@@ -949,6 +955,10 @@ find_certificate_key(CkCapiSession* session, CK_OBJECT_CLASS cls,
}
}
}
+ else
+ {
+ ret = ckcapi_winerr_to_ckr(GetLastError());
+ }
if(key_identifier.pbData)
free(key_identifier.pbData);