mirror of
https://git.proxmox.com/git/efi-boot-shim
synced 2025-06-14 16:33:54 +00:00
shim: trigger to record further logs to tcg 2.0 final event log area
According to TCG EFI Protocol Specification for TPM 2.0 family, all events generated after the invocation of EFI_TCG2_GET_EVENT_LOG shall be stored in an instance of an EFI_CONFIGURATION_TABLE aka EFI TCG 2.0 final events table. Hence, it is necessary to trigger the internal switch through calling get_event_log() in order to allow to retrieve the logs from OS runtime. Signed-off-by: Lans Zhang <jia.zhang@windriver.com>
This commit is contained in:
parent
6c180c6004
commit
d3884fe833
21
tpm.c
21
tpm.c
@ -61,6 +61,21 @@ static BOOLEAN tpm2_present(efi_tpm2_protocol_t *tpm)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* According to TCG EFI Protocol Specification for TPM 2.0 family,
|
||||||
|
* all events generated after the invocation of EFI_TCG2_GET_EVENT_LOG
|
||||||
|
* shall be stored in an instance of an EFI_CONFIGURATION_TABLE aka
|
||||||
|
* EFI TCG 2.0 final events table. Hence, it is necessary to trigger the
|
||||||
|
* internal switch through calling get_event_log() in order to allow
|
||||||
|
* to retrieve the logs from OS runtime.
|
||||||
|
*/
|
||||||
|
static EFI_STATUS trigger_tcg2_final_events_table(efi_tpm2_protocol_t *tpm2)
|
||||||
|
{
|
||||||
|
return uefi_call_wrapper(tpm2->get_event_log, 5, tpm2,
|
||||||
|
EFI_TCG2_EVENT_LOG_FORMAT_TCG_2, NULL,
|
||||||
|
NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
EFI_STATUS tpm_log_event(EFI_PHYSICAL_ADDRESS buf, UINTN size, UINT8 pcr,
|
EFI_STATUS tpm_log_event(EFI_PHYSICAL_ADDRESS buf, UINTN size, UINT8 pcr,
|
||||||
const CHAR8 *description)
|
const CHAR8 *description)
|
||||||
{
|
{
|
||||||
@ -76,6 +91,12 @@ EFI_STATUS tpm_log_event(EFI_PHYSICAL_ADDRESS buf, UINTN size, UINT8 pcr,
|
|||||||
if (!tpm2_present(tpm2))
|
if (!tpm2_present(tpm2))
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
|
|
||||||
|
status = trigger_tcg2_final_events_table(tpm2);
|
||||||
|
if (EFI_ERROR(status)) {
|
||||||
|
perror(L"Unable to trigger tcg2 final events table\n");
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
event = AllocatePool(sizeof(*event) + strlen(description) + 1);
|
event = AllocatePool(sizeof(*event) + strlen(description) + 1);
|
||||||
if (!event) {
|
if (!event) {
|
||||||
perror(L"Unable to allocate event structure\n");
|
perror(L"Unable to allocate event structure\n");
|
||||||
|
2
tpm.h
2
tpm.h
@ -114,6 +114,8 @@ typedef struct tdEFI_TCG2_EVENT {
|
|||||||
uint8_t Event[1];
|
uint8_t Event[1];
|
||||||
} __attribute__ ((packed)) EFI_TCG2_EVENT;
|
} __attribute__ ((packed)) EFI_TCG2_EVENT;
|
||||||
|
|
||||||
|
#define EFI_TCG2_EVENT_LOG_FORMAT_TCG_2 0x00000002
|
||||||
|
|
||||||
struct efi_tpm2_protocol
|
struct efi_tpm2_protocol
|
||||||
{
|
{
|
||||||
EFI_STATUS (EFIAPI *get_capability) (struct efi_tpm2_protocol *this,
|
EFI_STATUS (EFIAPI *get_capability) (struct efi_tpm2_protocol *this,
|
||||||
|
Loading…
Reference in New Issue
Block a user