Skip to content

Commit

Permalink
generate_hash(): fix the regression
Browse files Browse the repository at this point in the history
The commit 03b9f80 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 <[email protected]>
  • Loading branch information
Lans Zhang authored and vathpela committed Apr 3, 2017
1 parent 7a44b29 commit 6dd948b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion shim.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 6dd948b

Please sign in to comment.