]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
boot: Add TPM to status info
authorJan Janssen <medhefgo@web.de>
Fri, 7 Jan 2022 10:09:08 +0000 (11:09 +0100)
committerJan Janssen <medhefgo@web.de>
Mon, 10 Jan 2022 15:26:00 +0000 (16:26 +0100)
src/boot/efi/boot.c
src/boot/efi/measure.c
src/boot/efi/measure.h

index fc346956df8ea91e3c5bd30640150c4b221ad753..32923c23ed60feb3d9e61dab67d40c5d398fc4f9 100644 (file)
@@ -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");
index 4384c9dbf0fea0393b05231e7d10b96b20d9da50..992acde527c111638b92b6354461d7e29bc5297e 100644 (file)
@@ -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;
index b92d0574c9d5fcdb9c1b6906c7e1a84c74f97ca0..ffa49245626cbc383d10e66f114abd8bf2375d38 100644 (file)
@@ -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;
 }