public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] BaseTools/VolInfo: Correct buffer for GenCrc32 tool
@ 2022-07-19 13:44 Konstantin Aladyshev
  2022-07-29  4:02 ` [edk2-devel] " Yuwei Chen
  0 siblings, 1 reply; 4+ messages in thread
From: Konstantin Aladyshev @ 2022-07-19 13:44 UTC (permalink / raw)
  To: devel; +Cc: bob.c.feng, gaoliming, yuwei.chen, Konstantin Aladyshev

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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-10-01 14:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-19 13:44 [PATCH] BaseTools/VolInfo: Correct buffer for GenCrc32 tool Konstantin Aladyshev
2022-07-29  4:02 ` [edk2-devel] " Yuwei Chen
2022-07-29  9:02   ` Konstantin Aladyshev
2022-10-01 14:28     ` Bob Feng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox