From 98d3ce77b4960785c5180277989542bfb90a9666 Mon Sep 17 00:00:00 2001 From: James Bottomley Date: Wed, 9 Jan 2019 16:04:01 -0800 Subject: [PATCH] src/image.c: remove alignment of regions The old code forced region size to be aligned to the PECOFF file alignment parameter, which is correct according to the spec. However, the major UEFI platforms do not align up when checking the signature, so if the PECOFF binary being signed already contains a signature, realigning the sections will make the existing signature invalid. Fix this by relaxing the rule about aligning up (also eliminates complaints about some pecoff sections being misaligned). Signed-off-by: James Bottomley --- src/image.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/image.c b/src/image.c index 3e655cc..745191f 100644 --- a/src/image.c +++ b/src/image.c @@ -388,8 +388,7 @@ static int image_find_regions(struct image *image) regions = image->checksum_regions; regions[n].data = buf + file_offset; - regions[n].size = align_up(file_size, - image->file_alignment); + regions[n].size = file_size; regions[n].name = talloc_strndup(image->checksum_regions, image->scnhdr[i].s_name, 8); bytes += regions[n].size;