回复: [PATCH 2/6] BaseTools/VolInfo: Correct buffer for GenCrc32 tool


gaoliming
 

Konstantin:
I agree this change. CRC32 guid section doesn't set
EFI_GUIDED_SECTION_PROCESSING_REQUIRED.
It places CRC32 checksum in its guided header. When its data is verified,
its checksum and data will be required together.

Reviewed-by: Liming Gao <gaoliming@...>

Thanks
Liming

-----邮件原件-----
发件人: Konstantin Aladyshev <aladyshev22@...>
发送时间: 2022年8月30日 18:15
收件人: devel@edk2.groups.io
抄送: bob.c.feng@...; gaoliming@...;
yuwei.chen@...; Konstantin Aladyshev <aladyshev22@...>
主题: [PATCH 2/6] 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@...>
---
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 b5760d185e..4628e756d7 100644
--- a/BaseTools/Source/C/VolInfo/VolInfo.c
+++ b/BaseTools/Source/C/VolInfo/VolInfo.c
@@ -2009,6 +2009,13 @@ Returns:
);

free (ExtractionTool);



+ if (!CompareGuid (

+ EfiGuid,

+ &gEfiCrc32GuidedSectionExtractionProtocolGuid

+ )

+ ) {

+ DataOffset -= 4;

+ }

Status =

PutFileImage (

ToolInputFile,

--
2.25.1

Join devel@edk2.groups.io to automatically receive all group messages.