public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Konstantin Aladyshev" <aladyshev22@gmail.com>
To: devel@edk2.groups.io
Cc: bob.c.feng@intel.com, gaoliming@byosoft.com.cn,
	yuwei.chen@intel.com,
	Konstantin Aladyshev <aladyshev22@gmail.com>
Subject: [PATCH] BaseTools/VolInfo: Correct buffer for GenCrc32 tool
Date: Tue, 19 Jul 2022 16:44:35 +0300	[thread overview]
Message-ID: <20220719134435.8054-1-aladyshev22@gmail.com> (raw)

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


             reply	other threads:[~2022-07-19 13:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-19 13:44 Konstantin Aladyshev [this message]
2022-07-29  4:02 ` [edk2-devel] [PATCH] BaseTools/VolInfo: Correct buffer for GenCrc32 tool Yuwei Chen
2022-07-29  9:02   ` Konstantin Aladyshev
2022-10-01 14:28     ` Bob Feng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220719134435.8054-1-aladyshev22@gmail.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox