From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mx.groups.io with SMTP id smtpd.web12.3419.1618468294795410865 for ; Wed, 14 Apr 2021 23:31:35 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.31, mailfrom: mohammad.m.miazi@intel.com) IronPort-SDR: usrRXJfZ5hnNd817I6esQ2MFxLHoCePb1EpU6AE4xa4jn8hQtoDC0R4HJKCzhGslTLgB8fgpWh +OO8qVCIQzTw== X-IronPort-AV: E=McAfee;i="6200,9189,9954"; a="256114308" X-IronPort-AV: E=Sophos;i="5.82,223,1613462400"; d="scan'208";a="256114308" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Apr 2021 23:31:33 -0700 IronPort-SDR: ssbqkdVokXOndKVpsuF2haMetX1Tv4Xjmd6ulbZA5dWnKA4hvLW/lt5jhoTVT3D2BtgbDsCHon +KIrDHiITUCA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,223,1613462400"; d="scan'208";a="399467855" Received: from fm73lab132.amr.corp.intel.com ([10.121.84.146]) by orsmga002.jf.intel.com with ESMTP; 14 Apr 2021 23:31:33 -0700 From: mohammad.m.miazi@intel.com To: devel@edk2.groups.io Cc: Mohammad Miazi Subject: [PATCH] [INTEL][TOOLS][FITGEN] Modify Fitgen tool to support new ACM header Date: Wed, 14 Apr 2021 23:31:29 -0700 Message-Id: <20210415063129.38520-1-mohammad.m.miazi@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 --- 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.
+Copyright (c) 2010-2021, Intel Corporation. All rights reserved.
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