-
Notifications
You must be signed in to change notification settings - Fork 369
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
esys: remove trailing zeros in auth value. #2665
Merged
AndreasFuchsTPM
merged 1 commit into
tpm2-software:master
from
JuergenReppSIT:esys-fix-trailing-zeroes-in-auth-value
Jan 10, 2024
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -148,6 +148,11 @@ Esys_ObjectChangeAuth_Async( | |
TSS2L_SYS_AUTH_COMMAND auths; | ||
RSRC_NODE_T *objectHandleNode; | ||
RSRC_NODE_T *parentHandleNode; | ||
TPM2B_AUTH authCopy = | ||
{ .size = 0, | ||
.buffer = {} | ||
}; | ||
TPMI_ALG_HASH hashAlg = 0; | ||
|
||
/* Check context, sequence correctness and set state to error for now */ | ||
if (esysContext == NULL) { | ||
|
@@ -169,6 +174,17 @@ Esys_ObjectChangeAuth_Async( | |
r = esys_GetResourceObject(esysContext, parentHandle, &parentHandleNode); | ||
return_state_if_error(r, _ESYS_STATE_INIT, "parentHandle unknown."); | ||
|
||
if (objectHandleNode->rsrc.rsrcType == IESYSC_KEY_RSRC) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what about NV objects? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The spec states: |
||
hashAlg = objectHandleNode->rsrc.misc.rsrc_key_pub.publicArea.nameAlg; | ||
} | ||
|
||
if (newAuth) { | ||
authCopy = *newAuth; | ||
}; | ||
|
||
r = iesys_adapt_auth_value(&esysContext->crypto_backend, &authCopy, hashAlg); | ||
return_state_if_error(r, _ESYS_STATE_INIT, "Adapt auth value"); | ||
|
||
/* Initial invocation of SAPI to prepare the command buffer with parameters */ | ||
r = Tss2_Sys_ObjectChangeAuth_Prepare(esysContext->sys, | ||
(objectHandleNode == NULL) | ||
|
@@ -177,7 +193,7 @@ Esys_ObjectChangeAuth_Async( | |
(parentHandleNode == NULL) | ||
? TPM2_RH_NULL | ||
: parentHandleNode->rsrc.handle, | ||
newAuth); | ||
&authCopy); | ||
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error."); | ||
|
||
/* Calculate the cpHash Values */ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any reason to not do this in store_input_parameters?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A good hint. The spec states:
This command does not change the authorization of the TPM-resident object on which it operates.
Therefore, the old authValue (of the TPM-resident object) is used when generating the response HMAC
key if required.
So it makes no sense to store the auth value in the esys object. I will remove this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think @williamcroberts wants the "iesys_strip_trailing_zeros" command to be implemented in the "store_input_parameters" function. This makes also sense to me.
@JuergenReppSIT: Could you do this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@williamcroberts @cplappert Sorry my comment was related to Esys_ObjectChangeAuth. I will do it in store_input_parameters.