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

TPM command authentication refactor #305

Merged
merged 2 commits into from
Oct 12, 2023
Merged

Conversation

dgarske
Copy link
Contributor

@dgarske dgarske commented Oct 11, 2023

Refactor of the command authentication. If command does not require auth do not supply it. ZD 16689

@dgarske dgarske self-assigned this Oct 11, 2023
@dgarske dgarske requested a review from jpbland1 October 11, 2023 23:13
src/tpm2.c Outdated
@@ -2754,14 +2697,15 @@ TPM_RC TPM2_GetCommandAuditDigest(GetCommandAuditDigest_In* in,
TPM2_Packet packet;
CmdInfo_t info = {0,0,0,0};
info.inHandleCnt = 2;
info.flags = (CMD_FLAG_ENC2 | CMD_FLAG_DEC2);
info.flags = (CMD_FLAG_ENC2 | CMD_FLAG_DEC2 |
CMD_FLAG_AUTH_USER1 | CMD_FLAG_AUTH_USER1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

duplicate or here

for (i=0; i<info->authCnt; i++) {
/* Note: Casting a TPM2_AUTH_SESSION to TPMS_AUTH_COMMAND here,
* this is allowed because top of structure matches */
TPM2_Packet_AppendAuthCmd(packet, (TPMS_AUTH_COMMAND*)&ctx->session[i]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible for the indices to be mismatched here? For example suppose TPM2_GetCmdAuthCount incremented authSessCount for indices 0 and 2 with a count of 2. Wouldn't this use indices 0 and 1 instead of 0 and 2?

Copy link
Contributor

@jpbland1 jpbland1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@jpbland1 jpbland1 merged commit 79105f9 into wolfSSL:master Oct 12, 2023
1 check passed
@dgarske dgarske deleted the auth_refactor branch December 29, 2023 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants