summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLans Zhang <jia.zhang@windriver.com>2017-03-30 14:15:54 +0800
committerPeter Jones <pjones@redhat.com>2017-04-03 14:53:45 -0400
commit6dd948b57b129bf4e011804df24b4946da01e8c5 (patch)
treed994c098b349976fcc0bb7d4c58653cc03a18ea5
parent7a44b29edcf9f6846376e3875dd34636b2d82c80 (diff)
downloadefi-boot-shim-6dd948b57b129bf4e011804df24b4946da01e8c5.tar.gz
efi-boot-shim-6dd948b57b129bf4e011804df24b4946da01e8c5.zip
generate_hash(): fix the regression
The commit 03b9f800 introduces an issue in case the gap between SumOfBytesHashed and context->SecDir->VirtualAddress exists. This would be a typo because a formal PE image always meet SumOfBytesHashed + hashsize == context->SecDir->VirtualAddress either the gap exists or not. Signed-off-by: Lans Zhang <jia.zhang@windriver.com>
-rw-r--r--shim.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/shim.c b/shim.c
index 289ca018..5cb75f0e 100644
--- a/shim.c
+++ b/shim.c
@@ -891,7 +891,7 @@ static EFI_STATUS generate_hash (char *data, unsigned int datasize_in,
hashsize = datasize - context->SecDir->Size - SumOfBytesHashed;
if ((datasize - SumOfBytesHashed < context->SecDir->Size) ||
- (SumOfBytesHashed - hashsize != context->SecDir->VirtualAddress)) {
+ (SumOfBytesHashed + hashsize != context->SecDir->VirtualAddress)) {
perror(L"Malformed binary after Attribute Certificate Table\n");
status = EFI_INVALID_PARAMETER;
goto done;