From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mx.groups.io with SMTP id smtpd.web11.14751.1595320602811645963 for ; Tue, 21 Jul 2020 01:36:43 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=bB3HZPI1; spf=pass (domain: intel.com, ip: 134.134.136.65, mailfrom: jian.j.wang@intel.com) IronPort-SDR: RNEpO+G589yXzTe3TpMjWhL0bGbn72DEbQKMOOsoztH6akQI/W5YfcODTbmot8agOMeVz6Po7b GNdSsClnpqNA== X-IronPort-AV: E=McAfee;i="6000,8403,9688"; a="150075145" X-IronPort-AV: E=Sophos;i="5.75,378,1589266800"; d="scan'208";a="150075145" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jul 2020 01:36:42 -0700 IronPort-SDR: To2iU9o0bnNhjNQgDIvLeL/Ulo8AvF3cQhzovR6C9d2XEyDkVL0dR/sB7erDrd6AxeexILnOSF gf1dOr8cQOWg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,378,1589266800"; d="scan'208";a="319829494" Received: from orsmsx102.amr.corp.intel.com ([10.22.225.129]) by fmsmga002.fm.intel.com with ESMTP; 21 Jul 2020 01:36:41 -0700 Received: from orsmsx154.amr.corp.intel.com (10.22.226.12) by ORSMSX102.amr.corp.intel.com (10.22.225.129) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 21 Jul 2020 01:36:41 -0700 Received: from ORSEDG001.ED.cps.intel.com (10.7.248.4) by ORSMSX154.amr.corp.intel.com (10.22.226.12) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 21 Jul 2020 01:36:40 -0700 Received: from NAM02-CY1-obe.outbound.protection.outlook.com (104.47.37.54) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 21 Jul 2020 01:36:41 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EIVKmcdFZWPcuvW3BF4201DXaXG3HyhNTKYrJyl5NcxHgSdHFb1dySJJ8G1I3EMbzsSv2+OfQ4GHz/WsxSh+pFRyv+4en8rET/A4pxVKhNsduVoo0UFK8nsfwUqPjG7bbayUic0VJ0qfkKtwdr3HjcjU4LwSm6pZcFR3ylDZ0D6KhFP+t/vlauaBuE7ZVas0TJVGlEXWCAPmKGMSOvhk7W8wzghPo5fzX1JMFK0oWGQ5DEuev6lBrmPlzEjrSWDIuZc2gMct0jFJtVc3D9/H7ngjruoXrRJ4QKxIySekYPd9EUouk3NLmvIPgfNd4MgNPj9dEmjDhzhKARWVxu5QXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RSdw/Fpf4gAcK/Awd4+DBeP5rNdasoxLiZ9Jcn3SuIY=; b=T/Lnmuti7BO/XjNoB48Oa3PCy+ZSHRhpG/kCx0YtoHmzpKnAiVxvBriw756SrwoeEoaucs7n1shyw72eIIzOILS8G4+2yMTbw1FdvcAS6tnPyxpCipX3m1CeXpdtperoQdhzihxNyEhCTxTudm1jgIbUee5ZHEk45mBnXHKCbzc9dCp91aYtnFXoP4kVBEoWo4ww86hBdur7+Fir5Vqoc+vqQ0n+cxmOALAUgsiMtgDRUs2n3UQ7EcFO9oyc2gNRnT7Iy0TNnSeM+NQ4+m85b0Tfd/sPAckrIjYVKBPRMgfFSryCxaTBgEo3JtrF45JieTEQfKeF8yXCBe+ulx3FOw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RSdw/Fpf4gAcK/Awd4+DBeP5rNdasoxLiZ9Jcn3SuIY=; b=bB3HZPI10hjv2yyi2zMasAu/VOyS6R9Nw5qRC3AfVA/xm7TlZVeWngse+i0Voio2Z72XnzE8MuIwG89MJszCECXB9cziAxcrUJCiqpKKMu31MaWlVSIhWVka+XS1bbEYIBulBKm6lIirKo3IsRZs+qfC+5KnvHPmrc1W74VKhgY= Received: from BYAPR11MB3303.namprd11.prod.outlook.com (2603:10b6:a03:18::15) by BY5PR11MB3893.namprd11.prod.outlook.com (2603:10b6:a03:183::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3195.23; Tue, 21 Jul 2020 08:36:40 +0000 Received: from BYAPR11MB3303.namprd11.prod.outlook.com ([fe80::fc2a:d66e:8c79:6ecd]) by BYAPR11MB3303.namprd11.prod.outlook.com ([fe80::fc2a:d66e:8c79:6ecd%7]) with mapi id 15.20.3195.025; Tue, 21 Jul 2020 08:36:40 +0000 From: "Wang, Jian J" To: "Zhang, Qi1" , "devel@edk2.groups.io" CC: "Yao, Jiewen" , "Kumar, Rahul1" Subject: Re: [PATCH v4 3/6] SecurityPkg/Tcg: Add TcgPpi Thread-Topic: [PATCH v4 3/6] SecurityPkg/Tcg: Add TcgPpi Thread-Index: AQHWXBc772Gk80r9o0ih2OocRTGt0qkRu9qA Date: Tue, 21 Jul 2020 08:36:39 +0000 Message-ID: References: <20200717084935.11067-1-qi1.zhang@intel.com> <20200717084935.11067-4-qi1.zhang@intel.com> In-Reply-To: <20200717084935.11067-4-qi1.zhang@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiOGM2NzQyMjAtOWFmMi00MmRmLTg4ZDUtM2ZkZjhhMDVkYTg5IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiaEQrWk5CR3FMTm9salJVSnNBcEFJOUJFWEhVM0JSbWErTXU1V0dcL3E3Ynh5S29laFZtdHZLa3FZQjVTTVpGOUgifQ== dlp-reaction: no-action dlp-version: 11.2.0.6 dlp-product: dlpe-windows x-ctpclassification: CTP_NT authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.198.147.194] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 90d25d12-e1ae-4cf4-6361-08d82d513064 x-ms-traffictypediagnostic: BY5PR11MB3893: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:5516; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: EHqHmKdi33gT/S8vHgg96Ct9lzJH41/GPrAka0m9oPAM46l7t77W026ALxQageohm1JcKExka0SJLDFUkFemDTbDkYYOBaJh4/y8I0BhU+RL9pTvUJVleKWD2DgiBmVMGAD8lNNBwZxdszCdWymSLpYoEiRE0ehUuzKib+ArjevocRxoMdiPt9e2vtFPWaztFvedd0mFZJC/mwu22PeeYzqUmbF2E9EHF+db8CztE4A2ztpTxpuPQ6PV9Zv0cV0R0cA0NcFDYIT8R1r+S0cbt7vwnwIkhT7KIH4DPh09Wb4QdmRyG5Se2eQZrigO0lO3+e+ijf7Ytvsqi2pHWJZRMHvaqoi51IhTazz28BIpLSOUqkwkaYo0vnOhXp1SnB0kTxCsHf/18ZJSvHGDP76i+w== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR11MB3303.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(4636009)(136003)(366004)(39860400002)(346002)(396003)(376002)(4326008)(86362001)(66556008)(15650500001)(966005)(66476007)(66946007)(186003)(71200400001)(64756008)(6506007)(76116006)(66446008)(53546011)(8936002)(26005)(107886003)(478600001)(9686003)(316002)(8676002)(2906002)(52536014)(7696005)(33656002)(55016002)(5660300002)(110136005)(54906003)(83380400001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: l0wYLJgAiF8sL94nubRKZaagSxqP5eAjeKpNwixMQpk2WYxrSBErzYXbF6NUR2SGHhHTU+u7KKUtgZlJ6kPndhiF5kaGscATfQq3DXdjIOKiPZU6UDY4ACaEBvX/PE5pLUNnyy4R+Qhdhlm/KBFf5WTCXQZbOb//hkb0aATYtv+cP/q4oWbDaguE6jcaK8F5rqWekP0RypPtyxmu9sXHLPVtkWnw+s5WNbJwPFLER/8Cvuv5E1CT+8GSQPnSESZaCEVMUM8BvMULsufpCD2bACM4x4ztzul48E333ip1cprNLuZvgy+Ws6h5bHZSItmAOS+q4pSHLQ/jXtM+VRFjoRn4xiMdlksPCYM6yVz9VCBWt3iTapLzurELbzukDaSrjvj4sx5+kI4rexGhfZoDxFLpEZd7IZoMIJ+vRpJfNmnJ6LwIqJorteRme+n0veyy/BoxUYMwXG6QpflhlrKS1Rk02HxARU5M3P2RpDac6vyxJgy6Dssbdf2ykp1qzT0k MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BYAPR11MB3303.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 90d25d12-e1ae-4cf4-6361-08d82d513064 X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Jul 2020 08:36:39.8212 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: zdGCKRum3Ac1Vnv8pCPmvw/9dEWxYA7GXRV6rvC6Ta7AxDdEfjB2JocZKdtbLClyL384xsy/OfimVPieNFvLeQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR11MB3893 Return-Path: jian.j.wang@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Jian J Wang Regards, Jian > -----Original Message----- > From: Zhang, Qi1 > Sent: Friday, July 17, 2020 4:50 PM > To: devel@edk2.groups.io > Cc: Yao, Jiewen ; Wang, Jian J ; > Zhang, Qi1 ; Kumar, Rahul1 > Subject: [PATCH v4 3/6] SecurityPkg/Tcg: Add TcgPpi >=20 > From: Jiewen Yao >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2841 >=20 > Cc: Jiewen Yao > Cc: Jian J Wang > Cc: Qi Zhang > Cc: Rahul Kumar > Signed-off-by: Jiewen Yao > --- > SecurityPkg/Tcg/TcgPei/TcgPei.c | 61 ++++++++++++++++++++++++++++--- > SecurityPkg/Tcg/TcgPei/TcgPei.inf | 3 +- > 2 files changed, 58 insertions(+), 6 deletions(-) >=20 > diff --git a/SecurityPkg/Tcg/TcgPei/TcgPei.c b/SecurityPkg/Tcg/TcgPei/Tcg= Pei.c > index a9a808c9ec..2533388849 100644 > --- a/SecurityPkg/Tcg/TcgPei/TcgPei.c > +++ b/SecurityPkg/Tcg/TcgPei/TcgPei.c > @@ -1,7 +1,7 @@ > /** @file >=20 > Initialize TPM device and measure FVs before handing off control to DX= E. >=20 >=20 >=20 > -Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.
>=20 > +Copyright (c) 2005 - 2020, Intel Corporation. All rights reserved.
>=20 > SPDX-License-Identifier: BSD-2-Clause-Patent >=20 >=20 >=20 > **/ >=20 > @@ -17,6 +17,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent > #include >=20 > #include >=20 > #include >=20 > +#include >=20 >=20 >=20 > #include >=20 > #include >=20 > @@ -51,6 +52,45 @@ EFI_PEI_PPI_DESCRIPTOR mTpmInitializationDonePpiList > =3D { > NULL >=20 > }; >=20 >=20 >=20 > +/** >=20 > + Do a hash operation on a data buffer, extend a specific TPM PCR with t= he > hash result, >=20 > + and build a GUIDed HOB recording the event which will be passed to the= DXE > phase and >=20 > + added into the Event Log. >=20 > + >=20 > + @param[in] This Indicates the calling context >=20 > + @param[in] Flags Bitmap providing additional information. >=20 > + @param[in] HashData Physical address of the start of the dat= a buffer >=20 > + to be hashed, extended, and logged. >=20 > + @param[in] HashDataLen The length, in bytes, of the buffer refe= renced by > HashData. >=20 > + @param[in] NewEventHdr Pointer to a TCG_PCR_EVENT_HDR data > structure. >=20 > + @param[in] NewEventData Pointer to the new event data. >=20 > + >=20 > + @retval EFI_SUCCESS Operation completed successfully. >=20 > + @retval EFI_OUT_OF_RESOURCES No enough memory to log the new event. >=20 > + @retval EFI_DEVICE_ERROR The command was unsuccessful. >=20 > + >=20 > +**/ >=20 > +EFI_STATUS >=20 > +EFIAPI >=20 > +HashLogExtendEvent ( >=20 > + IN EDKII_TCG_PPI *This, >=20 > + IN UINT64 Flags, >=20 > + IN UINT8 *HashData, >=20 > + IN UINTN HashDataLen, >=20 > + IN TCG_PCR_EVENT_HDR *NewEventHdr, >=20 > + IN UINT8 *NewEventData >=20 > + ); >=20 > + >=20 > +EDKII_TCG_PPI mEdkiiTcgPpi =3D { >=20 > + HashLogExtendEvent >=20 > +}; >=20 > + >=20 > +EFI_PEI_PPI_DESCRIPTOR mTcgPpiList =3D { >=20 > + EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST, >=20 > + &gEdkiiTcgPpiGuid, >=20 > + &mEdkiiTcgPpi >=20 > +}; >=20 > + >=20 > // >=20 > // Number of firmware blobs to grow by each time we run out of room >=20 > // >=20 > @@ -243,7 +283,8 @@ TpmCommHashAll ( > and build a GUIDed HOB recording the event which will be passed to the= DXE > phase and >=20 > added into the Event Log. >=20 >=20 >=20 > - @param[in] PeiServices Describes the list of possible PEI Servi= ces. >=20 > + @param[in] This Indicates the calling context. >=20 > + @param[in] Flags Bitmap providing additional information. >=20 > @param[in] HashData Physical address of the start of the dat= a buffer >=20 > to be hashed, extended, and logged. >=20 > @param[in] HashDataLen The length, in bytes, of the buffer refe= renced by > HashData. >=20 > @@ -256,8 +297,10 @@ TpmCommHashAll ( >=20 >=20 > **/ >=20 > EFI_STATUS >=20 > +EFIAPI >=20 > HashLogExtendEvent ( >=20 > - IN EFI_PEI_SERVICES **PeiServices, >=20 > + IN EDKII_TCG_PPI *This, >=20 > + IN UINT64 Flags, >=20 > IN UINT8 *HashData, >=20 > IN UINTN HashDataLen, >=20 > IN TCG_PCR_EVENT_HDR *NewEventHdr, >=20 > @@ -346,7 +389,8 @@ MeasureCRTMVersion ( > TcgEventHdr.EventSize =3D (UINT32) StrSize((CHAR16*)PcdGetPtr > (PcdFirmwareVersionString)); >=20 >=20 >=20 > return HashLogExtendEvent ( >=20 > - PeiServices, >=20 > + &mEdkiiTcgPpi, >=20 > + 0, >=20 > (UINT8*)PcdGetPtr (PcdFirmwareVersionString), >=20 > TcgEventHdr.EventSize, >=20 > &TcgEventHdr, >=20 > @@ -415,7 +459,8 @@ MeasureFvImage ( > TcgEventHdr.EventSize =3D sizeof (FvBlob); >=20 >=20 >=20 > Status =3D HashLogExtendEvent ( >=20 > - (EFI_PEI_SERVICES **) GetPeiServicesTablePointer(), >=20 > + &mEdkiiTcgPpi, >=20 > + 0, >=20 > (UINT8*) (UINTN) FvBlob.BlobBase, >=20 > (UINTN) FvBlob.BlobLength, >=20 > &TcgEventHdr, >=20 > @@ -744,6 +789,12 @@ PeimEntryMP ( > Status =3D PeiServicesNotifyPpi (&mNotifyList[0]); >=20 > ASSERT_EFI_ERROR (Status); >=20 >=20 >=20 > + // >=20 > + // install Tcg Services >=20 > + // >=20 > + Status =3D PeiServicesInstallPpi (&mTcgPpiList); >=20 > + ASSERT_EFI_ERROR (Status); >=20 > + >=20 > return Status; >=20 > } >=20 >=20 >=20 > diff --git a/SecurityPkg/Tcg/TcgPei/TcgPei.inf > b/SecurityPkg/Tcg/TcgPei/TcgPei.inf > index c0bff6e85e..4ab4edd657 100644 > --- a/SecurityPkg/Tcg/TcgPei/TcgPei.inf > +++ b/SecurityPkg/Tcg/TcgPei/TcgPei.inf > @@ -4,7 +4,7 @@ > # This module will initialize TPM device, measure reported FVs and BIOS= version. >=20 > # This module may also lock TPM physical presence and > physicalPresenceLifetimeLock. >=20 > # >=20 > -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
>=20 > +# Copyright (c) 2006 - 2020, Intel Corporation. All rights reserved.
>=20 > # SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > # >=20 > ## >=20 > @@ -67,6 +67,7 @@ > gPeiTpmInitializedPpiGuid ##= SOMETIMES_PRODUCES >=20 > gPeiTpmInitializationDonePpiGuid ##= PRODUCES >=20 > gEfiEndOfPeiSignalPpiGuid ##= SOMETIMES_CONSUMES > ## NOTIFY >=20 > + gEdkiiTcgPpiGuid ##= PRODUCES >=20 >=20 >=20 > [Pcd] >=20 > gEfiSecurityPkgTokenSpaceGuid.PcdPhysicalPresenceLifetimeLock ## > SOMETIMES_CONSUMES >=20 > -- > 2.26.2.windows.1