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.web12.94.1589403360768430673 for ; Wed, 13 May 2020 13:56:07 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=fail (domain: ami.com, ip: , mailfrom: oleksiyy@ami.com) X-AuditID: ac10606f-05fff70000001b62-24-5ebc5ee5af79 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 ED.24.07010.5EE5CBE5; Wed, 13 May 2020 16:56:06 -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 16:55:23 -0400 From: "Oleksiy Yakovlev" To: CC: , , , , , , , Subject: [PATCH V5 6/6] SignedCapsulePkg: Add FMP Capsule Image Header extension Date: Wed, 13 May 2020 16:55:15 -0400 Message-ID: <20200513205515.56044-7-oleksiyy@ami.com> X-Mailer: git-send-email 2.9.0.windows.1 In-Reply-To: <20200513205515.56044-1-oleksiyy@ami.com> References: <20200513205515.56044-1-oleksiyy@ami.com> MIME-Version: 1.0 Return-Path: oleksiyy@ami.com X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrPIsWRmVeSWpSXmKPExsWyRiBhgu6zuD1xBqtOMlnMf1tt0T5hNpvF 1Vu/mCzmfZvBarHuo4fFinsb2C06Ov4xObB7bP9+gdFj8Z6XTAFMUQ2MNol5efkliSWpCimp xcm2SgFFmWWJyZVKCpkptkqGSgoFOYnJqbmpeSW2SokFBal5KUp2XAoYwAaoLDNPITUvOT8l My/dVskz2F/XwsLUUtdQyS4kI1UhMy8tvyg3sSQzP08hOT+vBKg6NQUoqpDQzZmxa1kfW0Gr SMXBZVNZGxifCXQxcnJICJhILD/ZywZiCwnsYpK4d023i5ELyN7CKLHmxwdmkASbgKbEgWNT GEFsEQEpiSkHZjKB2MwChxklOj6BxYUFgiQO3fsFNIiDg0VAVaJpZwFImFfAVOLb/T+MELs0 JKatucsEUsIpYCYxdbUpxFpTiVOv5jFBlAtKnJz5hAViuoTEwRcvmCFqZCXajj9nn8DIPwtJ 2SwkZQsYmVYxCiWW5OQmZuaklxvpJeZm6iXn525ihMRe/g7Gjx/NDzEycTAeYpTgYFYS4fVb vztOiDclsbIqtSg/vqg0J7X4EKMT0PkTmaW4QcEHjI94YwMDKVEYx9DEzMTcyNzQ0sTc2FhJ nHfS2jVxQgLpwHjNTk0tSC2CGcLEwSnVwHhbe0GPSuLu/y3W3poPo9ZN1GwxmuNd8aYs4ERQ 2JRZOTYzU2vYtTcK3TgoeWMq/8mgRA+VSocNheXit/wnFZ4xN3zIOLf71jnxFjemZCcmT632 9LuG+UlG/SzTO++/rpzz6tfByYlvl82cWPCq483ML8musleKvWa71NpUbXzoF2k8471CsBJL cUaioRZzUXEiAL5iZJXSAgAA 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 --- .../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.