efi_loader: correctly handle no tpm device error
authorMasahisa Kojima <masahisa.kojima@linaro.org>
Tue, 7 Dec 2021 05:15:33 +0000 (14:15 +0900)
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Thu, 9 Dec 2021 19:43:25 +0000 (11:43 -0800)
commitf9b51dcf294de9b5a0e3d121027121e320810f19
tree3bf216a676793e71ef5e9c2c4788cb13ca1703f5
parent9e32bf936264b567dc8d6bcb0b348d4161719145
efi_loader: correctly handle no tpm device error

When the TCG2 protocol is installed in efi_tcg2_register(),
TPM2 device must be present.
tcg2_measure_pe_image() expects that TCP2 protocol is installed
and TPM device is available. If TCG2 Protocol is installed but
TPM device is not found, tcg2_measure_pe_image() returns
EFI_SECURITY_VIOLATION and efi_load_image() ends with failure.

The same error handling is applied to
efi_tcg2_measure_efi_app_invocation().

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
lib/efi_loader/efi_boottime.c
lib/efi_loader/efi_image_loader.c
lib/efi_loader/efi_tcg2.c