From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web11.10152.1667228303269180042 for ; Mon, 31 Oct 2022 07:58:23 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=eggK0WqJ; spf=pass (domain: intel.com, ip: 192.55.52.115, mailfrom: pavamana.hv@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667228303; x=1698764303; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=nn6NCB3aqr59HF8B7e3mH12vxo/Ed545Ehs7iOO9P64=; b=eggK0WqJhGW/hGGuXCLYQCpQBJehzEDDzdkzSFiATWAMot1cOEMn2ipK 65f+bhEp6nz0QJy9LXlNLQmYRwG2AnaYGVFsNC3kGsnNe/YSKZCo6EY4z IawTvzeWZSgkT3ZvZoHFH3WD9nNoWIaueOx0U13pthM3Hxk5GWcYkZ5M+ pCBwX/gNV2UHcT65DV2PBbRJi08g6//DqQjH54FvjA7jRpAzAh9JuFapJ h6l4dpnXyWzr3/y6UlqRigmlNIryAYAe+gxj9eWL23Dd3RZiARvEBUc+w HYQHbaQ7Dipum/NezVnTBtE2IZGgpW9v21SJk3OM8HnWJ20jOGBsdDzK2 Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10517"; a="308914741" X-IronPort-AV: E=Sophos;i="5.95,228,1661842800"; d="scan'208";a="308914741" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Oct 2022 07:58:22 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10517"; a="962803837" X-IronPort-AV: E=Sophos;i="5.95,228,1661842800"; d="scan'208";a="962803837" Received: from phv-mobl.amr.corp.intel.com ([10.212.67.3]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Oct 2022 07:58:22 -0700 From: "Hv, Pavamana" To: devel@edk2.groups.io Cc: Pavamana Holavanahalli Subject: [PATCH v3] edk2-Platforms:Add VAB FIT record types support in FitGen.c Date: Mon, 31 Oct 2022 07:57:43 -0700 Message-Id: <1a8e3ffff75d946f749ac966bbe873f4c6ea1c76.1667227908.git.pavamana.hv@intel.com> X-Mailer: git-send-email 2.38.1.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4086 This commit adds support for new FIT record type for Vendor Authorized Boot (VAB) security technology(FIT spec revision 1.4). VAB defines 3 new following types Vendor Authorized Boot Provisioning Table (Type 0x1A) Vendor Authorized Boot Image Manifest (Type 0x1B) Vendor Authorized Boot Key Manifest (Type 0x1C) The code has been updated to align these binaries on 64 byte boundary and not to overlap with other regions, similar to Key manifest, Boot Policy manifest and other optional types. Also added macros to define FIT spec Major and Minor version numbers and print the same instead of hardcoded string. Signed-off-by: Pavamana Holavanahalli --- Silicon/Intel/Tools/FitGen/FitGen.c | 61 +++++++++++++++++++---------- Silicon/Intel/Tools/FitGen/FitGen.h | 5 ++- 2 files changed, 44 insertions(+), 22 deletions(-) diff --git a/Silicon/Intel/Tools/FitGen/FitGen.c b/Silicon/Intel/Tools/FitG= en/FitGen.c index 21dfcf1ebb..87123f9922 100644 --- a/Silicon/Intel/Tools/FitGen/FitGen.c +++ b/Silicon/Intel/Tools/FitGen/FitGen.c @@ -234,20 +234,24 @@ typedef struct { #define FLASH_TO_MEMORY(Address, FvBuffer, FvSize) \=0D (VOID *)(UINTN)((UINTN)(FvBuffer) + (UINTN)(FvSize) - (TO= P_FLASH_ADDRESS - (UINTN)(Address)))=0D =0D -#define FIT_TABLE_TYPE_HEADER 0=0D -#define FIT_TABLE_TYPE_MICROCODE 1=0D -#define FIT_TABLE_TYPE_STARTUP_ACM 2=0D -#define FIT_TABLE_TYPE_DIAGNST_ACM 3=0D -#define FIT_TABLE_TYPE_BIOS_MODULE 7=0D -#define FIT_TABLE_TYPE_TPM_POLICY 8=0D -#define FIT_TABLE_TYPE_BIOS_POLICY 9=0D -#define FIT_TABLE_TYPE_TXT_POLICY 10=0D -#define FIT_TABLE_TYPE_KEY_MANIFEST 11=0D -#define FIT_TABLE_TYPE_BOOT_POLICY_MANIFEST 12=0D -#define FIT_TABLE_TYPE_BIOS_DATA_AREA 13=0D -#define FIT_TABLE_TYPE_CSE_SECURE_BOOT 16=0D -#define FIT_TABLE_SUBTYPE_FIT_PATCH_MANIFEST 12=0D -#define FIT_TABLE_SUBTYPE_ACM_MANIFEST 13=0D +#define FIT_TABLE_TYPE_HEADER 0=0D +#define FIT_TABLE_TYPE_MICROCODE 1=0D +#define FIT_TABLE_TYPE_STARTUP_ACM 2=0D +#define FIT_TABLE_TYPE_DIAGNST_ACM 3=0D +#define FIT_TABLE_TYPE_BIOS_MODULE 7=0D +#define FIT_TABLE_TYPE_TPM_POLICY 8=0D +#define FIT_TABLE_TYPE_BIOS_POLICY 9=0D +#define FIT_TABLE_TYPE_TXT_POLICY 10=0D +#define FIT_TABLE_TYPE_KEY_MANIFEST 11=0D +#define FIT_TABLE_TYPE_BOOT_POLICY_MANIFEST 12=0D +#define FIT_TABLE_TYPE_BIOS_DATA_AREA 13=0D +#define FIT_TABLE_TYPE_CSE_SECURE_BOOT 16=0D +#define FIT_TABLE_SUBTYPE_FIT_PATCH_MANIFEST 12=0D +#define FIT_TABLE_SUBTYPE_ACM_MANIFEST 13=0D +#define FIT_TABLE_TYPE_VAB_PROVISION_TABLE 26=0D +#define FIT_TABLE_TYPE_VAB_BOOT_IMAGE_MANIFEST 27=0D +#define FIT_TABLE_TYPE_VAB_BOOT_KEY_MANIFEST 28=0D +=0D =0D //=0D // With OptionalModule Address isn't known until free space has been=0D @@ -322,8 +326,10 @@ Returns: --*/=0D {=0D printf (=0D - "%s - Tiano IA32/X64 FIT table generation Utility for FIT spec revisio= n 1.2."" Version %i.%i\n\n",=0D + "%s - Tiano IA32/X64 FIT table generation Utility for FIT spec revisio= n %i.%i."" Version %i.%i\n\n",=0D UTILITY_NAME,=0D + FIT_SPEC_VERSION_MAJOR,=0D + FIT_SPEC_VERSION_MINOR,=0D UTILITY_MAJOR_VERSION,=0D UTILITY_MINOR_VERSION=0D );=0D @@ -1956,7 +1962,10 @@ Returns: (gFitTableContext.OptionalModule[Index].Type =3D=3D FIT_TABLE_TYPE= _KEY_MANIFEST) ||=0D (gFitTableContext.OptionalModule[Index].Type =3D=3D FIT_TABLE_TYPE= _BOOT_POLICY_MANIFEST) ||=0D (gFitTableContext.OptionalModule[Index].Type =3D=3D FIT_TABLE_TYPE= _BIOS_DATA_AREA) ||=0D - (gFitTableContext.OptionalModule[Index].Type =3D=3D FIT_TABLE_TYPE= _CSE_SECURE_BOOT)) {=0D + (gFitTableContext.OptionalModule[Index].Type =3D=3D FIT_TABLE_TYPE= _CSE_SECURE_BOOT) ||=0D + (gFitTableContext.OptionalModule[Index].Type =3D=3D FIT_TABLE_TYPE= _VAB_PROVISION_TABLE) ||=0D + (gFitTableContext.OptionalModule[Index].Type =3D=3D FIT_TABLE_TYPE= _VAB_BOOT_IMAGE_MANIFEST) ||=0D + (gFitTableContext.OptionalModule[Index].Type =3D=3D FIT_TABLE_TYPE= _VAB_BOOT_KEY_MANIFEST)) {=0D // NOTE: It might be virtual address now. Just put a place holder.=0D FitEntryNumber ++;=0D }=0D @@ -2154,8 +2163,11 @@ Returns: (gFitTableContext.OptionalModule[Index].Type =3D=3D FIT_TABLE_TY= PE_KEY_MANIFEST) ||=0D (gFitTableContext.OptionalModule[Index].Type =3D=3D FIT_TABLE_TY= PE_BOOT_POLICY_MANIFEST) ||=0D (gFitTableContext.OptionalModule[Index].Type =3D=3D FIT_TABLE_TY= PE_BIOS_DATA_AREA) ||=0D - (gFitTableContext.OptionalModule[Index].Type =3D=3D FIT_TABLE_TY= PE_CSE_SECURE_BOOT)) {=0D - // Let it 64 byte align=0D + (gFitTableContext.OptionalModule[Index].Type =3D=3D FIT_TABLE_TY= PE_CSE_SECURE_BOOT) ||=0D + (gFitTableContext.OptionalModule[Index].Type =3D=3D FIT_TABLE_TY= PE_VAB_PROVISION_TABLE) ||=0D + (gFitTableContext.OptionalModule[Index].Type =3D=3D FIT_TABLE_TY= PE_VAB_BOOT_IMAGE_MANIFEST) ||=0D + (gFitTableContext.OptionalModule[Index].Type =3D=3D FIT_TABLE_TY= PE_VAB_BOOT_KEY_MANIFEST)) {=0D + // Let it 64 byte align=0D AlignedSize +=3D BIOS_MODULE_ALIGNMENT;=0D AlignedSize &=3D ~BIOS_MODULE_ALIGNMENT;=0D }=0D @@ -2166,8 +2178,11 @@ Returns: (gFitTableContext.OptionalModule[Index].Type =3D=3D FIT_TABLE_TY= PE_KEY_MANIFEST) ||=0D (gFitTableContext.OptionalModule[Index].Type =3D=3D FIT_TABLE_TY= PE_BOOT_POLICY_MANIFEST) ||=0D (gFitTableContext.OptionalModule[Index].Type =3D=3D FIT_TABLE_TY= PE_BIOS_DATA_AREA) ||=0D - (gFitTableContext.OptionalModule[Index].Type =3D=3D FIT_TABLE_TY= PE_CSE_SECURE_BOOT)) {=0D - // Let it 64 byte align=0D + (gFitTableContext.OptionalModule[Index].Type =3D=3D FIT_TABLE_TY= PE_CSE_SECURE_BOOT) ||=0D + (gFitTableContext.OptionalModule[Index].Type =3D=3D FIT_TABLE_TY= PE_VAB_PROVISION_TABLE) ||=0D + (gFitTableContext.OptionalModule[Index].Type =3D=3D FIT_TABLE_TY= PE_VAB_BOOT_IMAGE_MANIFEST) ||=0D + (gFitTableContext.OptionalModule[Index].Type =3D=3D FIT_TABLE_TY= PE_VAB_BOOT_KEY_MANIFEST)) {=0D + // Let it 64 byte align=0D OptionalModuleAddress =3D (UINT8 *)((UINTN)OptionalModuleAddress &= ~BIOS_MODULE_ALIGNMENT);=0D }=0D =0D @@ -2201,7 +2216,11 @@ Returns: (gFitTableContext.OptionalModule[Index].Type =3D=3D FIT_TABLE_TYPE= _KEY_MANIFEST) ||=0D (gFitTableContext.OptionalModule[Index].Type =3D=3D FIT_TABLE_TYPE= _BOOT_POLICY_MANIFEST) ||=0D (gFitTableContext.OptionalModule[Index].Type =3D=3D FIT_TABLE_TYPE= _BIOS_DATA_AREA) ||=0D - (gFitTableContext.OptionalModule[Index].Type =3D=3D FIT_TABLE_TYPE= _CSE_SECURE_BOOT)) {=0D + (gFitTableContext.OptionalModule[Index].Type =3D=3D FIT_TABLE_TYPE= _CSE_SECURE_BOOT) ||=0D + (gFitTableContext.OptionalModule[Index].Type =3D=3D FIT_TABLE_TYPE= _VAB_PROVISION_TABLE) ||=0D + (gFitTableContext.OptionalModule[Index].Type =3D=3D FIT_TABLE_TYPE= _VAB_BOOT_IMAGE_MANIFEST) ||=0D + (gFitTableContext.OptionalModule[Index].Type =3D=3D FIT_TABLE_TYPE= _VAB_BOOT_KEY_MANIFEST)) {=0D +=0D CheckOverlap (gFitTableContext.OptionalModule[Index].Address, Aligne= dSize);=0D }=0D }=0D diff --git a/Silicon/Intel/Tools/FitGen/FitGen.h b/Silicon/Intel/Tools/FitG= en/FitGen.h index 80a1423ceb..511ab652ab 100644 --- a/Silicon/Intel/Tools/FitGen/FitGen.h +++ b/Silicon/Intel/Tools/FitGen/FitGen.h @@ -31,9 +31,12 @@ SPDX-License-Identifier: BSD-2-Clause-Patent // Utility version information=0D //=0D #define UTILITY_MAJOR_VERSION 0=0D -#define UTILITY_MINOR_VERSION 66=0D +#define UTILITY_MINOR_VERSION 67=0D #define UTILITY_DATE __DATE__=0D =0D +#define FIT_SPEC_VERSION_MAJOR 1=0D +#define FIT_SPEC_VERSION_MINOR 4=0D +=0D //=0D // The minimum number of arguments accepted from the command line.=0D //=0D --=20 2.38.1.windows.1