diff options
author | Min M Xu <min.m.xu@intel.com> | 2022-12-14 15:14:19 +0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2022-12-15 03:07:33 +0000 |
commit | 01c0d3c0d508b8c1b41fd58e2ec565b40ea000ca (patch) | |
tree | a642108641ca2428f7cac5176f172df466b13ebe /SecurityPkg | |
parent | fb91d6cbd0cff704586c4cadbef870acef9c52ef (diff) | |
download | edk2-01c0d3c0d508b8c1b41fd58e2ec565b40ea000ca.tar.gz edk2-01c0d3c0d508b8c1b41fd58e2ec565b40ea000ca.tar.bz2 edk2-01c0d3c0d508b8c1b41fd58e2ec565b40ea000ca.zip |
OvmfPkg/SecTpmMeasurementLib: Fix the mapping error of PCR and RTMR index
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4179
TDVF has the feature to do RTMR measurement in SEC phase. In the same time
it builds a GUID hob which carries the hash value of the measurement so
that in DXE phase a td event can be created based on this GUID Hob. There
is a mapping error between TPM PCR index and RTMR index according to UEFI
2.10. That PCR6 is missing in the mapping. This patch fixes this issue.
Cc: Erdem Aktas <erdemaktas@google.com> [ruleof2]
Cc: James Bottomley <jejb@linux.ibm.com> [jejb]
Cc: Jiewen Yao <jiewen.yao@intel.com> [jyao1]
Cc: Tom Lendacky <thomas.lendacky@amd.com> [tlendacky]
Cc: Arti Gupta <ARGU@microsoft.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Diffstat (limited to 'SecurityPkg')
-rw-r--r-- | SecurityPkg/Library/SecTpmMeasurementLib/SecTpmMeasurementLibTdx.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/SecurityPkg/Library/SecTpmMeasurementLib/SecTpmMeasurementLibTdx.c b/SecurityPkg/Library/SecTpmMeasurementLib/SecTpmMeasurementLibTdx.c index 38887b172d..36bfa373fe 100644 --- a/SecurityPkg/Library/SecTpmMeasurementLib/SecTpmMeasurementLibTdx.c +++ b/SecurityPkg/Library/SecTpmMeasurementLib/SecTpmMeasurementLibTdx.c @@ -33,12 +33,11 @@ typedef struct { /**
Get the mapped RTMR index based on the input PCRIndex.
RTMR[0] => PCR[1,7]
- RTMR[1] => PCR[2,3,4,5]
+ RTMR[1] => PCR[2,3,4,5,6]
RTMR[2] => PCR[8~15]
RTMR[3] => NA
Note:
PCR[0] is mapped to MRTD and should not appear here.
- PCR[6] is reserved for OEM. It is not used.
@param[in] PCRIndex The input PCR index
@@ -51,7 +50,7 @@ GetMappedRtmrIndex ( {
UINT8 RtmrIndex;
- if ((PCRIndex == 6) || (PCRIndex == 0) || (PCRIndex > 15)) {
+ if ((PCRIndex == 0) || (PCRIndex > 15)) {
DEBUG ((DEBUG_ERROR, "Invalid PCRIndex(%d) map to MR Index.\n", PCRIndex));
ASSERT (FALSE);
return INVALID_PCR2MR_INDEX;
@@ -60,7 +59,7 @@ GetMappedRtmrIndex ( RtmrIndex = 0;
if ((PCRIndex == 1) || (PCRIndex == 7)) {
RtmrIndex = 0;
- } else if ((PCRIndex >= 2) && (PCRIndex < 6)) {
+ } else if ((PCRIndex >= 2) && (PCRIndex <= 6)) {
RtmrIndex = 1;
} else if ((PCRIndex >= 8) && (PCRIndex <= 15)) {
RtmrIndex = 2;
|