public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Oleksiy Yakovlev" <oleksiyy@ami.com>
To: <devel@edk2.groups.io>
Cc: <liming.gao@intel.com>, <michael.d.kinney@intel.com>,
	<jian.j.wang@intel.com>, <hao.a.wu@intel.com>,
	<jiewen.yao@intel.com>, <chao.b.zhang@intel.com>,
	<Felixp@ami.com>, <oleksiyy@ami.com>
Subject: [PATCH V7 6/6] SignedCapsulePkg: Add FMP Capsule Image Header extension
Date: Thu, 14 May 2020 16:51:45 -0400	[thread overview]
Message-ID: <20200514205145.36956-7-oleksiyy@ami.com> (raw)
In-Reply-To: <20200514205145.36956-1-oleksiyy@ami.com>

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 <oleksiyy@ami.com>

Reviewed-by: Wei6 Xu <wei6.xu@intel.com>
Reviewed-by: Chao Zhang <chao.b.zhang@intel.com>
---
 .../RecoveryModuleLoadPei/RecoveryModuleLoadPei.c      | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/SignedCapsulePkg/Universal/RecoveryModuleLoadPei/RecoveryModuleLoadPei.c b/SignedCapsulePkg/Universal/RecoveryModuleLoadPei/RecoveryModuleLoadPei.c
index 53b821c..12cc235 100644
--- a/SignedCapsulePkg/Universal/RecoveryModuleLoadPei/RecoveryModuleLoadPei.c
+++ b/SignedCapsulePkg/Universal/RecoveryModuleLoadPei/RecoveryModuleLoadPei.c
@@ -328,10 +328,15 @@ 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) {
+    ///
+    /// Current Init ImageHeader version is 3. UpdateHardwareInstance field was added in version 2
+    /// and ImageCapsuleSupport field was added in version 3
+    ///
+    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 +644,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.

      parent reply	other threads:[~2020-05-14 20:52 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-14 20:51 [PATCH V7 0/6] Add definitions introduced in UEFI 2.8a Oleksiy Yakovlev
2020-05-14 20:51 ` [PATCH V7 1/6] MdePkg: Add new CPER Notification types Oleksiy Yakovlev
2020-05-14 20:51 ` [PATCH V7 2/6] MdePkg: Fix OUT parameters marked as IN OUT Oleksiy Yakovlev
2020-05-14 20:51 ` [PATCH V7 3/6] MdePkg: Add EFI_RT_PROPERTIES_TABLE Oleksiy Yakovlev
2020-05-14 20:51 ` [PATCH V7 4/6] MdePkg: Add FMP Capsule Image Header extension Oleksiy Yakovlev
2020-05-14 20:51 ` [PATCH V7 5/6] MdeModulePkg: " Oleksiy Yakovlev
2020-05-15  6:13   ` Liming Gao
2020-05-18 22:09     ` Oleksiy Yakovlev
2020-05-19  0:39       ` [edk2-devel] " Liming Gao
2020-05-19 15:42         ` Oleksiy Yakovlev
2020-05-20 13:57         ` Oleksiy Yakovlev
2020-05-20 14:22           ` Liming Gao
     [not found]   ` <160F1EEE36EFCBA2.23170@groups.io>
2020-05-15  8:33     ` Liming Gao
2020-05-14 20:51 ` Oleksiy Yakovlev [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200514205145.36956-7-oleksiyy@ami.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox