[edk2-devel] [PATCH] BaseTools/VolInfo: Correct buffer for GenCrc32 tool

Yuwei Chen yuwei.chen at intel.com
Fri Jul 29 04:02:16 UTC 2022


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 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 calculate the DataOffset with it.



"
typedef struct {
  EFI_GUID_DEFINED_SECTION  GuidSectionHeader;
  UINT32                    CRC32Checksum;
} CRC32_SECTION_HEADER;


Crc32GuidSect->GuidSectionHeader.DataOffset  = 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 keep all the guidtool with same function.



Thanks,

Christine



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

> From: devel at edk2.groups.io <devel at edk2.groups.io> On Behalf Of

> Konstantin Aladyshev

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

> To: devel at edk2.groups.io

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

> <gaoliming at byosoft.com.cn>; Chen, Christine <yuwei.chen at intel.com>;

> Konstantin Aladyshev <aladyshev22 at gmail.com>

> 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 provide

> a buffer that includes the CRC32 value itself.

>

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

> ---

>  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 -= 4;+        }         Status =           PutFileImage (             ToolInputFile,--

> 2.25.1

>

>

>

> -=-=-=-=-=-=

> 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 at edk2.groups.io<mailto:devel+owner at edk2.groups.io>

> Unsubscribe: https://edk2.groups.io/g/devel/unsub [yuwei.chen at intel.com]

> -=-=-=-=-=-=

>




-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#91960): https://edk2.groups.io/g/devel/message/91960
Mute This Topic: https://groups.io/mt/92482555/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/edk2-devel-archive/attachments/20220729/df86a354/attachment.htm>


More information about the edk2-devel-archive mailing list