From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mx.groups.io with SMTP id smtpd.web09.4330.1659067380882169941 for ; Thu, 28 Jul 2022 21:03:01 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=IXHcVwns; spf=pass (domain: intel.com, ip: 134.134.136.20, mailfrom: yuwei.chen@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1659067380; x=1690603380; h=from:to:cc:subject:date:message-id:references: in-reply-to:mime-version; bh=dR1tIKWkEb81NSnliF1DEDaZqbD3uGCw6LlHmEVWctc=; b=IXHcVwnsCeuo26zJCPKbm57ua8CK65UVHYrQJpoL+jj8/n5+Nm0oL71m uSPHtTl/9jRfvZtdVyUGaKJqAIyZt2CBkDFjl0p34VRkzcPGpXhDQNvq8 N5nZz3s6gGDY6skT/DFTZMKjinseoU0wZrhR0EBS/ahEzZw73VRsnvHeb X8bJXokPHZlzTbIwE7TxSAvsMx2op6y75wDh911trl9Vh8e6tlE00NpSy X7BF838KDrvPOdnHvU58EWZqV6gOXq9+5+qhQ/+nGz5KKqEL0saQFHQ1N maLzk3dt28ynRl1zF0yhdgoUAx4NUI3meosxFeURJX9FbFf6IWEg2zm6r Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10422"; a="275567868" X-IronPort-AV: E=Sophos;i="5.93,200,1654585200"; d="scan'208,217";a="275567868" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Jul 2022 21:02:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,200,1654585200"; d="scan'208,217";a="727614783" Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14]) by orsmga004.jf.intel.com with ESMTP; 28 Jul 2022 21:02:45 -0700 Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) by ORSMSX601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Thu, 28 Jul 2022 21:02:44 -0700 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX612.amr.corp.intel.com (10.22.229.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Thu, 28 Jul 2022 21:02:44 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx611.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28 via Frontend Transport; Thu, 28 Jul 2022 21:02:44 -0700 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.172) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2375.28; Thu, 28 Jul 2022 21:02:43 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=K0HUkQt37sDAHXV37NB5ABcGaz4wR1uK8fu2mpBNEJCS0Zv9rwqmiNNdCoezcBJva25STyehO8So1++xdU0rM8D5LVSgJ6G2A/Mesjocpk3zgw4qWJNVsLrOGHS2z8Rd8yGZ3Lg8pnE1zJvXf2u4Mwp6k+JXdyTS3F/UE7p43YwOYCp2IUGDpCVA4DI6Nj5VG1AMYoVSsscgjrzLCuXyKWLlDKXN0GVdpObAopgQHpoZtD1txrhYUtn217zuWXFkG9aLSiUQihHnU05v5ejbyQ/KxppSjtEaRdMTQ2f4PgZOzZ8SdkNnP8dx1jNgNTMoCGhe+wZHvTE2wIH8iU/24w== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Uwv+skj1PqnAS9Wommd76m357jgDnSarT5wF0B2JDI8=; b=oEDdY0h5FU/YagUdLZdi+dt2AaDjxWfbw9If7q/vStKFctuOMouV18CvZfgcVFExwcZxEGoBCmiHhKgVz91Od4gjAf5MSuOfDXCTJ4uFwzzeufRNAaSrfNqT+xHknOqraLwRBNxRpevJ38bOwrRlVWTbVm3+EutXt6hfJ/UPjm0tLoULeMO8INl46/hVLFmCU5kriPGa71ELNha3iUYVVuNra51PkWMdK8yArOeegx3UxNr1W/b6TwmSd1NYottbZzb2+aJMS6HrOk3XQ9q8nasURaJQ1cJpgzu5DkLJe7+bIyshSZueUiO54sazv2aTmiZC4156RiP16oH8MnP31Q== 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 Received: from MW5PR11MB5906.namprd11.prod.outlook.com (2603:10b6:303:1a0::21) by SA2PR11MB4956.namprd11.prod.outlook.com (2603:10b6:806:112::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5458.19; Fri, 29 Jul 2022 04:02:16 +0000 Received: from MW5PR11MB5906.namprd11.prod.outlook.com ([fe80::edd3:f6fc:4251:3b37]) by MW5PR11MB5906.namprd11.prod.outlook.com ([fe80::edd3:f6fc:4251:3b37%7]) with mapi id 15.20.5482.011; Fri, 29 Jul 2022 04:02:16 +0000 From: "Yuwei Chen" To: "devel@edk2.groups.io" , "aladyshev22@gmail.com" CC: "Feng, Bob C" , "Gao, Liming" Subject: Re: [edk2-devel] [PATCH] BaseTools/VolInfo: Correct buffer for GenCrc32 tool Thread-Topic: [edk2-devel] [PATCH] BaseTools/VolInfo: Correct buffer for GenCrc32 tool Thread-Index: AQHYm3W1ZvSUpkTD+k2cNMnl4Mm2s62Uw6hA Date: Fri, 29 Jul 2022 04:02:16 +0000 Message-ID: References: <20220719134435.8054-1-aladyshev22@gmail.com> In-Reply-To: <20220719134435.8054-1-aladyshev22@gmail.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-version: 11.5.1.3 dlp-reaction: no-action dlp-product: dlpe-windows authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: b30b8270-8267-4511-f25d-08da7117203a x-ms-traffictypediagnostic: SA2PR11MB4956:EE_ x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: nGpcts0V1lniFbse2qo9VpZb2DfdOmXOL1XcveQTatJ948OaQniAy5RDb3DIwB5vgme54/QvsLh8wHHqrPf6GqNnujELRlYnjKOa7mkSgdXTcWKhI/emubQzIjbfbALPcT2qcmHjf4W117FUvFEnGEYRYwqrXeayNkmUd84yFxRqTnAOsn8+d5LugOuZH6eaheEuLcNKxvvs+HFsc8xsKwg34sXhtN8sETmN6h9RYlMPKmyprXBCjlDHIJHjASTNRiAQVQMDGizjGLCOVE/woKL8SZpO1e6dN6h8geFgTVr3R/NwC2rya2JrgXOw7oN/oLXxu3eDmZzIHU11jwDQDOcdfrqguyTfFnu++GmFw8weQzeIg5tyoujxcL3r3SvaO53hxUvEfIkG6Z15nUpnuewW43r1cAT0hbZxLj76+IQb80iKyOiBXQpezhu3pz+H3z6aiah6x7d5lUYSIh8gC5iA8+HS/1V3b2NP/btJgdtTDAlHYnREpeYKU/f/2JZiqiZH7hPGavLXUiUtBW+RjImy0PoFplM5Kq2erGv1P9j2THVKjm943DpLJbghLZvc7GC+oKuBfk0o7EJKK0wibDm5ds2yN3COLjSCjncaChw+O7u4Yizaq0NH/AaCcA+9sYTIZHK/bPDo/d/tVNC2MZcZkul7eGAQWISmn0T5P6KBjP3Cm4waj2/K5Q7kOMTuTbvVWok8S+2rxQe7oU6gLLucRofkHaO9LZtuB2wmmFmH6RQmNJhqBdn6XRAfWkkndT798+xRCTWa7NXjUmLYegFmT2qzj1hjZ1tmva+queNR3SwuMKdkHMh+Q9iiW+5ZiuoXyk9zn7MyVu9GrtXY4eIN7HCSNOJ63l+fp92Ae8CBPpXt35wzGPPF40mPfFP4 x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MW5PR11MB5906.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(39860400002)(346002)(376002)(396003)(366004)(136003)(8936002)(166002)(54906003)(4326008)(316002)(5660300002)(110136005)(38100700002)(26005)(55016003)(6506007)(7696005)(76116006)(82960400001)(2906002)(478600001)(86362001)(66946007)(52536014)(71200400001)(41300700001)(53546011)(66446008)(966005)(66476007)(8676002)(122000001)(33656002)(38070700005)(83380400001)(186003)(64756008)(66556008)(9686003);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?G4yrFhfgcR2vQwrHGqtR/VlIq03lN7WD9Wx37ZZV66YI1hCM1QLzgiWpaR6G?= =?us-ascii?Q?+dItQrggOyhpkcpZAgCbbZ6WkY7P8rXlXX3DNcVK2zgCU37x37Ic32KyOGpM?= =?us-ascii?Q?67Vy4n6JzX/6gZfdVauS1fbqrqnTaZShdsHKgK1IZA0XH4ud6Praa5sVAqFe?= =?us-ascii?Q?MufV3FGSGVGMfhG6zSAuVGt4eE9xtK8rSQcTV9SugMx/3EPmUtoSG0EONce3?= =?us-ascii?Q?lK0I0m3iTxb2GzAPEqqJxtyrobAcpP0XXBItV5q1eiRKl52mOC0lzn96KA//?= =?us-ascii?Q?ZxdZbSbjEBW4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MyFC?= =?us-ascii?Q?1Ia6d9PX2RBm953Qh75PGeKLOCT1W8ppMACLwgOtnbVJ7Kn3vkTnxMuvjs3S?= =?us-ascii?Q?FDzBcdqSQvITnb0ihtUxXHilQztIYlrnglJCt9CnZanPRqwvmd8GWlMjWJiF?= =?us-ascii?Q?Xs51lDQjPInoOhZVhGDJalgr6jweFWks8vEc9BG5xwfWlJkYQMFue58Ze9pw?= =?us-ascii?Q?y0OqwM+AQdPlrABLN8i+rJCUbAhZMi4nLFriswfCbrU1on/bwVEztFw8TfH0?= =?us-ascii?Q?rF2Tqs/5DvNRolJ+g1j3bEE695/41EnqRiPV7NV3x945fXEKdqpkvETupBP/?= =?us-ascii?Q?poSyhrTm3vI148ylehXuPp0RgfZrZo5f+FAyT7gI0P12Fujv9k9S4Svw8kTL?= =?us-ascii?Q?TvioEs6tplwzXetBAMCWL70VTSsu69cWBtnsSt2p?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MW5PR11MB5906.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: b30b8270-8267-4511-f25d-08da7117203a X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Jul 2022 04:02:16.5110 (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: NwoP3AgrpVZqCvcK6she3+tXuVDVbdT68x+wXPOcIn9GjvluMBDgQIDurmsfLVdZ0ve6gSqtLJAo640GWNViZw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR11MB4956 Return-Path: yuwei.chen@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_MW5PR11MB5906D09EE36CC62260B7755F96999MW5PR11MB5906namp_" --_000_MW5PR11MB5906D09EE36CC62260B7755F96999MW5PR11MB5906namp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Konstantin, this is really an issue need to be solved. When GenSec tool uses the guidtools to encode the section, it differentiate= s how GenCrc32 is used from other tools.. GenSec defines a CRC32_SECTION_HEADER structure for GenCrc32, and calculate= the DataOffset of the Section with this header. However other guidtools just use the EFI_GUID_DEFINED_SECTION header and ca= lculate the DataOffset with it. " typedef struct { EFI_GUID_DEFINED_SECTION GuidSectionHeader; UINT32 CRC32Checksum; } CRC32_SECTION_HEADER; Crc32GuidSect->GuidSectionHeader.DataOffset =3D sizeof (CRC32_SECTION_HEAD= ER); " Personally think that is the root cause of the 4 bytes issue. I do not know why the GenCrc32 usage is different from other tools in origi= n design. Propose to solve this issue from GenSec side to keep all the guidtool with = same function. Thanks, Christine > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of > Konstantin Aladyshev > Sent: Tuesday, July 19, 2022 9:45 PM > To: devel@edk2.groups.io > Cc: Feng, Bob C ; Gao, Liming > ; Chen, Christine ; > Konstantin Aladyshev > Subject: [edk2-devel] [PATCH] BaseTools/VolInfo: Correct buffer for > GenCrc32 tool > > If the guided section was encoded with GenCrc32 tool the resulting > 'EFI_GUID_DEFINED_SECTION.DataOffset' field points to the start of the > meaningfull data that follows the CRC32 value. > But if we want to decode the section with GenCrc32 tool we need to provid= e > a buffer that includes the CRC32 value itself. > > Signed-off-by: Konstantin Aladyshev > > --- > BaseTools/Source/C/VolInfo/VolInfo.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/BaseTools/Source/C/VolInfo/VolInfo.c > b/BaseTools/Source/C/VolInfo/VolInfo.c > index f450796f9c..47a8f80f46 100644 > --- a/BaseTools/Source/C/VolInfo/VolInfo.c > +++ b/BaseTools/Source/C/VolInfo/VolInfo.c > @@ -1999,6 +1999,13 @@ Returns: > ); free (ExtractionTool); + if (!CompareGuid (+= EfiGuid,+ > &gEfiCrc32GuidedSectionExtractionProtocolGuid+ )+ = ) {+ > DataOffset -=3D 4;+ } Status =3D PutFileImage ( = ToolInputFile,-- > 2.25.1 > > > > -=3D-=3D-=3D-=3D-=3D-=3D > Groups.io Links: You receive all messages sent to this group. > View/Reply Online (#91530): https://edk2.groups.io/g/devel/message/91530 > Mute This Topic: https://groups.io/mt/92482555/4546272 > Group Owner: devel+owner@edk2.groups.io > Unsubscribe: https://edk2.groups.io/g/devel/unsub [yuwei.chen@intel.com] > -=3D-=3D-=3D-=3D-=3D-=3D > --_000_MW5PR11MB5906D09EE36CC62260B7755F96999MW5PR11MB5906namp_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Hi Konstantin, this is really an issue need to be= solved.

When GenSec tool uses the guidtools to encode the= section, it differentiates how GenCrc32 is used from other tools..

GenSec defines a CRC32_SECTION_HEADER stru= cture for GenCrc32, and calculate the DataOffset of the Section with this header.

However other guidtools just use the EFI_GUID_= DEFINED_SECTION header and calculate the DataOffset with it.=

 

typedef = struct {

  = EFI_GUID_DEFINED_SECTION  GuidSectionHeader;

  = UINT32                    = ;CRC32Checksum;

} = CRC32_SECTION_HEADER;

 

Crc32GuidS= ect->GuidSectionHeader.DataOffset  =3D sizeof (CRC32_SECTION_HEADER);

 

Personally think that is the root cause of the 4 = bytes issue.

 

I do not know why the GenCrc32 usage is different= from other tools in origin design.

Propose to solve this issue from GenSec side to k= eep all the guidtool with same function.

 

Thanks,

Christine

 

> -----Original Message-----

> From: devel@edk2.groups.io <devel@edk2.gr= oups.io> On Behalf Of

> Konstantin Aladyshev

> Sent: Tuesday, July 19, 2022 9:45 PM

> To: devel@edk2.groups.io

> Cc: Feng, Bob C <bob.c.feng@intel.com>= ; Gao, Liming

> <gaoliming@byosoft.com.cn>; Chen, Chri= stine <yuwei.chen@intel.com>;

> Konstantin Aladyshev <aladyshev22@gmail.c= om>

> Subject: [edk2-devel] [PATCH] BaseTools/VolI= nfo: Correct buffer for

> GenCrc32 tool

>

> If the guided section was encoded with GenCr= c32 tool the resulting

> 'EFI_GUID_DEFINED_SECTION.DataOffset' field = points to the start of the

> meaningfull data that follows the CRC32 valu= e.

> But if we want to decode the section with Ge= nCrc32 tool we need to provide

> a buffer that includes the CRC32 value itsel= f.

>

> Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>

> ---

>  BaseTools/Source/C/VolInfo/VolInfo.c |= 7 +++++++

>  1 file changed, 7 insertions(+)

>

> diff --git a/BaseTools/Source/C/VolInfo/VolI= nfo.c

> b/BaseTools/Source/C/VolInfo/VolInfo.c

> index f450796f9c..47a8f80f46 100644

> --- a/BaseTools/Source/C/VolInfo/VolInfo.c

> +++ b/BaseTools/Source/C/VolInfo/VolInfo.c

> @@ -1999,6 +1999,13 @@ Returns:

>        &n= bsp;   );         fr= ee (ExtractionTool); +        if (!Compa= reGuid (+           =     EfiGuid,+

> &gEfiCrc32GuidedSectionExtractionProtoco= lGuid+           &nb= sp;   )+         &nb= sp; ) {+

> DataOffset -=3D 4;+    &= nbsp;   }         Status = =3D           PutFileImag= e (            = ToolInputFile,--

> 2.25.1

>

>

>

> -=3D-=3D-=3D-=3D-=3D-=3D

> Groups.io Links: You receive all messages se= nt to this group.

> View/Reply Online (#91530): https://edk2.groups.i= o/g/devel/message/91530

> Mute This Topic: https://groups.io/mt/= 92482555/4546272

> Group Owner: devel+owner@edk2.grou= ps.io

> Unsubscribe: https://edk2.groups.i= o/g/devel/unsub [yuwei.chen@intel.com]

> -=3D-=3D-=3D-=3D-=3D-=3D

>

 

--_000_MW5PR11MB5906D09EE36CC62260B7755F96999MW5PR11MB5906namp_--