Skip to content

Commit

Permalink
Merge pull request #208 from Yubico/wrap
Browse files Browse the repository at this point in the history
pkcs11: handle CKA_{DECRYPT,ENCRYPT} when generating wrap keys
  • Loading branch information
LDVG authored Nov 4, 2021
2 parents 4d0268d + 396c260 commit c68d542
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions pkcs11/yubihsm_pkcs11.c
Original file line number Diff line number Diff line change
Expand Up @@ -4541,6 +4541,22 @@ CK_DEFINE_FUNCTION(CK_RV, C_GenerateKey)
}
}

if (template.encrypt == ATTRIBUTE_TRUE) {
rc = yh_string_to_capabilities("wrap-data", &capabilities);
if (rc != YHR_SUCCESS) {
rv = CKR_FUNCTION_FAILED;
goto c_gk_out;
}
}

if (template.decrypt == ATTRIBUTE_TRUE) {
rc = yh_string_to_capabilities("unwrap-data", &capabilities);
if (rc != YHR_SUCCESS) {
rv = CKR_FUNCTION_FAILED;
goto c_gk_out;
}
}

rc = yh_string_to_capabilities("all", &delegated_capabilities);
if (rc != YHR_SUCCESS) {
rv = CKR_FUNCTION_FAILED;
Expand Down

0 comments on commit c68d542

Please sign in to comment.