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 <James.Bottomley@HansenPartnership.com>
This commit is contained in:
James Bottomley 2019-01-09 16:04:01 -08:00
parent 73a13fb7e3
commit 98d3ce77b4

View file

@ -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;