-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pe-zboot: Truncate the trailing zero if Image is signed
*** Issue *** In the linux kernel drivers/firmware/efi/libstub/Makefile.zboot, the original Image is padded with zero, using the following instruction: truncate -s $$(hexdump -s16 -n4 -e '"%u"' $<) $@ Hence pe-zboot.c decompress and gets Image plus trailing zeroes. These trailing zeroes don't affect loading the original PE file. But they do raise an issue during the signature verification. The root cause is that the kernel function: static int pefile_digest_pe_contents(const void *pebuf, unsigned int pelen, struct pefile_context *ctx, struct shash_desc *desc) treats [pebuf, pebuf+pelen] as valid payload, which includes the trailing zeroes. But that is not the truth. *** Solution *** In practice, the table of attribute certificates come at the end of a PE file. This patch utilizes that fact and truncates at the boundary of the certificate table to get the original Image. Signed-off-by: Pingfan Liu <[email protected]> To: [email protected]
- Loading branch information
Showing
2 changed files
with
52 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters