From: "Min Xu" <min.m.xu@intel.com>
To: devel@edk2.groups.io
Cc: Min M Xu <min.m.xu@intel.com>,
Erdem Aktas <erdemaktas@google.com>,
James Bottomley <jejb@linux.ibm.com>,
Jiewen Yao <jiewen.yao@intel.com>,
Tom Lendacky <thomas.lendacky@amd.com>,
Arti Gupta <ARGU@microsoft.com>
Subject: [PATCH V1 3/3] OvmfPkg/SecTpmMeasurementLib: Fix the mapping error of PCR and RTMR index
Date: Wed, 14 Dec 2022 15:14:19 +0800 [thread overview]
Message-ID: <20221214071419.1813-4-min.m.xu@intel.com> (raw)
In-Reply-To: <20221214071419.1813-1-min.m.xu@intel.com>
From: Min M Xu <min.m.xu@intel.com>
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>
---
.../Library/SecTpmMeasurementLib/SecTpmMeasurementLibTdx.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/SecurityPkg/Library/SecTpmMeasurementLib/SecTpmMeasurementLibTdx.c b/SecurityPkg/Library/SecTpmMeasurementLib/SecTpmMeasurementLibTdx.c
index 38887b172dc0..36bfa373fe0f 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;
--
2.29.2.windows.2
next prev parent reply other threads:[~2022-12-14 7:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-14 7:14 [PATCH V1 0/3] Fix incorrect implementation in CcMeasurement Min Xu
2022-12-14 7:14 ` [PATCH V1 1/3] OvmfPkg/TdTcg2Dxe: Fix incorrect protocol and structure version Min Xu
2022-12-14 7:14 ` [PATCH V1 2/3] OvmfPkg/TdTcg2Dxe: Fix the mapping error between PCR index and MR index Min Xu
2022-12-14 7:14 ` Min Xu [this message]
2022-12-14 16:24 ` [PATCH V1 0/3] Fix incorrect implementation in CcMeasurement Yao, Jiewen
[not found] ` <1730B590101EA428.23954@groups.io>
2022-12-15 3:20 ` [edk2-devel] " Yao, Jiewen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221214071419.1813-4-min.m.xu@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox