From: Jan Janssen Date: Fri, 7 Jan 2022 10:09:08 +0000 (+0100) Subject: boot: Add TPM to status info X-Git-Tag: v251-rc1~548^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a87e9cd79f61da25c55cac1778bfb6d533e174cb;p=thirdparty%2Fsystemd.git boot: Add TPM to status info --- diff --git a/src/boot/efi/boot.c b/src/boot/efi/boot.c index fc346956df8..32923c23ed6 100644 --- a/src/boot/efi/boot.c +++ b/src/boot/efi/boot.c @@ -461,6 +461,7 @@ static void print_status(Config *config, CHAR16 *loaded_image_path) { Print(L" OS indications: %lu\n", get_os_indications_supported()); Print(L" secure boot: %s (%s)\n", yes_no(IN_SET(secure, SECURE_BOOT_USER, SECURE_BOOT_DEPLOYED)), secure_boot_mode_to_string(secure)); ps_bool(L" shim: %s\n", shim_loaded()); + ps_bool(L" TPM: %s\n", tpm_present()); Print(L" console mode: %d/%d (%lu x %lu)\n", ST->ConOut->Mode->Mode, ST->ConOut->Mode->MaxMode - 1LL, x_max, y_max); Print(L"\n--- Press any key to continue. ---\n\n"); diff --git a/src/boot/efi/measure.c b/src/boot/efi/measure.c index 4384c9dbf0f..992acde527c 100644 --- a/src/boot/efi/measure.c +++ b/src/boot/efi/measure.c @@ -135,6 +135,10 @@ static EFI_TCG2 * tcg2_interface_check(void) { return tcg; } +BOOLEAN tpm_present(void) { + return tcg2_interface_check() || tcg1_interface_check(); +} + EFI_STATUS tpm_log_event(UINT32 pcrindex, const EFI_PHYSICAL_ADDRESS buffer, UINTN buffer_size, const CHAR16 *description) { EFI_TCG *tpm1; EFI_TCG2 *tpm2; diff --git a/src/boot/efi/measure.h b/src/boot/efi/measure.h index b92d0574c9d..ffa49245626 100644 --- a/src/boot/efi/measure.h +++ b/src/boot/efi/measure.h @@ -5,11 +5,15 @@ #if ENABLE_TPM +BOOLEAN tpm_present(void); EFI_STATUS tpm_log_event(UINT32 pcrindex, const EFI_PHYSICAL_ADDRESS buffer, UINTN buffer_size, const CHAR16 *description); EFI_STATUS tpm_log_load_options(const CHAR16 *cmdline); #else +static inline BOOLEAN tpm_present(void) { + return FALSE; +} static inline EFI_STATUS tpm_log_event(UINT32 pcrindex, const EFI_PHYSICAL_ADDRESS buffer, UINTN buffer_size, const CHAR16 *description) { return EFI_SUCCESS; }