File fwupdate-bsc1113008-dont-add-headers-to-fmp-capsules.patch of Package fwupdate.18918

From caba719e5e0d8dfc0455876485e0a2578e3e943e Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Mon, 16 Oct 2017 11:17:11 -0400
Subject: [PATCH] Don't add headers to FMP update capsules.

Signed-off-by: Peter Jones <pjones@redhat.com>
---
 efi/fwupdate.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/efi/fwupdate.c b/efi/fwupdate.c
index d009267..bebfcd8 100644
--- a/efi/fwupdate.c
+++ b/efi/fwupdate.c
@@ -19,6 +19,8 @@
 EFI_GUID empty_guid = {0x0,0x0,0x0,{0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}};
 EFI_GUID fwupdate_guid =
 	{0x0abba7dc,0xe516,0x4167,{0xbb,0xf5,0x4d,0x9d,0x1c,0x73,0x94,0x16}};
+EFI_GUID fmp_capsule_guid =
+	{0x6dcbd5ed,0xe82d,0x4c44,{0xbd,0xa1,0x71,0x94,0x19,0x9a,0xd9,0x2a}};
 
 #include "fwup-efi.h"
 
@@ -664,6 +666,9 @@ open_file(EFI_DEVICE_PATH *dp, EFI_FILE_HANDLE *fh)
 	return EFI_SUCCESS;
 }
 
+#define is_fmp_capsule(guid) (CompareMem(guid, &fmp_capsule_guid, \
+					 sizeof (fmp_capsule_guid)) == 0)
+
 static EFI_STATUS
 add_capsule(update_table *update, EFI_CAPSULE_HEADER **capsule_out,
 	    EFI_CAPSULE_BLOCK_DESCRIPTOR *cbd_out)
@@ -690,8 +695,9 @@ add_capsule(update_table *update, EFI_CAPSULE_HEADER **capsule_out,
 	 * Unfortunately there's not a good way to do this, so we're just
 	 * checking if the capsule has the fw_class guid at the right place.
 	 */
-	if (CompareMem(&update->info->guid, fbuf,
-			sizeof (update->info->guid)) == 0 &&
+	if ((CompareMem(&update->info->guid, fbuf,
+			sizeof (update->info->guid)) == 0 ||
+	    is_fmp_capsule((efi_guid_t *)fbuf)) &&
 	    /*
 	     * We're ignoring things that are 40 bytes here, because that's
 	     * the size of the variables used in the test code I wrote for
-- 
2.19.0

openSUSE Build Service is sponsored by