summaryrefslogtreecommitdiffstats
path: root/src/util
diff options
context:
space:
mode:
authorMichael Brown2013-02-25 18:22:01 +0100
committerMichael Brown2013-02-25 18:22:01 +0100
commit09c5109b8585178172c7608de8d52e9d9af0b680 (patch)
tree0aec340fff29b8caf434fb23b2f54db9b6158156 /src/util
parent[intel] Add Intel I210 Gigabit Ethernet PCI ID (diff)
downloadipxe-09c5109b8585178172c7608de8d52e9d9af0b680.tar.gz
ipxe-09c5109b8585178172c7608de8d52e9d9af0b680.tar.xz
ipxe-09c5109b8585178172c7608de8d52e9d9af0b680.zip
[efi] Ensure EFI binaries comply with Authenticode requirements
Authenticode requires that the size of the raw file must equal the size of the OptionalHeader.SizeOfHeaders plus the sum of all sections' SizeOfRawData. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/util')
-rw-r--r--src/util/elf2efi.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/util/elf2efi.c b/src/util/elf2efi.c
index 007453e2..b28c7ef3 100644
--- a/src/util/elf2efi.c
+++ b/src/util/elf2efi.c
@@ -614,8 +614,11 @@ static void write_pe_file ( struct pe_header *pe_header,
struct pe_section *section;
unsigned long fpos = 0;
+ /* Align length of headers */
+ fpos = pe_header->nt.OptionalHeader.SizeOfHeaders =
+ efi_file_align ( pe_header->nt.OptionalHeader.SizeOfHeaders );
+
/* Assign raw data pointers */
- fpos = efi_file_align ( pe_header->nt.OptionalHeader.SizeOfHeaders );
for ( section = pe_sections ; section ; section = section->next ) {
if ( section->hdr.SizeOfRawData ) {
section->hdr.PointerToRawData = fpos;