From nobody Tue Feb 10 12:57:17 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+97349+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+97349+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1671002143; cv=none; d=zohomail.com; s=zohoarc; b=LDBKFnyZPFEr8Q7IcPDvxnww2dE1DEgG4CP+Q+8tVBh1g6Gg30Uqf9PNdZxs5CKxfse7Ig/So8hS8wqCBY9lqC4ZVNtq4f1YDPVQA4twALlh9WXYHmxCKh8jTqXJu/FACEYP2qiETYqlOTme9pR6SS6LhOBAKmkDx3MZLwPXFFo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1671002143; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=g69iN2XTeNamdktO/CiNhL6jlRHZBUaJleLaLS5O3CE=; b=BNcShYJC9d17d1PRkNgdRRChAV37PjpSCjLmWq/oyiFVKhlJSJTuJKSrh6MgIvNiCorE3ZkVBLSW9wL8FnR1dx+r7kEuN3GLeqGCOsidNqIOMP3SEtiVm0Z9XXkSu4TlP7OZomcHE9bSvIAk0invIACnzdKHmLGTapdAxC/gRgE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+97349+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1671002143685291.64971364921723; Tue, 13 Dec 2022 23:15:43 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id UYZaYY1788612xixpbJXtrXh; Tue, 13 Dec 2022 23:15:43 -0800 X-Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mx.groups.io with SMTP id smtpd.web10.96891.1671002139984151067 for ; Tue, 13 Dec 2022 23:15:43 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10560"; a="317029435" X-IronPort-AV: E=Sophos;i="5.96,243,1665471600"; d="scan'208";a="317029435" X-Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Dec 2022 23:15:27 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10560"; a="599134785" X-IronPort-AV: E=Sophos;i="5.96,243,1665471600"; d="scan'208";a="599134785" X-Received: from mxu9-mobl1.ccr.corp.intel.com ([10.255.31.173]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Dec 2022 23:15:25 -0800 From: "Min Xu" To: devel@edk2.groups.io Cc: Min M Xu , Erdem Aktas , James Bottomley , Jiewen Yao , Tom Lendacky , Arti Gupta Subject: [edk2-devel] [PATCH V1 3/3] OvmfPkg/SecTpmMeasurementLib: Fix the mapping error of PCR and RTMR index Date: Wed, 14 Dec 2022 15:14:19 +0800 Message-Id: <20221214071419.1813-4-min.m.xu@intel.com> In-Reply-To: <20221214071419.1813-1-min.m.xu@intel.com> References: <20221214071419.1813-1-min.m.xu@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,min.m.xu@intel.com X-Gm-Message-State: tQOoepZffVVxHpn2UoFhn2Mxx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1671002143; bh=pBV5q2XeQJHRl5nipetr4ATNr+wDmgua7Ou49MJJOtg=; h=Cc:Date:From:Reply-To:Subject:To; b=rotL/LuJByB+DXgcM0pp5IVgeYakWRf2b7ak3PkLOeBny2kV3H2G0WMzHoBFMArFXaw +6cyKq015GWPSEXRlGflXCKfojxsE74R8RBUEeJ1GUZQ3sv43PkrJ0yTMlwzex0ZAji2c B12nbMXrcNokHoC/HLMQhXz4exZ8s48lWPM= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1671002144639100013 Content-Type: text/plain; charset="utf-8" From: Min M Xu BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4179 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 [ruleof2] Cc: James Bottomley [jejb] Cc: Jiewen Yao [jyao1] Cc: Tom Lendacky [tlendacky] Cc: Arti Gupta Signed-off-by: Min Xu --- .../Library/SecTpmMeasurementLib/SecTpmMeasurementLibTdx.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/SecurityPkg/Library/SecTpmMeasurementLib/SecTpmMeasurementLibT= dx.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] =3D> PCR[1,7] - RTMR[1] =3D> PCR[2,3,4,5] + RTMR[1] =3D> PCR[2,3,4,5,6] RTMR[2] =3D> PCR[8~15] RTMR[3] =3D> NA Note: PCR[0] is mapped to MRTD and should not appear here. - PCR[6] is reserved for OEM. It is not used. =20 @param[in] PCRIndex The input PCR index =20 @@ -51,7 +50,7 @@ GetMappedRtmrIndex ( { UINT8 RtmrIndex; =20 - if ((PCRIndex =3D=3D 6) || (PCRIndex =3D=3D 0) || (PCRIndex > 15)) { + if ((PCRIndex =3D=3D 0) || (PCRIndex > 15)) { DEBUG ((DEBUG_ERROR, "Invalid PCRIndex(%d) map to MR Index.\n", PCRInd= ex)); ASSERT (FALSE); return INVALID_PCR2MR_INDEX; @@ -60,7 +59,7 @@ GetMappedRtmrIndex ( RtmrIndex =3D 0; if ((PCRIndex =3D=3D 1) || (PCRIndex =3D=3D 7)) { RtmrIndex =3D 0; - } else if ((PCRIndex >=3D 2) && (PCRIndex < 6)) { + } else if ((PCRIndex >=3D 2) && (PCRIndex <=3D 6)) { RtmrIndex =3D 1; } else if ((PCRIndex >=3D 8) && (PCRIndex <=3D 15)) { RtmrIndex =3D 2; --=20 2.29.2.windows.2 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#97349): https://edk2.groups.io/g/devel/message/97349 Mute This Topic: https://groups.io/mt/95662133/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-