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.335.1589405165363786354 for ; Wed, 13 May 2020 14:26:05 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=g4neWsUj; spf=pass (domain: intel.com, ip: 134.134.136.65, mailfrom: wei6.xu@intel.com) IronPort-SDR: QavyD8TcEkTACWVP0c6o1QoWJ6Onv5KgNkSiawfvGgH1ZRceq104J/ayd2+SSITSz481FvAzjm ED4gZeVUB8xg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2020 14:26:04 -0700 IronPort-SDR: c8+yCkdIiKY1MD0EyGR8wewGiu81LNzdlS/ha27gQujCeoyuv8EcL9R2Ee4ntky1SbUFqTgMKp /DkyyAa4fRkA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,389,1583222400"; d="scan'208";a="280635800" Received: from orsmsx105.amr.corp.intel.com ([10.22.225.132]) by orsmga002.jf.intel.com with ESMTP; 13 May 2020 14:26:04 -0700 Received: from orsmsx603.amr.corp.intel.com (10.22.229.16) by ORSMSX105.amr.corp.intel.com (10.22.225.132) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 13 May 2020 14:26:04 -0700 Received: from orsmsx608.amr.corp.intel.com (10.22.229.21) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Wed, 13 May 2020 14:26:03 -0700 Received: from ORSEDG001.ED.cps.intel.com (10.7.248.4) by orsmsx608.amr.corp.intel.com (10.22.229.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1713.5 via Frontend Transport; Wed, 13 May 2020 14:26:03 -0700 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.106) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 13 May 2020 14:26:03 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Phj6fFT1VNEpuPYgkbS79s5jAR8PGrVhbc+fc5ffVvZVybu4i0UdoJ1s67NEGJKIHLjdO5auFxy48CPWCoG46skgpaRb1FJPgvDEmDLefBnTo1kcLWmSV6FA+laFhW7bCCktm+uBtBFo5+79sHCvRKz70g3tMMbE8jmfyWqmlm6bfhUxyBC5YMH5zF273g0iaOfN/t7NSe9Kun/yZZ3T+h33Rwt5J+vwIxMSdK1uN5E6/Nd85gN+4wIvU57Xk/+Xjb3wviTnqRPJBVeAZ9ZDzopivchoIbNJgIUnqWd4+BP2AVQb2DguIwYAfuQm4bTOAQ9hr+OscR7nWQ0jviXsaw== 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=EdUJF7UbRJB3NMUi3GI1KKr0zLY+OUHVsUbqgqnkU1k=; b=M6lAs90u0VTwKsu71UxNVhPSyM95kheW0Uuloud39OPRzrM9bupJ3Ueg+AlrWwpf7Y9+Ul7VGXuvBm81MgUbtrz89C/N3SszfwnE0EaqtnbsrYOxP9W7Ei0kuVB0nvHtVqABmOFY+lcVM/+xrXMtLE5zbqQl4Tg4xNK3ebhG7/+/nLZW0X9IaCQHqn7fAInnSeu8slW0D8E8BatWqUiPuRyp5TZcRRDZIXsBFFLxjGLPZM0xFkoBqL1N6n9JhaAc28/kH1G5neM1QR5YzyOpDcFHwwzbuZMXsoW0hEu9c3H35G686EsM/iqFp+0tRKxlmk+ByqNCug62DsKnHgcjnQ== 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=EdUJF7UbRJB3NMUi3GI1KKr0zLY+OUHVsUbqgqnkU1k=; b=g4neWsUj+I7tr2dCxUT+WnrrPuFT7RfWFNsiY2asVuUjvxVAwqX3qw5121h8uGDL5LpPB4LZxAQqoHShhWzaCejAl6AnDNbDVlqhjGb9gRxNM4/xqnR1TagK6Ia7fZXpT1BjggUS2Eou4HxlJls2LOJQqlmguUylksZXsfoMqr8= Received: from DM6PR11MB2777.namprd11.prod.outlook.com (20.176.95.159) by DM6PR11MB4171.namprd11.prod.outlook.com (20.176.124.156) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.26; Wed, 13 May 2020 21:26:00 +0000 Received: from DM6PR11MB2777.namprd11.prod.outlook.com ([fe80::8129:bd89:65b7:d807]) by DM6PR11MB2777.namprd11.prod.outlook.com ([fe80::8129:bd89:65b7:d807%3]) with mapi id 15.20.2979.033; Wed, 13 May 2020 21:26:00 +0000 From: "Xu, Wei6" To: "devel@edk2.groups.io" , "oleksiyy@ami.com" CC: "Gao, Liming" , "Kinney, Michael D" , "Wang, Jian J" , "Wu, Hao A" , "Yao, Jiewen" , "Zhang, Chao B" , "Felixp@ami.com" Subject: Re: [edk2-devel] [PATCH V4 5/6] MdeModulePkg: Add FMP Capsule Image Header extension Thread-Topic: [edk2-devel] [PATCH V4 5/6] MdeModulePkg: Add FMP Capsule Image Header extension Thread-Index: AQHWKKmwmXoYxf6I9EOtzxAjtk5BFqimhmdA Date: Wed, 13 May 2020 21:26:00 +0000 Message-ID: References: <20200512220543.40008-1-oleksiyy@ami.com> <20200512220543.40008-6-oleksiyy@ami.com> In-Reply-To: <20200512220543.40008-6-oleksiyy@ami.com> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: 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.102.204.38] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: af03d4f7-92dc-4e46-aa9b-08d7f7843be7 x-ms-traffictypediagnostic: DM6PR11MB4171: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:5516; x-forefront-prvs: 0402872DA1 x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: BFcG3PxNpojbA5okBBxw4tM1PE6sToOomdAZIXiPELGuFqnVZHlrEPj7rn0JvxU8igWPFbo4C6ozG4iWJgzuO1ctr6mYgpLVbbbzdmykgsqU8lUk/f4O9B3GIeVebb+m84NWP0zwZfUlgPbcNLERZ1dP2AmGnZlaAEen7p02pcsXDrUUgO0HCoNWlVeR6v//Fx60k7CQfNkqidzgVB9s/XT+VO5m0/XRkdvt0WTBEnP6xdzoM/fBTFFY560GeHp1ADHhLz076cMowOQ9gwWLPvKpWElrI7Ov/sS/NcevaWe3kxBfrfbarCIks2ATCHM5furMOHhHHKH6lXpMRBSDldbulM7NMo5uvdbUa4T08wlHXKMbIUiPNzp+XP5fTW3I5kRPhp2PP3ik3ZkWt4iOvtjUy9qBTOvzFK/6wdJMwEdlOqpuay7xMLNg5cBZKTRrBc8zmX3qysscW8QjnVhfW7K/WsacfKQDT7hT5MmuZsY5l/bqt9TuEJ/rTh1wNGJLjJVZgzS3AznTHtfk34Xdl2473EG2tXIoO1G8E9N/lyzFsaoa4WpwiOyoJ4RVNgALMGtIc0EhRzytfMfgZ9U1y4HheBeTpXeKTQ+oea8++zA= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR11MB2777.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(346002)(366004)(376002)(39860400002)(136003)(396003)(33430700001)(64756008)(2906002)(54906003)(316002)(9686003)(478600001)(110136005)(55016002)(966005)(7696005)(6506007)(52536014)(66556008)(66476007)(76116006)(66946007)(8936002)(33656002)(66446008)(8676002)(33440700001)(4326008)(86362001)(71200400001)(186003)(26005)(5660300002);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: kDU/3wfBXZtEw5R+s8zracEXEw9MJ4RdbQM3f2m3JzbD9tYwjgGeEyXQEgdaDSCOjwJ0Y0my3TrvW+f3uPlgL+fYng+kkJFOE1VEaeM6OpT4oAUnocpowU9muZ1QnXWqcb0YeOBNC5/sdS9pT12cCcirLL+7ZstvwMklv+5BX9fMZmf80/SlxwRearI0sSYeFeZkCfkOMgxzM8i1Byu8ARomoGxScvJiqm9HXmOujde2AHvw3QUwJYssNnm8l/SfFGLz6ZuBTWbGTKoSwY8yG8GtYAlgmwcjDubA2gT0iEaFUjXgx3zwg/iCEpMg7yZ+gqcSX3uh5KEVUBqsuva+kpXwvmbaV9FvqSRMIbzIBQ64J2KK1GI1RB9deJoLO2j4vNi7O8nv7JO7l7Q1JNm1BpEIK+5jbn8flyj+bI3a27JwX+zLyukvfRgMjR/9BSqOwcxmy+eqjQVIsLo0LT1+FrXrIdNyMxt+TQURQSOa8unvnaWp0ybR0UL2afcImCtW MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: af03d4f7-92dc-4e46-aa9b-08d7f7843be7 X-MS-Exchange-CrossTenant-originalarrivaltime: 13 May 2020 21:26:00.7747 (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: I4BxFuZ2FDlhmKG+4nz7yKDTVJneu9aj3DoR2d1AN4JDC48wjM9ykwJVQg3wUMVnfQpAn2ou2sf6ZdD7iU/3KA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB4171 Return-Path: wei6.xu@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Thanks for helping update the related version check. Please see my comment below. With these two places updated, Reviewed-by: Wei6 Xu >-----Original Message----- >From: devel@edk2.groups.io On Behalf Of Oleksiy >Yakovlev >Sent: Wednesday, May 13, 2020 6:06 AM >To: devel@edk2.groups.io >Cc: Gao, Liming ; Kinney, Michael D >; Wang, Jian J ; Wu, H= ao >A ; Yao, Jiewen ; Zhang, Chao B >; Felixp@ami.com; oleksiyy@ami.com >Subject: [edk2-devel] [PATCH V4 5/6] MdeModulePkg: Add FMP Capsule Image >Header extension > >Add bitmask to structure which gives a binary-inspectable mechanism to >determine if a capsule contains an authentication section or depex sectio= n. >(UEFI 2.8 errata a, mantis 2026) > >Signed-off-by: Oleksiy Yakovlev >--- > MdeModulePkg/Application/CapsuleApp/CapsuleDump.c | 1 + > .../Library/DxeCapsuleLibFmp/DxeCapsuleLib.c | 20 >++++++++++++++++---- > 2 files changed, 17 insertions(+), 4 deletions(-) > >diff --git a/MdeModulePkg/Application/CapsuleApp/CapsuleDump.c >b/MdeModulePkg/Application/CapsuleApp/CapsuleDump.c >index 7e3e072..e3ab199 100644 >--- a/MdeModulePkg/Application/CapsuleApp/CapsuleDump.c >+++ b/MdeModulePkg/Application/CapsuleApp/CapsuleDump.c >@@ -98,6 +98,7 @@ DumpFmpCapsule ( > Print(L" UpdateVendorCodeSize - 0x%x\n", >FmpImageHeader->UpdateVendorCodeSize); > if (FmpImageHeader->Version >=3D >EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER_INIT_VERSION) { > Print(L" UpdateHardwareInstance - 0x%lx\n", >FmpImageHeader->UpdateHardwareInstance); >+ Print(L" ImageCapsuleSupport - 0x%lx\n", >+ FmpImageHeader->ImageCapsuleSupport); > } > } > } Wei: I think here the version check should be: if (ImageHeader->Version >=3D 1) { DEBUG((DEBUG_VERBOSE, " UpdateHardwareInstance - 0x%lx\n", Image= Header->UpdateHardwareInstance)); if (ImageHeader->Version >=3D EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE= _HEADER_INIT_VERSION) { DEBUG((DEBUG_VERBOSE, " ImageCapsuleSupport - 0x%lx\n", ImageH= eader->ImageCapsuleSupport)); } } >diff --git a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c >b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c >index 5dda561..f9819a7 100644 >--- a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c >+++ b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c >@@ -285,8 +285,10 @@ ValidateFmpCapsule ( > DEBUG((DEBUG_ERROR, "ImageHeader->Version(0x%x) Unknown\n", >ImageHeader->Version)); > return EFI_INVALID_PARAMETER; > } >- if (ImageHeader->Version < >EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER_INIT_VERSION) { >+ if (ImageHeader->Version =3D=3D 1) { > FmpImageHeaderSize =3D >OFFSET_OF(EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER, >UpdateHardwareInstance); >+ } else { >+ FmpImageHeaderSize =3D >+ OFFSET_OF(EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER, >+ ImageCapsuleSupport); > } > if (FmpImageSize < FmpImageHeaderSize) { > DEBUG((DEBUG_ERROR, "FmpImageSize(0x%lx) < >FmpImageHeaderSize(0x%x)\n", FmpImageSize, FmpImageHeaderSize)); @@ >-521,6 +523,7 @@ DumpFmpCapsule ( > DEBUG((DEBUG_VERBOSE, " UpdateVendorCodeSize - 0x%x\n", >ImageHeader->UpdateVendorCodeSize)); > if (ImageHeader->Version >=3D >EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER_INIT_VERSION) { > DEBUG((DEBUG_VERBOSE, " UpdateHardwareInstance - 0x%lx\n", >ImageHeader->UpdateHardwareInstance)); >+ DEBUG((DEBUG_VERBOSE, " ImageCapsuleSupport - 0x%lx\n", >ImageHeader->ImageCapsuleSupport)); > } > } > } Wei: I think here the version check should be: if (ImageHeader->Version >=3D 1) { DEBUG((DEBUG_INFO, "(UpdateHardwareInstance - 0x%x)", ImageHeader->Up= dateHardwareInstance)); if (ImageHeader->Version >=3D EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_H= EADER_INIT_VERSION) { DEBUG((DEBUG_INFO, "(ImageCapsuleSupport - 0x%x)", ImageHeader->Im= ageCapsuleSupport)); } } >@@ -928,9 +931,14 @@ SetFmpImageData ( > } else { > // > // If the EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER is >version 1, >- // Header should exclude UpdateHardwareInstance field >+ // Header should exclude UpdateHardwareInstance field, and >+ // ImageCapsuleSupport field if version is 2. > // >- Image =3D (UINT8 *)ImageHeader + >OFFSET_OF(EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER, >UpdateHardwareInstance); >+ if (ImageHeader->Version =3D=3D 1) { >+ Image =3D (UINT8 *)ImageHeader + >OFFSET_OF(EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER, >UpdateHardwareInstance); >+ } else { >+ Image =3D (UINT8 *)ImageHeader + >OFFSET_OF(EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER, >ImageCapsuleSupport); >+ } > } > > if (ImageHeader->UpdateVendorCodeSize =3D=3D 0) { @@ -945,6 +953,7 @@ >SetFmpImageData ( > DEBUG((DEBUG_INFO, "ImageIndex - 0x%x ", >ImageHeader->UpdateImageIndex)); > if (ImageHeader->Version >=3D >EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER_INIT_VERSION) { > DEBUG((DEBUG_INFO, "(UpdateHardwareInstance - 0x%x)", >ImageHeader->UpdateHardwareInstance)); >+ DEBUG((DEBUG_INFO, "(ImageCapsuleSupport - 0x%x)", >+ ImageHeader->ImageCapsuleSupport)); > } > DEBUG((DEBUG_INFO, "\n")); > >@@ -1239,7 +1248,10 @@ ProcessFmpCapsuleImage ( > ImageHeader =3D >(EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER *)((UINT8 >*)FmpCapsuleHeader + ItemOffsetList[Index]); > > UpdateHardwareInstance =3D 0; >- if (ImageHeader->Version >=3D >EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER_INIT_VERSION) { >+ /// >+ /// UpdateHardwareInstance field was added in Version 2 >+ /// >+ if (ImageHeader->Version >=3D 2) { > UpdateHardwareInstance =3D ImageHeader->UpdateHardwareInstance; > } > >-- >2.9.0.windows.1 > > >Please consider the environment before printing this email. > >The information contained in this message may be confidential and proprie= tary >to American Megatrends (AMI). This communication is intended to be read >only by the individual or entity to whom it is addressed or by their desi= gnee. If >the reader of this message is not the intended recipient, you are on noti= ce that >any distribution of this message, in any form, is strictly prohibited. P= lease >promptly notify the sender by reply e-mail or by telephone at 770-246-860= 0, and >then delete or destroy all copies of the transmission. > >