public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: mohammad.m.miazi@intel.com
To: devel@edk2.groups.io
Cc: Mohammad Miazi <mohammad.m.miazi@intel.com>
Subject: [PATCH] [INTEL][TOOLS][FITGEN] Modify Fitgen tool to support new ACM header
Date: Wed, 14 Apr 2021 23:31:29 -0700	[thread overview]
Message-ID: <20210415063129.38520-1-mohammad.m.miazi@intel.com> (raw)

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3332

Currently Fitgen tools verifies every detail of ACM header,
so any ACM header change breaks the tool.
As ACM header is verified by microcode and
ACM itself, Fitgen tool does not need to verify
every fieldof ACM header except some important
fields like ACM_TYPE/SUB_TYPE etc.The changes will
remove the dependency between  future ACM header changeand
FitGen tool.

Signed-off-by: Mohammad Miazi <mohammad.m.miazi@intel.com>
---
 Silicon/Intel/Tools/FitGen/FitGen.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/Silicon/Intel/Tools/FitGen/FitGen.c b/Silicon/Intel/Tools/FitGen/FitGen.c
index 36e6e3c905..290e688f6e 100644
--- a/Silicon/Intel/Tools/FitGen/FitGen.c
+++ b/Silicon/Intel/Tools/FitGen/FitGen.c
@@ -2,7 +2,7 @@
 This utility is part of build process for IA32/X64 FD.
 It generates FIT table.
 
-Copyright (c) 2010-2020, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2010-2021, Intel Corporation. All rights reserved.<BR>
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -48,6 +48,7 @@ typedef struct {
 #define ACM_PKCS_1_5_RSA_SIGNATURE_SHA384_SIZE          384
 
 #define ACM_HEADER_VERSION_3  (3 << 16)
+#define ACM_HEADER_VERSION_0  (0)
 #define ACM_MODULE_TYPE_CHIPSET_ACM                     2
 #define ACM_MODULE_SUBTYPE_CAPABLE_OF_EXECUTE_AT_RESET  0x1
 #define ACM_MODULE_SUBTYPE_ANC_MODULE                   0x2
@@ -2456,7 +2457,16 @@ Returns:
   DumpHex (Buffer, Acm->KeySize * 4);
   printf ("\n");
   Buffer += Acm->KeySize * 4;
-
+  //
+  // To simplify the tool and making it independent of ACM header change,
+  // the rest of ACM parsing  will be skipped starting ACM_HEADER_VERSION4
+  //
+  if((Acm->HeaderVersion != ACM_HEADER_VERSION_3) && (Acm->HeaderVersion != ACM_HEADER_VERSION_0)){
+     printf (
+        "*****************************************************************************\n\n"
+        );
+    return;
+  }
   if (Acm->HeaderVersion == ACM_HEADER_VERSION_3) {
     printf ("  RSASig                     - \n");
     DumpHex (Buffer, ACM_PKCS_1_5_RSA_SIGNATURE_SHA384_SIZE); // PKCS #1.5 RSA Signature
@@ -2580,6 +2590,14 @@ Returns:
     return FALSE;
   }
 
+  //
+  // To simplify the tool and making it independent of ACM header change,
+  // the following check will be skipped starting ACM_HEADER_VERSION3
+  //
+  if((Acm->HeaderVersion != ACM_HEADER_VERSION_3) && (Acm->HeaderVersion != ACM_HEADER_VERSION_0)){
+    printf ("ACM header Version 4 or higher, bypassing other checks!\n");
+    return TRUE;
+  }
   Buffer = (UINT8 *)(Acm + 1);
   Buffer += Acm->KeySize * 4;
   if (Acm->HeaderVersion == ACM_HEADER_VERSION_3) {
-- 
2.16.2.windows.1


             reply	other threads:[~2021-04-15  6:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-15  6:31 mohammad.m.miazi [this message]
2021-04-20  9:31 ` [edk2-devel] [PATCH] [INTEL][TOOLS][FITGEN] Modify Fitgen tool to support new ACM header 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=20210415063129.38520-1-mohammad.m.miazi@intel.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