From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mx.groups.io with SMTP id smtpd.web12.15316.1595322988530369620 for ; Tue, 21 Jul 2020 02:16:28 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=wIwst4xN; spf=pass (domain: intel.com, ip: 192.55.52.88, mailfrom: jian.j.wang@intel.com) IronPort-SDR: M5WA63Jv67fbi2nvoboHotYMunQB0TvMHp7VcgmEQTVqS9XjP9fNj3oGt2l5jXjbyySMSAbfaB uC6gUwDRFVzQ== X-IronPort-AV: E=McAfee;i="6000,8403,9688"; a="168234184" X-IronPort-AV: E=Sophos;i="5.75,378,1589266800"; d="scan'208";a="168234184" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jul 2020 02:16:28 -0700 IronPort-SDR: Jcz1p+n+3HrDXhtzasjN0mq9240Weywx9kfSPyqbcAnIzKaS4IWmdeNFtV+JuWvCxVTFVw8f6y 2AkZMXjB2dJg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,378,1589266800"; d="scan'208";a="319839958" Received: from orsmsx105.amr.corp.intel.com ([10.22.225.132]) by fmsmga002.fm.intel.com with ESMTP; 21 Jul 2020 02:16:28 -0700 Received: from orsmsx607.amr.corp.intel.com (10.22.229.20) by ORSMSX105.amr.corp.intel.com (10.22.225.132) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 21 Jul 2020 02:16:27 -0700 Received: from orsmsx607.amr.corp.intel.com (10.22.229.20) by ORSMSX607.amr.corp.intel.com (10.22.229.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Tue, 21 Jul 2020 02:16:27 -0700 Received: from ORSEDG002.ED.cps.intel.com (10.7.248.5) by orsmsx607.amr.corp.intel.com (10.22.229.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1713.5 via Frontend Transport; Tue, 21 Jul 2020 02:16:27 -0700 Received: from NAM04-CO1-obe.outbound.protection.outlook.com (104.47.45.55) by edgegateway.intel.com (134.134.137.101) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 21 Jul 2020 02:16:24 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XtQ1mtvsVajqCnjLoxSAmByx62jiWkOwEu3bgvTKzhIXhzsZ0v3cmz03z3z2+RT4/bY1ZrrRyu/s17BaFSFU9PKSDQtzuOCjH6TXvhFhz2ZTtF+a8gdrSS/plLiVgtUDFR/CEyFxTOCuclnyJ33AJV/dBqeFucd5QkCijDy7il8ZQvUMWGfuarYUtrXy/r0Hekdwro21vl0i9SbjH1m1GiWjZF7d046rimalCwJIzLqCif471uz2BrySyErO0N2wBPWWVm6BymAJpNLawkGEp/9aAasGQ70Y0R4X/mHriDhyt1836uKBoHpJ33PHfIOKgYdLsOihlWqVZV3wfPEF0w== 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=/GVbHNxRHji2+oiW4Zrc0w05luyokefTWJ6kzjsfiDo=; b=VwaiLXtExwiis+KQGgDaELcKkdenduYq7JuzSLqq+x+GIJJ6FhyARYJiR5W6yyFp1Auvjt9EBIVUnm9HmUlwDhszJ33MY8X/3Jpw5tCkC2CUy9gNchIf2MniqYfZFCNj54+WlCDqRX+4LE7i5uZBcXOLYhYjUsaBqGnxaHlYl2AeQwSN4wP5WIr9D2rpNIUBL0ss2+ysxFjQyIqc+LrvMAnZ6DLBJtiJYed5mWrlxRwthXnc2EexK1gvAcHX0raGi23rDHxVjAOVFYIgXwR3IuuVnR1nhG9h6r43Pdk11NH0bGyBOXpXfG7CJIVaLmuQvdt9wUZJ6oXMQpmQpS13GA== 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=/GVbHNxRHji2+oiW4Zrc0w05luyokefTWJ6kzjsfiDo=; b=wIwst4xNJOSKgttJsSK55hL3BrU9vfaJRdaPHbWd0DIxP4ufEiyXrljRYWvhcai+GjdYuhTXnrRd5gfLSz/OmidVfj3RRd0NNaYPi7TiMldvVKos+X2kZm8H0st94A0LUfsBQwCJigmDosPoYB9isZ2F7LIO+k/J2v7BfFMH2l8= Received: from BYAPR11MB3303.namprd11.prod.outlook.com (2603:10b6:a03:18::15) by BYAPR11MB3560.namprd11.prod.outlook.com (2603:10b6:a03:f8::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3195.17; Tue, 21 Jul 2020 09:16:21 +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 09:16:21 +0000 From: "Wang, Jian J" To: "devel@edk2.groups.io" , "Wang, Jian J" , "Zhang, Qi1" CC: "Yao, Jiewen" Subject: Re: [edk2-devel] [PATCH v4 5/6] SecurityPkg/PeiTpmMeasurementLib: Add PEI instance. Thread-Topic: [edk2-devel] [PATCH v4 5/6] SecurityPkg/PeiTpmMeasurementLib: Add PEI instance. Thread-Index: AQHWXBdBcIc5dOrGwEy0t/J9jTF0yqkRwImAgAAGLUA= Date: Tue, 21 Jul 2020 09:16:21 +0000 Message-ID: References: <20200717084935.11067-1-qi1.zhang@intel.com> <20200717084935.11067-6-qi1.zhang@intel.com> <1623B8ED1BE72736.9882@groups.io> In-Reply-To: <1623B8ED1BE72736.9882@groups.io> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiODkwYTNiM2ItYjgyMS00NWYzLWE1M2UtODJhMDljMDA0ZTVhIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiSm5yMlVxNit2N3hpMUZNMUJWXC9XNVZrR1ZjR3RcL1MwNlJlR1lcL1FET2xoQVg1ZEZwazhwNlJqMXpxU3RyNlkyNyJ9 dlp-reaction: no-action dlp-version: 11.2.0.6 dlp-product: dlpe-windows x-ctpclassification: CTP_NT authentication-results: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; 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: 516d3ba3-2d52-46bd-33ac-08d82d56bbb6 x-ms-traffictypediagnostic: BYAPR11MB3560: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7219; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: ca/+ENaoVBG2cJ+IEUwvS85aTLGLoSmO0OSksmsbW5bpMsfgztT2Sd7k17vvjroKfyVAIpv8/mOGY8pFD9f9lXAYa7MDwtkpH5D8jzvQJuI9hzxJO1iU48q6gLbkkmCWs/xOkVkwjE9YefxSrqZxbJ+xXoe8t1wfk70Gpj4hDtCEI8pEReqHB5IUlI8kYIt122rgDEfnFX1YiEkkqyqFkLaEbX0SWUqb9NtcznefMnBDJnhmRvzIT9wLnYBIU6WuTt+mFNMb9v1mxmuCVryErQd+o+ZqbdLZgBbU02IToL+yYl6xpXxNBqXQSCwKI77RO9OorJdIE6muRxabsbs11V1UDfWpy/K+HNYDuI6uKJkt96y4kJW/r1w4wrP//7QKzc99uEqfKp2w3ksHpEh2EA== 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)(376002)(346002)(396003)(366004)(39860400002)(186003)(33656002)(966005)(26005)(4326008)(107886003)(83380400001)(5660300002)(2906002)(52536014)(6636002)(478600001)(110136005)(9686003)(8936002)(71200400001)(55016002)(7696005)(86362001)(53546011)(8676002)(316002)(76116006)(66946007)(6506007)(66556008)(66446008)(66476007)(64756008)(15650500001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: ab00AWB5iJe0qlTw21eiFUK5rPv7BPI0Nv/LvL4Y1KYXVf2SegudF7wIaggbZ2ploy7gZB9uLbezkA6/Fiae+ue7RlCOKSD6w/9EXX5L5u3LQNT5ywxFbhqB38uVAlRUOUpHDKqvo0HC9ajAldASZUWi8+WCHyf4CPl9Ohpgu7IZhkJmF0Yc09gJMK3l4l3my4QsiN295cYkjotJoE+wme6JFrUTdIcniJhAJTdNCOC97RGaHORehkD2Me+4/vS+eXeFTrkzRm7vAnTQpSzPtHmRAp7sgcJj0gDsbOmEaAcsWvpFVRQDZ+fA1HXKFx9a17qyt/h+t+VpvLJ+h1YTmGaQPpmooT92A1eirhtdiD7ALwIVb7pRueg/p+We6nUYWJlkWIpIK1Mf/Bp4YCOScXmGuELx+UDdvGpk9QILIsCNlatXsBLmpuyZaA3V0VVuphBUFkBguaS8yqjxRqqoSf2qpQOHJ3uOJ/cUfkxew4dEZf0zGNpN5AzUMLE7Axis 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: 516d3ba3-2d52-46bd-33ac-08d82d56bbb6 X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Jul 2020 09:16:21.0403 (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: M7e8ZYpHxN28ptzX2nQIs8cpoun/SrBi9qGLBMk6V7c2SMXk+G1nn/jA6jWRO0et+GidtAKdq6UIZiGI6jVVtQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB3560 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 Sorry, missing word in previous email. It should be "following requirement is not embodied in" Regards, Jian > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of Wang, Jia= n > J > Sent: Tuesday, July 21, 2020 5:00 PM > To: Zhang, Qi1 ; devel@edk2.groups.io > Cc: Yao, Jiewen > Subject: Re: [edk2-devel] [PATCH v4 5/6] SecurityPkg/PeiTpmMeasurementLi= b: > Add PEI instance. >=20 > Qi, >=20 > Two format issues inlined below. >=20 > In addition, according to bz2841, following requirement is embodied in > this patch. Maybe there's discussion before deciding not to implement > it. If so, please update bz2841 to state it explicitly. >=20 > 3) Add more API in TpmMeasurementLib, such as MeasureFirmwareBlob, > MeasureHandoffTable for TPM PFP rev 105 support - add description for > the FirmwareBlob and HandoffTable. >=20 > Regards, > Jian >=20 > > -----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 > > Subject: [PATCH v4 5/6] SecurityPkg/PeiTpmMeasurementLib: Add PEI inst= ance. > > > > From: Jiewen Yao > > > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2841 > > > > Cc: Jiewen Yao > > Cc: Jian J Wang > > Cc: Qi Zhang > > Signed-off-by: Jiewen Yao > > --- > > .../PeiTpmMeasurementLib.c | 74 ++++++++++++++++++= + > > .../PeiTpmMeasurementLib.inf | 50 +++++++++++++ > > .../PeiTpmMeasurementLib.uni | 17 +++++ > > 3 files changed, 141 insertions(+) > > create mode 100644 > > SecurityPkg/Library/PeiTpmMeasurementLib/PeiTpmMeasurementLib.c > > create mode 100644 > > SecurityPkg/Library/PeiTpmMeasurementLib/PeiTpmMeasurementLib.inf > > create mode 100644 > > SecurityPkg/Library/PeiTpmMeasurementLib/PeiTpmMeasurementLib.uni > > > > diff --git > > a/SecurityPkg/Library/PeiTpmMeasurementLib/PeiTpmMeasurementLib.c > > b/SecurityPkg/Library/PeiTpmMeasurementLib/PeiTpmMeasurementLib.c > > new file mode 100644 > > index 0000000000..1a590e0c9e > > --- /dev/null > > +++ b/SecurityPkg/Library/PeiTpmMeasurementLib/PeiTpmMeasurementLib.c > > @@ -0,0 +1,74 @@ > > +/** @file > > > > + This library is used by other modules to measure data to TPM. > > > > + > > > > +Copyright (c) 2020, Intel Corporation. All rights reserved.
> > > > +SPDX-License-Identifier: BSD-2-Clause-Patent > > > > + > > > > +**/ > > > > + > > > > +#include > > > > + > > > > +#include > > > > +#include > > > > +#include > > > > +#include > > > > +#include > > > > +#include > > > > + > > > > +#include > > > > +#include > > > > + > > > > +/** > > > > + Tpm measure and log data, and extend the measurement result into a > specific > > PCR. > > > > + > > > > + @param[in] PcrIndex PCR Index. > > > > + @param[in] EventType Event type. > > > > + @param[in] EventLog Measurement event log. > > > > + @param[in] LogLen Event log length in bytes. > > > > + @param[in] HashData The start of the data buffer to be has= hed, > > extended. > > > > + @param[in] HashDataLen The length, in bytes, of the buffer re= ferenced > by > > HashData > > > > + > > > > + @retval EFI_SUCCESS Operation completed successfully. >=20 > The description of above retval is not aligned with below line. >=20 > > > > + @retval EFI_UNSUPPORTED TPM device not available. > > > > + @retval EFI_OUT_OF_RESOURCES Out of memory. > > > > + @retval EFI_DEVICE_ERROR The operation was unsuccessful. > > > > +**/ > > > > +EFI_STATUS > > > > +EFIAPI > > > > +TpmMeasureAndLogData ( > > > > + IN UINT32 PcrIndex, > > > > + IN UINT32 EventType, > > > > + IN VOID *EventLog, > > > > + IN UINT32 LogLen, > > > > + IN VOID *HashData, > > > > + IN UINT64 HashDataLen > > > > + ) > > > > +{ > > > > + EFI_STATUS Status; > > > > + EDKII_TCG_PPI *TcgPpi; > > > > + TCG_PCR_EVENT_HDR TcgEventHdr; > > > > + > > > > + Status =3D PeiServicesLocatePpi( >=20 > Missing a space before '(' >=20 > > > > + &gEdkiiTcgPpiGuid, > > > > + 0, > > > > + NULL, > > > > + (VOID**)&TcgPpi > > > > + ); > > > > + if (EFI_ERROR(Status)) { > > > > + return Status; > > > > + } > > > > + > > > > + TcgEventHdr.PCRIndex =3D PcrIndex; > > > > + TcgEventHdr.EventType =3D EventType; > > > > + TcgEventHdr.EventSize =3D LogLen; > > > > + > > > > + Status =3D TcgPpi->HashLogExtendEvent ( > > > > + TcgPpi, > > > > + 0, > > > > + HashData, > > > > + (UINTN)HashDataLen, > > > > + &TcgEventHdr, > > > > + EventLog > > > > + ); > > > > + return Status; > > > > +} > > > > diff --git > > a/SecurityPkg/Library/PeiTpmMeasurementLib/PeiTpmMeasurementLib.inf > > b/SecurityPkg/Library/PeiTpmMeasurementLib/PeiTpmMeasurementLib.inf > > new file mode 100644 > > index 0000000000..6625d0fd01 > > --- /dev/null > > +++ > b/SecurityPkg/Library/PeiTpmMeasurementLib/PeiTpmMeasurementLib.inf > > @@ -0,0 +1,50 @@ > > +## @file > > > > +# Provides TPM measurement functions for TPM1.2 and TPM 2.0 > > > > +# > > > > +# This library provides TpmMeasureAndLogData() to measure and log da= ta, > > and > > > > +# extend the measurement result into a specific PCR. > > > > +# > > > > +# Copyright (c) 2020, Intel Corporation. All rights reserved.
> > > > +# SPDX-License-Identifier: BSD-2-Clause-Patent > > > > +# > > > > +## > > > > + > > > > +[Defines] > > > > + INF_VERSION =3D 0x00010005 > > > > + BASE_NAME =3D PeiTpmMeasurementLib > > > > + FILE_GUID =3D 9A62C49D-C45A-4322-9F3C-45958DF0= 056B > > > > + MODULE_TYPE =3D PEIM > > > > + VERSION_STRING =3D 1.0 > > > > + LIBRARY_CLASS =3D TpmMeasurementLib|PEIM > > > > + MODULE_UNI_FILE =3D PeiTpmMeasurementLib.uni > > > > + > > > > +# > > > > +# The following information is for reference only and not required by= the > build > > tools. > > > > +# > > > > +# VALID_ARCHITECTURES =3D IA32 X64 > > > > +# > > > > + > > > > +[Sources] > > > > + PeiTpmMeasurementLib.c > > > > + > > > > +[Packages] > > > > + MdePkg/MdePkg.dec > > > > + MdeModulePkg/MdeModulePkg.dec > > > > + SecurityPkg/SecurityPkg.dec > > > > + > > > > +[LibraryClasses] > > > > + BaseLib > > > > + BaseMemoryLib > > > > + HobLib > > > > + DebugLib > > > > + PcdLib > > > > + PrintLib > > > > + PeiServicesLib > > > > + PeiServicesTablePointerLib > > > > + > > > > +[Ppis] > > > > + gEdkiiTcgPpiGuid = ## CONSUMES > > > > + > > > > +[Depex] > > > > + gEfiPeiMasterBootModePpiGuid AND > > > > + gEfiTpmDeviceSelectedGuid > > > > diff --git > > a/SecurityPkg/Library/PeiTpmMeasurementLib/PeiTpmMeasurementLib.uni > > b/SecurityPkg/Library/PeiTpmMeasurementLib/PeiTpmMeasurementLib.uni > > new file mode 100644 > > index 0000000000..7b4341b449 > > --- /dev/null > > +++ > b/SecurityPkg/Library/PeiTpmMeasurementLib/PeiTpmMeasurementLib.uni > > @@ -0,0 +1,17 @@ > > +// /** @file > > > > +// Provides TPM measurement functions for TPM1.2 and TPM 2.0 > > > > +// > > > > +// This library provides TpmMeasureAndLogData() to to measure and log= data, > > and > > > > +// extend the measurement result into a specific PCR. > > > > +// > > > > +// Copyright (c) 2020, Intel Corporation. All rights reserved.
> > > > +// > > > > +// SPDX-License-Identifier: BSD-2-Clause-Patent > > > > +// > > > > +// **/ > > > > + > > > > + > > > > +#string STR_MODULE_ABSTRACT #language en-US "Provides TPM > > measurement functions for TPM1.2 and TPM 2.0" > > > > + > > > > +#string STR_MODULE_DESCRIPTION #language en-US "This library > > provides TpmMeasureAndLogData() to to measure and log data, and extend > the > > measurement result into a specific PCR." > > > > + > > > > -- > > 2.26.2.windows.1 >=20 >=20 >=20