From 6dd948b57b129bf4e011804df24b4946da01e8c5 Mon Sep 17 00:00:00 2001 From: Lans Zhang Date: Thu, 30 Mar 2017 14:15:54 +0800 Subject: 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 --- shim.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; -- cgit v1.2.3