Skip to content

Commit

Permalink
[efi] Ensure EFI binaries comply with Authenticode requirements
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
mcb30 committed Feb 25, 2013
1 parent 3c29c8e commit 09c5109
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/util/elf2efi.c
Expand Up @@ -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;
Expand Down

0 comments on commit 09c5109

Please sign in to comment.