forked from wolfSSL/wolfssl
PKCS#11: compile time check in finding keys
When WC_PKCS11_FIND_WITH_ID_ONLY defined, don't add key class and type to attributes of search for by Id.
This commit is contained in:
@@ -1464,8 +1464,10 @@ static int Pkcs11FindKeyById(CK_OBJECT_HANDLE* key, CK_OBJECT_CLASS keyClass,
|
|||||||
int ret = 0;
|
int ret = 0;
|
||||||
CK_ULONG count;
|
CK_ULONG count;
|
||||||
CK_ATTRIBUTE keyTemplate[] = {
|
CK_ATTRIBUTE keyTemplate[] = {
|
||||||
|
#ifndef WC_PKCS11_FIND_WITH_ID_ONLY
|
||||||
{ CKA_CLASS, &keyClass, sizeof(keyClass) },
|
{ CKA_CLASS, &keyClass, sizeof(keyClass) },
|
||||||
{ CKA_KEY_TYPE, &keyType, sizeof(keyType) },
|
{ CKA_KEY_TYPE, &keyType, sizeof(keyType) },
|
||||||
|
#endif
|
||||||
{ CKA_ID, id, (CK_ULONG)idLen }
|
{ CKA_ID, id, (CK_ULONG)idLen }
|
||||||
};
|
};
|
||||||
CK_ULONG keyTmplCnt = sizeof(keyTemplate) / sizeof(*keyTemplate);
|
CK_ULONG keyTmplCnt = sizeof(keyTemplate) / sizeof(*keyTemplate);
|
||||||
|
Reference in New Issue
Block a user