summaryrefslogtreecommitdiffstats
path: root/SignedCapsulePkg
diff options
context:
space:
mode:
authorOleksiy Yakovlev <oleksiyy@ami.com>2020-05-15 15:38:48 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2020-05-20 14:49:13 +0000
commitbc5012b8fbf9f769a62d8a7a2dbf04343c16d398 (patch)
treea37e72e084c5d6fbf4bc51cbdcb27c1759d9ec63 /SignedCapsulePkg
parent5a4b24b89a5ce78223c031e3526c1cce65f7fca6 (diff)
downloadedk2-bc5012b8fbf9f769a62d8a7a2dbf04343c16d398.tar.gz
edk2-bc5012b8fbf9f769a62d8a7a2dbf04343c16d398.tar.bz2
edk2-bc5012b8fbf9f769a62d8a7a2dbf04343c16d398.zip
SignedCapsulePkg: Add FMP Capsule Image Header extension
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> Signed-off-by: Wei6 Xu <wei6.xu@intel.com> Reviewed-by: Chao Zhang <chao.b.zhang@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
Diffstat (limited to 'SignedCapsulePkg')
-rw-r--r--SignedCapsulePkg/Universal/RecoveryModuleLoadPei/RecoveryModuleLoadPei.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/SignedCapsulePkg/Universal/RecoveryModuleLoadPei/RecoveryModuleLoadPei.c b/SignedCapsulePkg/Universal/RecoveryModuleLoadPei/RecoveryModuleLoadPei.c
index 53b821c2bb..af8e5cb84c 100644
--- a/SignedCapsulePkg/Universal/RecoveryModuleLoadPei/RecoveryModuleLoadPei.c
+++ b/SignedCapsulePkg/Universal/RecoveryModuleLoadPei/RecoveryModuleLoadPei.c
@@ -328,8 +328,14 @@ 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 if (ImageHeader->Version == 2){
+ FmpImageHeaderSize = OFFSET_OF(EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER, ImageCapsuleSupport);
}
// No overflow
@@ -639,9 +645,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);