Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(pkcs11-tool): testing HMAC #2643

Merged
merged 4 commits into from
Nov 17, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat(pkcs11-tool): --usage-sign is also for secret keys
  • Loading branch information
AlexandreGonzalo committed Nov 14, 2022
commit 31197f16d0ec8caee789205e16cf5292377ea72c
14 changes: 14 additions & 0 deletions src/tools/pkcs11-tool.c
Original file line number Diff line number Diff line change
Expand Up @@ -3268,6 +3268,13 @@ gen_key(CK_SLOT_ID slot, CK_SESSION_HANDLE session, CK_OBJECT_HANDLE *hSecretKey
n_attr++;
}

if (opt_key_usage_sign != 0) {
FILL_ATTR(keyTemplate[n_attr], CKA_SIGN, &_true, sizeof(_true));
n_attr++;
FILL_ATTR(keyTemplate[n_attr], CKA_VERIFY, &_true, sizeof(_true));
n_attr++;
}

FILL_ATTR(keyTemplate[n_attr], CKA_VALUE_LEN, &key_length, sizeof(key_length));
n_attr++;

Expand Down Expand Up @@ -4279,6 +4286,13 @@ static int write_object(CK_SESSION_HANDLE session)
n_seckey_attr++;
}

if (opt_key_usage_sign != 0) {
FILL_ATTR(seckey_templ[n_seckey_attr], CKA_SIGN, &_true, sizeof(_true));
n_seckey_attr++;
FILL_ATTR(seckey_templ[n_seckey_attr], CKA_VERIFY, &_true, sizeof(_true));
n_seckey_attr++;
}

if (opt_object_label != NULL) {
FILL_ATTR(seckey_templ[n_seckey_attr], CKA_LABEL, opt_object_label, strlen(opt_object_label));
n_seckey_attr++;
Expand Down