Open wmjdgla opened 7 months ago
Tpm2PcrRead is doing a member-by-member copy of the input TPML_PCR_SELECTION parameter rather than marshaling it: https://github.com/tianocore/edk2/blob/b7f8779fe1f60113fdaab3b2f3f17c9f900b0456/SecurityPkg/Library/Tpm2CommandLib/Tpm2Integrity.c#L359-L364 This results in the TPM2_PCR_READ_COMMAND bytes being malformed whenever sizeofSelect != PCR_SELECT_MAX.
Tpm2PcrRead
TPML_PCR_SELECTION
TPM2_PCR_READ_COMMAND
sizeofSelect != PCR_SELECT_MAX
Further down, Tpm2PcrAllocate also marshals an input TPML_PCR_SELECTION parameter and it is done correctly: https://github.com/tianocore/edk2/blob/b7f8779fe1f60113fdaab3b2f3f17c9f900b0456/SecurityPkg/Library/Tpm2CommandLib/Tpm2Integrity.c#L515-L524
Tpm2PcrAllocate
Yes, agree this is a bug. Do you want to propose a patch?
@jyao1 Was this resolved?
Tpm2PcrRead
is doing a member-by-member copy of the inputTPML_PCR_SELECTION
parameter rather than marshaling it: https://github.com/tianocore/edk2/blob/b7f8779fe1f60113fdaab3b2f3f17c9f900b0456/SecurityPkg/Library/Tpm2CommandLib/Tpm2Integrity.c#L359-L364 This results in theTPM2_PCR_READ_COMMAND
bytes being malformed wheneversizeofSelect != PCR_SELECT_MAX
.Further down,
Tpm2PcrAllocate
also marshals an inputTPML_PCR_SELECTION
parameter and it is done correctly: https://github.com/tianocore/edk2/blob/b7f8779fe1f60113fdaab3b2f3f17c9f900b0456/SecurityPkg/Library/Tpm2CommandLib/Tpm2Integrity.c#L515-L524