소스 검색

[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>
tags/v1.20.1
Michael Brown 13 년 전
부모
커밋
09c5109b85
1개의 변경된 파일4개의 추가작업 그리고 1개의 파일을 삭제
  1. 4
    1
      src/util/elf2efi.c

+ 4
- 1
src/util/elf2efi.c 파일 보기

614
 	struct pe_section *section;
614
 	struct pe_section *section;
615
 	unsigned long fpos = 0;
615
 	unsigned long fpos = 0;
616
 
616
 
617
+	/* Align length of headers */
618
+	fpos = pe_header->nt.OptionalHeader.SizeOfHeaders =
619
+		efi_file_align ( pe_header->nt.OptionalHeader.SizeOfHeaders );
620
+
617
 	/* Assign raw data pointers */
621
 	/* Assign raw data pointers */
618
-	fpos = efi_file_align ( pe_header->nt.OptionalHeader.SizeOfHeaders );
619
 	for ( section = pe_sections ; section ; section = section->next ) {
622
 	for ( section = pe_sections ; section ; section = section->next ) {
620
 		if ( section->hdr.SizeOfRawData ) {
623
 		if ( section->hdr.SizeOfRawData ) {
621
 			section->hdr.PointerToRawData = fpos;
624
 			section->hdr.PointerToRawData = fpos;

Loading…
취소
저장