-
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tpm: parse TPM event logs based on EFI table
If we are not able to retrieve the TPM event logs from the ACPI table, check the EFI configuration table (Linux-specific GUID). The format version of the log is now returned by the provider function. Signed-off-by: Thiebaud Weksteen <tweek@google.com> Reviewed-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.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>
- Loading branch information
Showing
6 changed files
with
88 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* | ||
* Copyright (C) 2017 Google | ||
* | ||
* Authors: | ||
* Thiebaud Weksteen <tweek@google.com> | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License | ||
* as published by the Free Software Foundation; either version | ||
* 2 of the License, or (at your option) any later version. | ||
* | ||
*/ | ||
|
||
#include <linux/efi.h> | ||
#include <linux/tpm_eventlog.h> | ||
|
||
#include "tpm.h" | ||
|
||
/* read binary bios log from EFI configuration table */ | ||
int tpm_read_log_efi(struct tpm_chip *chip) | ||
{ | ||
|
||
struct linux_efi_tpm_eventlog *log_tbl; | ||
struct tpm_bios_log *log; | ||
u32 log_size; | ||
u8 tpm_log_version; | ||
|
||
if (!(chip->flags & TPM_CHIP_FLAG_TPM2)) | ||
return -ENODEV; | ||
|
||
if (efi.tpm_log == EFI_INVALID_TABLE_ADDR) | ||
return -ENODEV; | ||
|
||
log = &chip->log; | ||
|
||
log_tbl = memremap(efi.tpm_log, sizeof(*log_tbl), MEMREMAP_WB); | ||
if (!log_tbl) { | ||
pr_err("Could not map UEFI TPM log table !\n"); | ||
return -ENOMEM; | ||
} | ||
|
||
log_size = log_tbl->size; | ||
memunmap(log_tbl); | ||
|
||
log_tbl = memremap(efi.tpm_log, sizeof(*log_tbl) + log_size, | ||
MEMREMAP_WB); | ||
if (!log_tbl) { | ||
pr_err("Could not map UEFI TPM log table payload!\n"); | ||
return -ENOMEM; | ||
} | ||
|
||
/* malloc EventLog space */ | ||
log->bios_event_log = kmalloc(log_size, GFP_KERNEL); | ||
if (!log->bios_event_log) | ||
goto err_memunmap; | ||
memcpy(log->bios_event_log, log_tbl->log, log_size); | ||
log->bios_event_log_end = log->bios_event_log + log_size; | ||
|
||
tpm_log_version = log_tbl->version; | ||
memunmap(log_tbl); | ||
return tpm_log_version; | ||
|
||
err_memunmap: | ||
memunmap(log_tbl); | ||
return -ENOMEM; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters