efi_loader: signature: correct a behavior against multiple signatures
authorAKASHI Takahiro <takahiro.akashi@linaro.org>
Fri, 14 Aug 2020 05:39:23 +0000 (14:39 +0900)
committerHeinrich Schuchardt <xypron.glpk@gmx.de>
Fri, 14 Aug 2020 10:28:25 +0000 (12:28 +0200)
commit52956e535e65c852b1f95d2ca5044cb7c4fc6bbe
tree2e7e3317e17608b7c7c4c003fa15477b52d5b7b4
parentf68a6d583578799ec2011476ebd1e10590c6eb3c
efi_loader: signature: correct a behavior against multiple signatures

Under the current implementation, all the signatures, if any, in
a signed image must be verified before loading it.

Meanwhile, UEFI specification v2.8b section 32.5.3.3 says,
    Multiple signatures are allowed to exist in the binary’s certificate
    table (as per PE/COFF Section “Attribute Certificate Table”). Only
    one hash or signature is required to be present in db in order to pass
    validation, so long as neither the SHA-256 hash of the binary nor any
    present signature is reflected in dbx.

This patch makes the semantics of signature verification compliant with
the specification mentioned above.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reported-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
include/efi_loader.h
lib/efi_loader/efi_image_loader.c
lib/efi_loader/efi_signature.c