From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from atlmailgw2.ami.com (atlmailgw2.ami.com []) by mx.groups.io with SMTP id smtpd.web10.1804.1589409632386466326 for ; Wed, 13 May 2020 15:40:37 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=fail (domain: ami.com, ip: , mailfrom: oleksiyy@ami.com) X-AuditID: ac10606f-05fff70000001b62-a7-5ebc77649787 Received: from atlms1.us.megatrends.com (atlms1.us.megatrends.com [172.16.96.144]) (using TLS with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (Client did not present a certificate) by atlmailgw2.ami.com (Symantec Messaging Gateway) with SMTP id AC.44.07010.4677CBE5; Wed, 13 May 2020 18:40:36 -0400 (EDT) Received: from Oleksiy77.us.megatrends.com (172.16.97.158) by atlms1.us.megatrends.com (172.16.96.144) with Microsoft SMTP Server id 14.3.468.0; Wed, 13 May 2020 18:39:53 -0400 From: "Oleksiy Yakovlev" To: CC: , , , , , , , Subject: [PATCH V6 6/6] SignedCapsulePkg: Add FMP Capsule Image Header extension Date: Wed, 13 May 2020 18:39:47 -0400 Message-ID: <20200513223947.56560-7-oleksiyy@ami.com> X-Mailer: git-send-email 2.9.0.windows.1 In-Reply-To: <20200513223947.56560-1-oleksiyy@ami.com> References: <20200513223947.56560-1-oleksiyy@ami.com> MIME-Version: 1.0 Return-Path: oleksiyy@ami.com X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrIIsWRmVeSWpSXmKPExsWyRiBhgm5K+Z44gwWPdC3mv622aJ8wm83i 6q1fTBbzvs1gtVj30cNixb0N7BYdHf+YHNg9tn+/wOixeM9LpgCmqAZGm8S8vPySxJJUhZTU 4mRbpYCizLLE5EolhcwUWyVDJYWCnMTk1NzUvBJbpcSCgtS8FCU7LgUMYANUlpmnkJqXnJ+S mZduq+QZ7K9rYWFqqWuoZBeSkaqQmZeWX5SbWJKZn6eQnJ9XAlSdmgIUVUjo5szY8+I8c8FG kYrdl08zNTB2C3YxcnJICJhI/F55jr2LkYtDSGAXk8TRrplMIAkhgS2MEjev6IPYbAKaEgeO TWEEsUUEpCSmHICoYRY4zCjR8QksLiwQLPFo3mtWEJtFQFVi6uazbCA2r4CpxM67S9ghlmlI TFtzF6yXU8BMYtOCXhaIXaYSW18cZYeoF5Q4OfMJC8R8CYmDL14wQ9TISrQdf84+gZF/FpKy WUjKFjAyrWIUSizJyU3MzEkvN9JLzM3US87P3cQIib/8HYwfP5ofYmTiYDzEKMHBrCTC67d+ d5wQb0piZVVqUX58UWlOavEhRiegByYyS3GDAhAYI/HGBgZSojCOoYmZibmRuaGlibmxsZI4 76S1a+KEBNKBMZudmlqQWgQzhImDU6qBkX/x35PeB/rvzmWtXB+8w5Tp33RtqT9LDm9lc7T/ mVg5cYktz7EJy7aKvZRj93yZcaRobf/H/09nHpAxfB5oruH1/dUGzsl7N00JyTl8vNHruMbv rldCF2xPzxQ+dot53u8jk9eK+PgkPRNcIa19ZMGWxnnxVx84MupLRczW7198arLjPTvjR8uU WIozEg21mIuKEwHVpO7r1AIAAA== Content-Type: text/plain Add bitmask to structure which gives a binary-inspectable mechanism to determine if a capsule contains an authentication section or depex section. (UEFI 2.8 errata a, mantis 2026) Signed-off-by: Oleksiy Yakovlev Reviewed-by: Wei6 Xu --- .../RecoveryModuleLoadPei/RecoveryModuleLoadPei.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/SignedCapsulePkg/Universal/RecoveryModuleLoadPei/RecoveryModuleLoadPei.c b/SignedCapsulePkg/Universal/RecoveryModuleLoadPei/RecoveryModuleLoadPei.c index 53b821c..307060b 100644 --- a/SignedCapsulePkg/Universal/RecoveryModuleLoadPei/RecoveryModuleLoadPei.c +++ b/SignedCapsulePkg/Universal/RecoveryModuleLoadPei/RecoveryModuleLoadPei.c @@ -328,10 +328,11 @@ ValidateFmpCapsule ( DEBUG((DEBUG_ERROR, "ImageHeader->Version(0x%x) Unknown\n", ImageHeader->Version)); return EFI_INVALID_PARAMETER; } - if (ImageHeader->Version < EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER_INIT_VERSION) { + if (ImageHeader->Version == 1) { FmpImageHeaderSize = OFFSET_OF(EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER, UpdateHardwareInstance); + } else { + FmpImageHeaderSize = OFFSET_OF(EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER, ImageCapsuleSupport); } - // No overflow if (FmpImageSize != (UINT64)FmpImageHeaderSize + (UINT64)ImageHeader->UpdateImageSize + (UINT64)ImageHeader->UpdateVendorCodeSize) { DEBUG((DEBUG_ERROR, "FmpImageSize(0x%lx) mismatch, UpdateImageSize(0x%x) UpdateVendorCodeSize(0x%x)\n", FmpImageSize, ImageHeader->UpdateImageSize, ImageHeader->UpdateVendorCodeSize)); @@ -639,9 +640,14 @@ ProcessFmpCapsuleImage ( } else { // // If the EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER is version 1, only match ImageTypeId. - // Header should exclude UpdateHardwareInstance field + // Header should exclude UpdateHardwareInstance field. + // If version is 2 Header should exclude ImageCapsuleSupport field. // - Image = (UINT8 *)ImageHeader + OFFSET_OF(EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER, UpdateHardwareInstance); + if (ImageHeader->Version == 1) { + Image = (UINT8 *)ImageHeader + OFFSET_OF(EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER, UpdateHardwareInstance); + } else { + Image = (UINT8 *)ImageHeader + OFFSET_OF(EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER, ImageCapsuleSupport); + } } Status = ProcessRecoveryImage (Image, ImageHeader->UpdateImageSize); -- 2.9.0.windows.1 Please consider the environment before printing this email. The information contained in this message may be confidential and proprietary to American Megatrends (AMI). This communication is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited. Please promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and then delete or destroy all copies of the transmission.