diff options
author | Thiebaud Weksteen <tweek@google.com> | 2017-09-20 04:13:39 -0400 |
---|---|---|
committer | Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> | 2018-01-08 05:58:35 -0500 |
commit | 33b6d03469b2206fb51ecc37f40411a857ad8fff (patch) | |
tree | 6b0c5cc3fc87cdc3e5f796b55094563fb9c1bf69 /include/linux/efi.h | |
parent | 4d01d29d9307d321149ff5ad66d47bee8e56c012 (diff) |
efi: call get_event_log before ExitBootServices
With TPM 2.0 specification, the event logs may only be accessible by
calling an EFI Boot Service. Modify the EFI stub to copy the log area to
a new Linux-specific EFI configuration table so it remains accessible
once booted.
When calling this service, it is possible to specify the expected format
of the logs: TPM 1.2 (SHA1) or TPM 2.0 ("Crypto Agile"). For now, only the
first format is retrieved.
Signed-off-by: Thiebaud Weksteen <tweek@google.com>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Tested-by: Javier Martinez Canillas <javierm@redhat.com>
Tested-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Diffstat (limited to 'include/linux/efi.h')
-rw-r--r-- | include/linux/efi.h | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/include/linux/efi.h b/include/linux/efi.h index d813f7b04da7..dcea82dc4b89 100644 --- a/include/linux/efi.h +++ b/include/linux/efi.h | |||
@@ -473,6 +473,39 @@ typedef struct { | |||
473 | u64 get_all; | 473 | u64 get_all; |
474 | } apple_properties_protocol_64_t; | 474 | } apple_properties_protocol_64_t; |
475 | 475 | ||
476 | typedef struct { | ||
477 | u32 get_capability; | ||
478 | u32 get_event_log; | ||
479 | u32 hash_log_extend_event; | ||
480 | u32 submit_command; | ||
481 | u32 get_active_pcr_banks; | ||
482 | u32 set_active_pcr_banks; | ||
483 | u32 get_result_of_set_active_pcr_banks; | ||
484 | } efi_tcg2_protocol_32_t; | ||
485 | |||
486 | typedef struct { | ||
487 | u64 get_capability; | ||
488 | u64 get_event_log; | ||
489 | u64 hash_log_extend_event; | ||
490 | u64 submit_command; | ||
491 | u64 get_active_pcr_banks; | ||
492 | u64 set_active_pcr_banks; | ||
493 | u64 get_result_of_set_active_pcr_banks; | ||
494 | } efi_tcg2_protocol_64_t; | ||
495 | |||
496 | typedef u32 efi_tcg2_event_log_format; | ||
497 | |||
498 | typedef struct { | ||
499 | void *get_capability; | ||
500 | efi_status_t (*get_event_log)(efi_handle_t, efi_tcg2_event_log_format, | ||
501 | efi_physical_addr_t *, efi_physical_addr_t *, efi_bool_t *); | ||
502 | void *hash_log_extend_event; | ||
503 | void *submit_command; | ||
504 | void *get_active_pcr_banks; | ||
505 | void *set_active_pcr_banks; | ||
506 | void *get_result_of_set_active_pcr_banks; | ||
507 | } efi_tcg2_protocol_t; | ||
508 | |||
476 | /* | 509 | /* |
477 | * Types and defines for EFI ResetSystem | 510 | * Types and defines for EFI ResetSystem |
478 | */ | 511 | */ |
@@ -623,6 +656,7 @@ void efi_native_runtime_setup(void); | |||
623 | #define EFI_MEMORY_ATTRIBUTES_TABLE_GUID EFI_GUID(0xdcfa911d, 0x26eb, 0x469f, 0xa2, 0x20, 0x38, 0xb7, 0xdc, 0x46, 0x12, 0x20) | 656 | #define EFI_MEMORY_ATTRIBUTES_TABLE_GUID EFI_GUID(0xdcfa911d, 0x26eb, 0x469f, 0xa2, 0x20, 0x38, 0xb7, 0xdc, 0x46, 0x12, 0x20) |
624 | #define EFI_CONSOLE_OUT_DEVICE_GUID EFI_GUID(0xd3b36f2c, 0xd551, 0x11d4, 0x9a, 0x46, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d) | 657 | #define EFI_CONSOLE_OUT_DEVICE_GUID EFI_GUID(0xd3b36f2c, 0xd551, 0x11d4, 0x9a, 0x46, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d) |
625 | #define APPLE_PROPERTIES_PROTOCOL_GUID EFI_GUID(0x91bd12fe, 0xf6c3, 0x44fb, 0xa5, 0xb7, 0x51, 0x22, 0xab, 0x30, 0x3a, 0xe0) | 658 | #define APPLE_PROPERTIES_PROTOCOL_GUID EFI_GUID(0x91bd12fe, 0xf6c3, 0x44fb, 0xa5, 0xb7, 0x51, 0x22, 0xab, 0x30, 0x3a, 0xe0) |
659 | #define EFI_TCG2_PROTOCOL_GUID EFI_GUID(0x607f766c, 0x7455, 0x42be, 0x93, 0x0b, 0xe4, 0xd7, 0x6d, 0xb2, 0x72, 0x0f) | ||
626 | 660 | ||
627 | #define EFI_IMAGE_SECURITY_DATABASE_GUID EFI_GUID(0xd719b2cb, 0x3d3a, 0x4596, 0xa3, 0xbc, 0xda, 0xd0, 0x0e, 0x67, 0x65, 0x6f) | 661 | #define EFI_IMAGE_SECURITY_DATABASE_GUID EFI_GUID(0xd719b2cb, 0x3d3a, 0x4596, 0xa3, 0xbc, 0xda, 0xd0, 0x0e, 0x67, 0x65, 0x6f) |
628 | #define EFI_SHIM_LOCK_GUID EFI_GUID(0x605dab50, 0xe046, 0x4300, 0xab, 0xb6, 0x3d, 0xd8, 0x10, 0xdd, 0x8b, 0x23) | 662 | #define EFI_SHIM_LOCK_GUID EFI_GUID(0x605dab50, 0xe046, 0x4300, 0xab, 0xb6, 0x3d, 0xd8, 0x10, 0xdd, 0x8b, 0x23) |
@@ -635,6 +669,7 @@ void efi_native_runtime_setup(void); | |||
635 | #define LINUX_EFI_ARM_SCREEN_INFO_TABLE_GUID EFI_GUID(0xe03fc20a, 0x85dc, 0x406e, 0xb9, 0x0e, 0x4a, 0xb5, 0x02, 0x37, 0x1d, 0x95) | 669 | #define LINUX_EFI_ARM_SCREEN_INFO_TABLE_GUID EFI_GUID(0xe03fc20a, 0x85dc, 0x406e, 0xb9, 0x0e, 0x4a, 0xb5, 0x02, 0x37, 0x1d, 0x95) |
636 | #define LINUX_EFI_LOADER_ENTRY_GUID EFI_GUID(0x4a67b082, 0x0a4c, 0x41cf, 0xb6, 0xc7, 0x44, 0x0b, 0x29, 0xbb, 0x8c, 0x4f) | 670 | #define LINUX_EFI_LOADER_ENTRY_GUID EFI_GUID(0x4a67b082, 0x0a4c, 0x41cf, 0xb6, 0xc7, 0x44, 0x0b, 0x29, 0xbb, 0x8c, 0x4f) |
637 | #define LINUX_EFI_RANDOM_SEED_TABLE_GUID EFI_GUID(0x1ce1e5bc, 0x7ceb, 0x42f2, 0x81, 0xe5, 0x8a, 0xad, 0xf1, 0x80, 0xf5, 0x7b) | 671 | #define LINUX_EFI_RANDOM_SEED_TABLE_GUID EFI_GUID(0x1ce1e5bc, 0x7ceb, 0x42f2, 0x81, 0xe5, 0x8a, 0xad, 0xf1, 0x80, 0xf5, 0x7b) |
672 | #define LINUX_EFI_TPM_EVENT_LOG_GUID EFI_GUID(0xb7799cb0, 0xeca2, 0x4943, 0x96, 0x67, 0x1f, 0xae, 0x07, 0xb7, 0x47, 0xfa) | ||
638 | 673 | ||
639 | typedef struct { | 674 | typedef struct { |
640 | efi_guid_t guid; | 675 | efi_guid_t guid; |
@@ -909,6 +944,7 @@ extern struct efi { | |||
909 | unsigned long properties_table; /* properties table */ | 944 | unsigned long properties_table; /* properties table */ |
910 | unsigned long mem_attr_table; /* memory attributes table */ | 945 | unsigned long mem_attr_table; /* memory attributes table */ |
911 | unsigned long rng_seed; /* UEFI firmware random seed */ | 946 | unsigned long rng_seed; /* UEFI firmware random seed */ |
947 | unsigned long tpm_log; /* TPM2 Event Log table */ | ||
912 | efi_get_time_t *get_time; | 948 | efi_get_time_t *get_time; |
913 | efi_set_time_t *set_time; | 949 | efi_set_time_t *set_time; |
914 | efi_get_wakeup_time_t *get_wakeup_time; | 950 | efi_get_wakeup_time_t *get_wakeup_time; |
@@ -1534,6 +1570,8 @@ static inline void | |||
1534 | efi_enable_reset_attack_mitigation(efi_system_table_t *sys_table_arg) { } | 1570 | efi_enable_reset_attack_mitigation(efi_system_table_t *sys_table_arg) { } |
1535 | #endif | 1571 | #endif |
1536 | 1572 | ||
1573 | void efi_retrieve_tpm2_eventlog(efi_system_table_t *sys_table); | ||
1574 | |||
1537 | /* | 1575 | /* |
1538 | * Arch code can implement the following three template macros, avoiding | 1576 | * Arch code can implement the following three template macros, avoiding |
1539 | * reptition for the void/non-void return cases of {__,}efi_call_virt(): | 1577 | * reptition for the void/non-void return cases of {__,}efi_call_virt(): |
@@ -1601,4 +1639,12 @@ struct linux_efi_random_seed { | |||
1601 | u8 bits[]; | 1639 | u8 bits[]; |
1602 | }; | 1640 | }; |
1603 | 1641 | ||
1642 | struct linux_efi_tpm_eventlog { | ||
1643 | u32 size; | ||
1644 | u8 version; | ||
1645 | u8 log[]; | ||
1646 | }; | ||
1647 | |||
1648 | extern int efi_tpm_eventlog_init(void); | ||
1649 | |||
1604 | #endif /* _LINUX_EFI_H */ | 1650 | #endif /* _LINUX_EFI_H */ |