public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] [INTEL][TOOLS][FITGEN] Modify Fitgen tool to support new ACM header
@ 2021-04-15  6:31 mohammad.m.miazi
  2021-04-20  9:31 ` [edk2-devel] " Bob Feng
  0 siblings, 1 reply; 2+ messages in thread
From: mohammad.m.miazi @ 2021-04-15  6:31 UTC (permalink / raw)
  To: devel; +Cc: Mohammad Miazi

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


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

* Re: [edk2-devel] [PATCH] [INTEL][TOOLS][FITGEN] Modify Fitgen tool to support new ACM header
  2021-04-15  6:31 [PATCH] [INTEL][TOOLS][FITGEN] Modify Fitgen tool to support new ACM header mohammad.m.miazi
@ 2021-04-20  9:31 ` Bob Feng
  0 siblings, 0 replies; 2+ messages in thread
From: Bob Feng @ 2021-04-20  9:31 UTC (permalink / raw)
  To: devel@edk2.groups.io, Miazi, Mohammad M

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


-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Mohammad Miazi
Sent: Thursday, April 15, 2021 2:31 PM
To: devel@edk2.groups.io
Cc: Miazi, Mohammad M <mohammad.m.miazi@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@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







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

end of thread, other threads:[~2021-04-20  9:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-04-15  6:31 [PATCH] [INTEL][TOOLS][FITGEN] Modify Fitgen tool to support new ACM header mohammad.m.miazi
2021-04-20  9:31 ` [edk2-devel] " Bob Feng

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