Skip to content

Commit

Permalink
TESTCASES: Test CKA_WRAP_TEMPLATE and CKA_UNWRAP_TEMPLATE
Browse files Browse the repository at this point in the history
Enhance the EC tests to supply CKA_WRAP_TEMPLATE and CKA_UNWRAP_TEMPLATE
for the wrapping key that is then used to wrap and unwrap an EC private
key.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
  • Loading branch information
ifranzki authored and p-steuer committed Nov 24, 2020
1 parent 46ceaf8 commit 867c526
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion testcases/crypto/ec_func.c
Expand Up @@ -1705,13 +1705,28 @@ CK_RV run_TransferECCKeyPairSignVerify()
CK_ULONG keylen = 32;
CK_BBOOL true = TRUE;
CK_BYTE wrap_key_label[] = "Wrap_Key";
CK_OBJECT_CLASS wclass = CKO_PRIVATE_KEY;
CK_KEY_TYPE keyType = CKK_EC;
CK_ATTRIBUTE cka_wrap_tmpl[] = {
{CKA_PRIVATE, &true, sizeof(true)},
{CKA_CLASS, &wclass, sizeof(wclass)},
{CKA_KEY_TYPE, &keyType, sizeof(keyType)},
};
CK_ATTRIBUTE cka_unwrap_tmpl[] = {
{CKA_DECRYPT, &true, sizeof(true)},
{CKA_SIGN, &true, sizeof(true)},
{CKA_DERIVE, &true, sizeof(true)},
{CKA_PRIVATE, &true, sizeof(true)},
};
CK_ATTRIBUTE secret_tmpl[] = {
{CKA_CLASS, &wkclass, sizeof(wkclass)},
{CKA_VALUE_LEN, &keylen, sizeof(keylen)},
{CKA_LABEL, &wrap_key_label, sizeof(wrap_key_label)},
{CKA_TOKEN, &true, sizeof(true)},
{CKA_WRAP, &true, sizeof(true)},
{CKA_UNWRAP, &true, sizeof(true)}
{CKA_UNWRAP, &true, sizeof(true)},
{CKA_WRAP_TEMPLATE, &cka_wrap_tmpl, sizeof(cka_wrap_tmpl)},
{CKA_UNWRAP_TEMPLATE, &cka_unwrap_tmpl, sizeof(cka_unwrap_tmpl)},
};

rc = funcs->C_GenerateKey(session, &aes_keygen_mech, secret_tmpl,
Expand Down

0 comments on commit 867c526

Please sign in to comment.