From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga07.intel.com (mga07.intel.com []) by mx.groups.io with SMTP id smtpd.web11.12912.1597386729279274811 for ; Thu, 13 Aug 2020 23:32:21 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=fail (domain: intel.com, ip: , mailfrom: qi1.zhang@intel.com) IronPort-SDR: yxmO4L76khsSa/Min8w1rr1kinCDxbVX/99pqldZkpfRfIcFpFiTp5OR09mvXNP/GIReMvW3M8 6KqObCFxX7aA== X-IronPort-AV: E=McAfee;i="6000,8403,9712"; a="218695903" X-IronPort-AV: E=Sophos;i="5.76,311,1592895600"; d="scan'208";a="218695903" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Aug 2020 23:32:21 -0700 IronPort-SDR: qxYm3O84wTgidTAsCfAG9yF01aN07k0i9Aij80AOvDXGJwyFvaanC1+8ohlYh5+YJzwJ0+VDZ0 kggH28ddXnjg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,311,1592895600"; d="scan'208";a="470494228" Received: from unknown (HELO shwdeSSSDDPDQI.ccr.corp.intel.com) ([10.239.158.153]) by orsmga005.jf.intel.com with ESMTP; 13 Aug 2020 23:32:19 -0700 From: "Qi Zhang" To: devel@edk2.groups.io Cc: Qi Zhang , Jiewen Yao , Jian J Wang , Rahul Kumar Subject: [PATCH v3 7/8] SecurityPkg/Tcg2: handle PRE HASH and LOG ONLY Date: Fri, 14 Aug 2020 14:31:58 +0800 Message-Id: <20200814063159.2477-8-qi1.zhang@intel.com> X-Mailer: git-send-email 2.26.2.windows.1 In-Reply-To: <20200814063159.2477-1-qi1.zhang@intel.com> References: <20200814063159.2477-1-qi1.zhang@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2376 Cc: Jiewen Yao Cc: Jian J Wang Cc: Qi Zhang Cc: Rahul Kumar Signed-off-by: Qi Zhang --- SecurityPkg/Include/Ppi/Tcg.h | 5 +++++ SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c | 12 +++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/SecurityPkg/Include/Ppi/Tcg.h b/SecurityPkg/Include/Ppi/Tcg.h index 0e943f2465..22f47f9817 100644 --- a/SecurityPkg/Include/Ppi/Tcg.h +++ b/SecurityPkg/Include/Ppi/Tcg.h @@ -18,6 +18,11 @@ typedef struct _EDKII_TCG_PPI EDKII_TCG_PPI; //=0D #define EDKII_TCG_PRE_HASH 0x0000000000000001=0D =0D +//=0D +// This bit is shall be set when HashData is the pre-hash digest and log o= nly.=0D +//=0D +#define EDKII_TCG_PRE_HASH_LOG_ONLY 0x0000000000000002=0D +=0D /**=0D Tpm measure and log data, and extend the measurement result into a speci= fic PCR.=0D =0D diff --git a/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c b/SecurityPkg/Tcg/Tcg2Pei/Tc= g2Pei.c index 246968bb7f..0e770f4485 100644 --- a/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c +++ b/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c @@ -453,13 +453,15 @@ HashLogExtendEvent ( return EFI_DEVICE_ERROR;=0D }=0D =0D - if(Flags & EDKII_TCG_PRE_HASH) {=0D + if ((Flags & EDKII_TCG_PRE_HASH) !=3D 0 || (Flags & EDKII_TCG_PRE_HASH_L= OG_ONLY) !=3D 0) {=0D ZeroMem (&DigestList, sizeof(DigestList));=0D CopyMem (&DigestList, HashData, sizeof(DigestList));=0D - Status =3D Tpm2PcrExtend (=0D - 0,=0D - &DigestList=0D - );=0D + if ((Flags & EDKII_TCG_PRE_HASH) !=3D0 ) {=0D + Status =3D Tpm2PcrExtend (=0D + NewEventHdr->PCRIndex,=0D + &DigestList=0D + );=0D + }=0D } else {=0D Status =3D HashAndExtend (=0D NewEventHdr->PCRIndex,=0D --=20 2.26.2.windows.1