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

FAPI: Fix usage of external PEM keys for PolicyAuthorize. 4.1.x #2857

Open
wants to merge 1 commit into
base: 4.1.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 2 additions & 0 deletions src/tss2-fapi/api/Fapi_Import.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ Fapi_Import_Async(
&extPubKey->public);
goto_if_error(r, "Convert PEM public key into TPM public key.", cleanup_error);

extPubKey->public.publicArea.nameAlg = context->profiles.default_profile.nameAlg;

command->new_object = *object;
if (strncmp("/", path, 1) == 0)
pos = 1;
Expand Down
4 changes: 2 additions & 2 deletions src/tss2-fapi/fapi_crypto.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ static const TPM2B_PUBLIC templateRsaSign = {
.size = 0,
.publicArea = {
.type = TPM2_ALG_RSA,
.nameAlg = TPM2_ALG_SHA1,
.nameAlg = TPM2_ALG_SHA256,
.objectAttributes = ( TPMA_OBJECT_SIGN_ENCRYPT ),
.authPolicy = {
.size = 0,
Expand Down Expand Up @@ -153,7 +153,7 @@ static const TPM2B_PUBLIC templateEccSign = {
.size = 0,
.publicArea = {
.type = TPM2_ALG_ECC,
.nameAlg = TPM2_ALG_SHA1,
.nameAlg = TPM2_ALG_SHA256,
.objectAttributes = ( TPMA_OBJECT_SIGN_ENCRYPT ),
.authPolicy = {
.size = 0,
Expand Down
4 changes: 3 additions & 1 deletion src/tss2-fapi/ifapi_policy_callbacks.c
Original file line number Diff line number Diff line change
Expand Up @@ -1466,8 +1466,10 @@ ifapi_exec_auth_policy(
cleanup:
SAFE_FREE(names);
/* Check whether cleanup was executed. */
if (fapi_ctx->policy.policyutil_stack)
if (fapi_ctx->policy.policyutil_stack) {
cleanup_policy_list(current_policy->policy_list);
current_policy->policy_list = NULL;
}
return r;
}

Expand Down
Loading