[edk2-devel] [PATCH] [INTEL][TOOLS][FITGEN] Modify Fitgen tool to support new ACM header

Bob Feng bob.c.feng at intel.com
Tue Apr 20 09:31:59 UTC 2021


Reviewed-by: Bob Feng <bob.c.feng at intel.com>


-----Original Message-----
From: devel at edk2.groups.io <devel at edk2.groups.io> On Behalf Of Mohammad Miazi
Sent: Thursday, April 15, 2021 2:31 PM
To: devel at edk2.groups.io
Cc: Miazi, Mohammad M <mohammad.m.miazi at intel.com>
Subject: [edk2-devel] [PATCH] [INTEL][TOOLS][FITGEN] Modify Fitgen tool to support new ACM header

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








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






More information about the edk2-devel-archive mailing list