Skip to content

TPM2_PCR_Allocate support#394

Merged
chrisfenner merged 2 commits intogoogle:mainfrom
zhsh:tpm2-pcr-allocate
Apr 17, 2025
Merged

TPM2_PCR_Allocate support#394
chrisfenner merged 2 commits intogoogle:mainfrom
zhsh:tpm2-pcr-allocate

Conversation

@zhsh
Copy link
Copy Markdown
Contributor

@zhsh zhsh commented Apr 17, 2025

Fix for #393

zhsh added 2 commits April 17, 2025 13:11
…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."
@zhsh zhsh requested a review from a team as a code owner April 17, 2025 06:08
@chrisfenner
Copy link
Copy Markdown
Member

Thanks for the implementation!

@chrisfenner chrisfenner merged commit 8ac9cae into google:main Apr 17, 2025
4 checks passed
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