Skip to content

Commit

Permalink
Fix key size for CKM_AES_KEY_WRAP_KWP
Browse files Browse the repository at this point in the history
  • Loading branch information
qpernil committed Aug 30, 2024
1 parent 7059476 commit c9d2220
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions pkcs11/util_pkcs11.c
Original file line number Diff line number Diff line change
Expand Up @@ -635,12 +635,6 @@ CK_RV get_mechanism_info(yubihsm_pkcs11_slot *slot, CK_MECHANISM_TYPE type,
pInfo->flags = CKF_DIGEST;
break;

case CKM_AES_KEY_WRAP_KWP:
pInfo->ulMaxKeySize = 256;
pInfo->ulMinKeySize = 128;
pInfo->flags = CKF_HW;
break;

case CKM_YUBICO_AES_CCM_WRAP:
pInfo->ulMaxKeySize = 256;
pInfo->ulMinKeySize = 128;
Expand Down Expand Up @@ -670,6 +664,13 @@ CK_RV get_mechanism_info(yubihsm_pkcs11_slot *slot, CK_MECHANISM_TYPE type,
pInfo->flags = CKF_HW | CKF_ENCRYPT | CKF_DECRYPT;
break;

case CKM_AES_KEY_WRAP_KWP:
find_minmax_aes_key_length_in_bytes(slot->connector->device.algorithms, slot->connector->device.n_algorithms,
&pInfo->ulMinKeySize,
&pInfo->ulMaxKeySize);
pInfo->flags = CKF_HW;
break;

default:
DBG_ERR("Invalid mechanism %lu", type);
return CKR_MECHANISM_INVALID;
Expand Down

0 comments on commit c9d2220

Please sign in to comment.