From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mx.groups.io with SMTP id smtpd.web10.5218.1597105187048961898 for ; Mon, 10 Aug 2020 17:19:47 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=RFLPsC8u; spf=pass (domain: intel.com, ip: 192.55.52.43, mailfrom: liming.gao@intel.com) IronPort-SDR: o/FKD6uig6N/1jx9kHUCNFytHO6mp3BEupacxoxm76uVj1pbxBkgdKNFKZy+jgMTbz38OxrZIr /AOUrFaVhtjg== X-IronPort-AV: E=McAfee;i="6000,8403,9709"; a="238471521" X-IronPort-AV: E=Sophos;i="5.75,458,1589266800"; d="scan'208";a="238471521" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Aug 2020 17:19:44 -0700 IronPort-SDR: XVajm0TiHzI/+dv5OIktXWFQIKdqnChPXh5A44NgrUi+2YXB6Z2EA/IfDcAnSJo34RmoBaxeIO dIHPCx+rCnBQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,458,1589266800"; d="scan'208";a="438869281" Received: from fmsmsx601-2.cps.intel.com (HELO fmsmsx601.amr.corp.intel.com) ([10.18.84.211]) by orsmga004.jf.intel.com with ESMTP; 10 Aug 2020 17:19:44 -0700 Received: from fmsmsx607.amr.corp.intel.com (10.18.126.87) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Mon, 10 Aug 2020 17:19:16 -0700 Received: from FMSEDG001.ED.cps.intel.com (10.1.192.133) by fmsmsx607.amr.corp.intel.com (10.18.126.87) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1713.5 via Frontend Transport; Mon, 10 Aug 2020 17:19:16 -0700 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.172) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 10 Aug 2020 17:19:06 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IpP+Ij5FbD3DZ9W+a/GeTGpHJ01s0J125qZmzIWfgNExfIDJtLLz5ESlOhTeukJhXrGNJPFHFY4HTnfYBy4HMTcHVJxwjgNkE4e8oO/PNdRMaDIAwiJfDlrE7ycyGhAibsodSwtUVS9JTesRE6NLMbPqtLogESh0xTLVPpqeY3lgOQEPlAWv9oGRChqGcOV8PayxjTs35RRPSBbOJcbbTFcCqpfqRKgOj01GJidKq9Zbcm7uGIwDIb0ian0wLSogXfor2KUq5ZhsPXPMwbusgWLBjzx3NUSDMO8tjHgBYKR23dcVMBu04cKxAu1SK4GyeSDT2C+Z59kFMvS/3cdhPQ== 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=r76UOZ2Si8O1yC/aDpJrB3DMbqhQKjRNa7BuyTfxLSw=; b=BByW06oWcWp+0P41e6L1muTAORUEyXPRCKnvRSp9i/Hd65GIP/IVc/2JbZuYI620uFgAi1LduanlZRErV1LwqdGSyWogOkwawl54+6zMtvhnLcCakhDMl5/opJz52cjFGiAiy/rLC0WCi+zZaBp4Xb6cZJ4ky2f8fhhdpCR1Tp+YF2kdjg70Oek0fET1a3o1bzEoz5gCd+fwJnLVM+aoDmsN6gzFspzHl2WYHC2x7PCJKN0LFhEpLDPYyAVIpRa9xv3gKExwhKuuVVQS97eYSx1WHo/wRC8b0sT/wQHp+LdcGP0fb4GqDNh1HrlJsXjY6GS7fYNxhHMW0z5QBTyYUg== 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=r76UOZ2Si8O1yC/aDpJrB3DMbqhQKjRNa7BuyTfxLSw=; b=RFLPsC8ubKjyKWHrjXWSA9S9TnD1kRBpdS1y9Ri2aa8Ln36pbJudTTTTlLmXnfKnMbwlK9LVhZY0xWhNNnNoaK5TrQMH+/fWkL5JlV35F1cEMiqAjVyFAA1l5jll2ogf/+CTVrWxfBdJgdQABT+dTNVtsyFEahvenBIwZDS4CWg= Received: from CY4PR11MB1526.namprd11.prod.outlook.com (2603:10b6:910:7::10) by CY4PR11MB1831.namprd11.prod.outlook.com (2603:10b6:903:11d::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.15; Tue, 11 Aug 2020 00:19:04 +0000 Received: from CY4PR11MB1526.namprd11.prod.outlook.com ([fe80::f8c4:711:84e3:4c97]) by CY4PR11MB1526.namprd11.prod.outlook.com ([fe80::f8c4:711:84e3:4c97%4]) with mapi id 15.20.3261.024; Tue, 11 Aug 2020 00:19:04 +0000 From: "Liming Gao" To: "devel@edk2.groups.io" , "Zhang, Qi1" CC: "Yao, Jiewen" , "Wang, Jian J" , "Kumar, Rahul1" Subject: Re: [edk2-devel] [PATCH v2 9/9] SecurityPkg/Tcg2: handle PRE HASH and LOG ONLY Thread-Topic: [edk2-devel] [PATCH v2 9/9] SecurityPkg/Tcg2: handle PRE HASH and LOG ONLY Thread-Index: AQHWa4lgEjQ11Vb/NEmTTsinXQ9dkakyEstg Date: Tue, 11 Aug 2020 00:19:04 +0000 Message-ID: References: <20200806003342.17866-1-qi1.zhang@intel.com> <20200806003342.17866-10-qi1.zhang@intel.com> In-Reply-To: <20200806003342.17866-10-qi1.zhang@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-version: 11.5.1.3 dlp-product: dlpe-windows dlp-reaction: no-action 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: 12417118-1387-4946-8057-08d83d8c27f9 x-ms-traffictypediagnostic: CY4PR11MB1831: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8273; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: /AOlzEYzBgvhui6WM6g9DHXcdYydqfSoVBMp7dc+VDOWqrXnNNXOw8t8PdsJL6CjeRlmqSS4UlJl1+AUY43mdDy4u6nHcWhPqjwHSxzKDrxablhyYYX5441j0foh5RBm+F1xBiXcRkh8lF8TRQc/coVs9V8m78wLfPzIye77hpNyNb3uL+iTIRcxMtk3mgvTs6WcdgtSEH3xTK1yM06m1S5Zr/Kq988FuSyFJiG+UlyOtU2X9ivjmC0dUUKpOOYVXyL40FuISK1XDTaxXB+5YEn09XwTBKOEgKNqOoUyAufqlqywp0pE743Tqrsgbz1sOlFAWtTolYfwznR3/HjlLc28SAIew5M9MyvYsLidpIU2+P8DgX7uA8APVpc+8RCanN5pS1PEu8O3Ss7nPaMLcw== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY4PR11MB1526.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(4636009)(39860400002)(346002)(366004)(136003)(396003)(376002)(55016002)(54906003)(6636002)(4326008)(110136005)(66446008)(316002)(52536014)(478600001)(7696005)(86362001)(2906002)(6506007)(53546011)(8676002)(5660300002)(9686003)(19627235002)(64756008)(186003)(8936002)(33656002)(76116006)(15650500001)(26005)(107886003)(83380400001)(966005)(66946007)(66556008)(66476007)(71200400001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: fMLTjYMzbiMkQqRJSVqcqAIghmdiFB1sGW5sK5Uy3oWaOXJZEmUtl3Sb0zUSkjvDbGEmuBnkbF6fDENMTU29kdOH18LkPJgcjOetYM8OH4d2Edw6TVfoVjdCCg2ZtK/d5CaAYDx5cf3CvFaAtqw5pgpNK4XMK6ZjXZtPf6UelGZmjwUsoXtwO1XDWjeQYcEmttrdgBNp/FDgNLlHBriTvM63bNL4eYDL2xOyDfYS3ym4CY3xfEQh+KxUTQBYSE6br2Xc1hTSVy3Yz06zN6gu3D7e+kaheuJuI1Ccg88KNbQ5pSt8DWufHD6hXYBCBKHL0NjQxm1gSL7iOD0DvPb8M4YU6LbFrf/7yPo6YAF5IBnmVFnY768czPIA9w9Dwed/cpZgzECcMgaIGiyipxetU1ZNpW7n1ERp4wzScDlI7sfNPrBgsPUoxb77OIlYTciRWDamF9hMmOtMW75sxWXOxBUTXwykKcmaoAXJhestpQ/QLXBtgYHq9agAMS/0lNzrZmQhxueEmGupSbXg4i/VI6GUOstog1TaimmSclwZFOkS3X7f47ijlh0jZy2qEWvl90WOPHLW/ngu75Tlw5TZ2wa0h4vqH8QYhfUhp2TAuj/PgFuv8ctD/FGTH+Ww2Koxrl1b95x8mQ4yfzUn4ANltA== MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CY4PR11MB1526.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 12417118-1387-4946-8057-08d83d8c27f9 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Aug 2020 00:19:04.7064 (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: B1k55rE7o+8nY+E0lKP2/mVuqxvpXWknUxkE9rYJA5nVM54Qkv8brLhpwxtUGWs6N3hbuGxFWyBBn1iAmXdUtg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR11MB1831 Return-Path: liming.gao@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="iso-2022-jp" Content-Transfer-Encoding: quoted-printable Qi: I run ECC plugin (https://edk2.groups.io/g/devel/message/63271) for this = patch set. It reports below issues. Can you help update the patches to fix = them? EFI coding style error *Error code: 3002 *Non-Boolean comparisons should use a compare operator (=3D=3D, !=3D, >, = < >=3D, <=3D) *file: D:\AllPkg\edk2\SecurityPkg\Tcg\Tcg2Pei\Tcg2Pei.c *Line number: 456 *Predicate Expression: (Flags & EDKII_TCG_PRE_HASH=20 EFI coding style error *Error code: 3002 *Non-Boolean comparisons should use a compare operator (=3D=3D, !=3D, >, = < >=3D, <=3D) *file: D:\AllPkg\edk2\SecurityPkg\Tcg\Tcg2Pei\Tcg2Pei.c *Line number: 456 *Predicate Expression: Flags & EDKII_TCG_PRE_HASH_LOG_ONLY=20 EFI coding style error *Error code: 3002 *Non-Boolean comparisons should use a compare operator (=3D=3D, !=3D, >, = < >=3D, <=3D) *file: D:\AllPkg\edk2\SecurityPkg\Tcg\Tcg2Pei\Tcg2Pei.c *Line number: 459 *Predicate Expression: Flags & EDKII_TCG_PRE_HASH=20 EFI coding style error *Error code: 4002 *Function header doesn't exist *file: D:\AllPkg\edk2\IntelFsp2WrapperPkg\Library\BaseFspMeasurementLib\F= spMeasurementLib.c *Line number: 279 *Function [mFspFindFspHeader] has NO comment immediately preceding it.=20 EFI coding style error *Error code: 8005 *Variable name does not follow the rules: 1. First character should be up= per case 2. Must contain lower case characters 3. No white space characters= 4. Global variable name must start with a 'g' *file: D:\AllPkg\edk2\IntelFsp2WrapperPkg\Library\BaseFspMeasurementLib\F= spMeasurementLib.c *Line number: 178 *The variable name [*UPDEventLo] does not follow the rules EFI coding style error *Error code: 8006 *Function name does not follow the rules: 1. First character should be up= per case 2. Must contain lower case characters 3. No white space characters *file: D:\AllPkg\edk2\IntelFsp2WrapperPkg\Library\BaseFspMeasurementLib\F= spMeasurementLib.c *Line number: 279 *The function name [mFspFindFspHeader] does not follow the rules EFI coding style error *Error code: 9002 *The function headers should follow Doxygen special documentation blocks = in section 2.3.5 *file: D:\AllPkg\edk2\IntelFsp2WrapperPkg\Library\BaseFspMeasurementLib\F= spMeasurementLib.c *Line number: 149 *Comment does NOT have tail **/=20 EFI coding style error *Error code: 9002 *The function headers should follow Doxygen special documentation blocks = in section 2.3.5 *file: D:\AllPkg\edk2\IntelFsp2WrapperPkg\Library\BaseFspMeasurementLib\F= spMeasurementLib.c *Line number: 312 *Comment does NOT have tail **/=20 EFI coding style error *Error code: 9002 *The function headers should follow Doxygen special documentation blocks = in section 2.3.5 *file: D:\AllPkg\edk2\SecurityPkg\Library\PeiTpmMeasurementLib\EventLogRe= cord.c *Line number: 86 *Comment does NOT have tail **/=20 EFI coding style error *Error code: 9002 *The function headers should follow Doxygen special documentation blocks = in section 2.3.5 *file: D:\AllPkg\edk2\SecurityPkg\Library\PeiTpmMeasurementLib\EventLogRe= cord.c *Line number: 155 *Comment does NOT have tail **/=20 EFI coding style error *Error code: 9002 *The function headers should follow Doxygen special documentation blocks = in section 2.3.5 *file: D:\AllPkg\edk2\SecurityPkg\Library\DxeTpmMeasurementLib\EventLogRe= cord.c *Line number: 86 *Comment does NOT have tail **/=20 EFI coding style error *Error code: 9002 *The function headers should follow Doxygen special documentation blocks = in section 2.3.5 *file: D:\AllPkg\edk2\SecurityPkg\Library\DxeTpmMeasurementLib\EventLogRe= cord.c *Line number: 155 *Comment does NOT have tail **/=20 EFI coding style error *Error code: 9002 *The function headers should follow Doxygen special documentation blocks = in section 2.3.5 *file: D:\AllPkg\edk2\MdeModulePkg\Library\TpmMeasurementLibNull\TpmMeasu= rementLibNull.c *Line number: 43 *Comment does NOT have tail **/=20 EFI coding style error *Error code: 9002 *The function headers should follow Doxygen special documentation blocks = in section 2.3.5 *file: D:\AllPkg\edk2\MdeModulePkg\Library\TpmMeasurementLibNull\TpmMeasu= rementLibNull.c *Line number: 43 *in Comment, <@param[in] Descrption> does NOT consistent with parameter n= ame PcrIndex=20 EFI coding style error *Error code: 9002 *The function headers should follow Doxygen special documentation blocks = in section 2.3.5 *file: D:\AllPkg\edk2\MdeModulePkg\Library\TpmMeasurementLibNull\TpmMeasu= rementLibNull.c *Line number: 43 *in Comment, <@param[in] FirmwareBlobBase> does NOT consistent with param= eter name Description=20 EFI coding style error *Error code: 9002 *The function headers should follow Doxygen special documentation blocks = in section 2.3.5 *file: D:\AllPkg\edk2\MdeModulePkg\Library\TpmMeasurementLibNull\TpmMeasu= rementLibNull.c *Line number: 43 *in Comment, <@param[in] FirmwareBlobLength> does NOT consistent with par= ameter name FirmwareBlobBase=20 EFI coding style error *Error code: 9002 *The function headers should follow Doxygen special documentation blocks = in section 2.3.5 *file: D:\AllPkg\edk2\MdeModulePkg\Library\TpmMeasurementLibNull\TpmMeasu= rementLibNull.c *Line number: 43 *in Comment, <@retval EFI_SUCCESS> does NOT consistent with parameter nam= e FirmwareBlobLength=20 EFI coding style error *Error code: 9002 *The function headers should follow Doxygen special documentation blocks = in section 2.3.5 *file: D:\AllPkg\edk2\MdeModulePkg\Library\TpmMeasurementLibNull\TpmMeasu= rementLibNull.c *Line number: 70 *Comment does NOT have tail **/ Thanks Liming -----Original Message----- From: devel@edk2.groups.io On Behalf Of Qi Zhang Sent: 2020=1B$BG/=1B(B8=1B$B7n=1B(B6=1B$BF|=1B(B 8:34 To: devel@edk2.groups.io Cc: Zhang, Qi1 ; Yao, Jiewen ; W= ang, Jian J ; Kumar, Rahul1 Subject: [edk2-devel] [PATCH v2 9/9] SecurityPkg/Tcg2: handle PRE HASH and = LOG ONLY 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; // #define EDKII_TCG_PRE_HASH 0x0000000000000001 +//+// This bit is shall= be set when HashData is the pre-hash digest and log only.+//+#define EDKII= _TCG_PRE_HASH_LOG_ONLY 0x0000000000000002+ /** Tpm measure and log data,= and extend the measurement result into a specific PCR. diff --git a/Securi= tyPkg/Tcg/Tcg2Pei/Tcg2Pei.c b/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c index 246968bb7f..b56b03746c 100644 --- a/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c +++ b/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c @@ -453,13 +453,15 @@ HashLogExtendEvent ( return EFI_DEVICE_ERROR; } - if(Flags & EDKII_TCG_PRE_HASH) {+ if = ((Flags & EDKII_TCG_PRE_HASH) || (Flags & EDKII_TCG_PRE_HASH_LOG_ONLY)) { = ZeroMem (&DigestList, sizeof(DigestList)); CopyMem (&DigestList, Has= hData, sizeof(DigestList));- Status =3D Tpm2PcrExtend (- 0,-= &DigestList- );+ if (Flags & EDKII_TCG_PRE_HASH= ) {+ Status =3D Tpm2PcrExtend (+ NewEventHdr->PCRIndex,+= &DigestList+ );+ } } else { Status = =3D HashAndExtend ( NewEventHdr->PCRIndex,--=20 2.26.2.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D Groups.io Links: You receive all messages sent to this group. View/Reply Online (#63760): https://edk2.groups.io/g/devel/message/63760 Mute This Topic: https://groups.io/mt/76019593/1759384 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [liming.gao@intel.com] -= =3D-=3D-=3D-=3D-=3D-=3D