efi_loader: Don't stop EFI subsystem init if installing TCG2 fails
authorIlias Apalodimas <ilias.apalodimas@linaro.org>
Tue, 11 May 2021 21:03:41 +0000 (00:03 +0300)
committerHeinrich Schuchardt <xypron.glpk@gmx.de>
Tue, 18 May 2021 10:36:13 +0000 (12:36 +0200)
commit2052759a5e331376c037760a84d36280be0ef3e9
tree53c4e3042b0b8a3efc6414ee62a8a55f5a41d79b
parent97f446a8ff7ccefc1eb27c48c2e64d36dc8bd8e6
efi_loader: Don't stop EFI subsystem init if installing TCG2 fails

Up to now we are stopping the EFI subsystem if a TPMv2 exists but the
protocol fails to install.  Now that we've switched the config to 'default
y' the sandbox TPM fails, since it doesn't support all the required
capabilities of the protocol.

Not installing the protocol is not catastrophic.  If the protocol fails
to install the PCRs will never be extended to the expected values, so
some other entity later in the boot flow will eventually figure it out
and take the necessary actions.

While at it fix a corner case were the user can see an invalid error
message when the protocol failed to install.  We do have a tcg2_uninit()
which we call when the protocol installation fails.  There are cases though
that this might be called before the configuration table is installed (e.g
probing the TPM for capabilities failed).  In that case the user will see
"Failed to delete final events config table".  So stop printing it since it's
not an actual failure , simply because the config table was never installed
in the first place.

In order to stop printing it make efi_init_event_log() and create_final_event()
cleanup themselves and only call tcg2_uninit() when the protocol installation
fails.

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
lib/efi_loader/efi_tcg2.c