diff options
author | Doug Flick <dougflick@microsoft.com> | 2024-10-03 10:16:57 -0700 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2025-04-09 00:13:21 +0000 |
commit | b90693965b6b1566bcac4652ad1bb436e1bb461f (patch) | |
tree | 4b0134b5af95c1ae7acd6794bd83d875b4e08a7a /BaseTools/Source/Python/sitecustomize.py | |
parent | 5f08635ee7c176f78f788aa6528b43f18536a80b (diff) | |
download | edk2-b90693965b6b1566bcac4652ad1bb436e1bb461f.zip edk2-b90693965b6b1566bcac4652ad1bb436e1bb461f.tar.gz edk2-b90693965b6b1566bcac4652ad1bb436e1bb461f.tar.bz2 |
SecurityPkg: Improving HashPeImageByType () logic
Namely:
(1) The TWO_BYTE_ENCODE check is independent of Index. If it evalutes
to TRUE for Index==0, then it will evaluate to TRUE for all other
Index values as well. As a result, the (Index == HASHALG_MAX)
condition will fire after the loop, and we'll return
EFI_UNSUPPORTED.
While this is correct, functionally speaking, it is wasteful to
keep re-checking TWO_BYTE_ENCODE in the loop body. The check
should be made at the top of the function, and EFI_UNSUPPORTED
should be returned at once, if appropriate.
(2) If the hash algorithm selected by Index has such a large OID that
the OID comparison cannot even be performed (because AuthDataSize
is not large enough for containing the OID in question, starting
at offset 32), then the function returns EFI_UNSUPPORTED at once.
This is bogus; this case should simply be treated as an OID
mismatch, and the loop should advance to the next Index value /
hash algorithm candidate. A remaining hash algo may have a shorter
OID and yield an OID match.
Signed-off-by: Doug Flick <DougFlick@microsoft.com>
Diffstat (limited to 'BaseTools/Source/Python/sitecustomize.py')
0 files changed, 0 insertions, 0 deletions