Merged
Conversation
…n() is a default PCRSelection{} object (whose fields are unset).
While encodeTPMLPCRSelection() already correctly returns tpmutil.Pack(uint32(0)) in case "sel" is a default PCRSelection{} object, we are planning to add support for TPM2_PCR_Allocate command, and then the following "sel" value may be used with TPM2_PCR_Allocate command:
[
{Hash: tpm2.AlgSHA1, PCRs: []int{}},
{Hash: tpm2.AlgSHA256, PCRs: []int{0,1,2,...,23}},
]"
The existing code with the "len(s.PCRs) == 0" check would produce an incorrect result with this "sel".
An example from section "22.5 TPM2_PCR_Allocate" of the spec https://trustedcomputinggroup.org/wp-content/uploads/Trusted-Platform-Module-2.0-Library-Part-3-Version-184_pub.pdf
"To change the allocation of a TPM from 24 SHA1 PCR and no SHA256 PCR to 24 SHA256 PCR and no SHA1 PCR, the pcrAllocation would have to have two selections: one for the empty SHA1 bank and one for the SHA256 bank with 24 PCR."
chrisfenner
approved these changes
Apr 17, 2025
Member
|
Thanks for the implementation! |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fix for #393