Skip to content

Commit

Permalink
PKCS11: Add symmetric key capabilities to searchable criteria (#360)
Browse files Browse the repository at this point in the history
PKCS11: Add symmetric key capabilities to searchable criteria
  • Loading branch information
aveenismail authored Sep 21, 2023
1 parent eb0034f commit c366a2d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pkcs11/yubihsm_pkcs11.c
Original file line number Diff line number Diff line change
Expand Up @@ -1245,7 +1245,8 @@ CK_DEFINE_FUNCTION(CK_RV, C_Login)
ulPinLen, true, &session->slot->device_session);
if (yrc != YHR_SUCCESS) {
DBG_ERR("Failed to create session: %s", yh_strerror(yrc));
if (yrc == YHR_CRYPTOGRAM_MISMATCH || yrc == YHR_DEVICE_AUTHENTICATION_FAILED) {
if (yrc == YHR_CRYPTOGRAM_MISMATCH ||
yrc == YHR_DEVICE_AUTHENTICATION_FAILED) {
rv = CKR_PIN_INCORRECT;
} else {
rv = yrc_to_rv(yrc);
Expand Down Expand Up @@ -2401,7 +2402,7 @@ CK_DEFINE_FUNCTION(CK_RV, C_FindObjectsInit)
session->operation.op.find.only_private = true;
rc =
yh_string_to_capabilities("decrypt-pkcs,decrypt-oaep,derive-ecdh,"
"unwrap-data",
"unwrap-data,decrypt-ecb,decrypt-cbc",
&capabilities);
if (rc != YHR_SUCCESS) {
rv = yrc_to_rv(rc);
Expand All @@ -2412,8 +2413,8 @@ CK_DEFINE_FUNCTION(CK_RV, C_FindObjectsInit)

case CKA_ENCRYPT:
if (*((CK_BBOOL *) pTemplate[i].pValue) == CK_TRUE) {
type = YH_WRAP_KEY;
rc = yh_string_to_capabilities("wrap-data", &capabilities);
rc = yh_string_to_capabilities("wrap-data,encrypt-ecb,encrypt-cbc",
&capabilities);
if (rc != YHR_SUCCESS) {
rv = yrc_to_rv(rc);
goto c_foi_out;
Expand Down

0 comments on commit c366a2d

Please sign in to comment.