summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2020-08-03 09:34:09 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2020-08-03 09:34:09 -0700
commit92b7e4923fdbeda9b86b1398127449d5353f9123 (patch)
treeb5c59aaf0d436c19fe3f534bcba05c08105c7864 /include
parentc6fe44d96fc1536af5b11cd859686453d1b7bfd1 (diff)
parent85467f63a05c43364ba0b90d0c05bb89191543fa (diff)
Merge tag 'tpmdd-next-v5.9' of git://git.infradead.org/users/jjs/linux-tpmdd
Pull tpm updates from Jarkko Sakkinen: "An issue was fixed with the TPM space buffer size. The buffer is used to store in-TPM objects while swapped out of the TPM for a /dev/tpmrm0 session. The code incorrectly used PAGE_SIZE, which obviously can vary. With these changes the buffer has a fixed size of 16 kB. In addition, this contains support for acquiring TPM even log from TPM2 ACPI table. This method is used by QEMU in particular" * tag 'tpmdd-next-v5.9' of git://git.infradead.org/users/jjs/linux-tpmdd: tpm: Add support for event log pointer found in TPM2 ACPI table acpi: Extend TPM2 ACPI table with missing log fields tpm: Unify the mismatching TPM space buffer sizes tpm: Require that all digests are present in TCG_PCR_EVENT2 structures
Diffstat (limited to 'include')
-rw-r--r--include/acpi/actbl3.h7
-rw-r--r--include/linux/tpm.h1
-rw-r--r--include/linux/tpm_eventlog.h11
3 files changed, 17 insertions, 2 deletions
diff --git a/include/acpi/actbl3.h b/include/acpi/actbl3.h
index b0b163b9efc6..bdcac69fa6bd 100644
--- a/include/acpi/actbl3.h
+++ b/include/acpi/actbl3.h
@@ -415,6 +415,13 @@ struct acpi_table_tpm2 {
/* Platform-specific data follows */
};
+/* Optional trailer for revision 4 holding platform-specific data */
+struct acpi_tpm2_phy {
+ u8 start_method_specific[12];
+ u32 log_area_minimum_length;
+ u64 log_area_start_address;
+};
+
/* Values for start_method above */
#define ACPI_TPM2_NOT_ALLOWED 0
diff --git a/include/linux/tpm.h b/include/linux/tpm.h
index 03e9b184411b..8f4ff39f51e7 100644
--- a/include/linux/tpm.h
+++ b/include/linux/tpm.h
@@ -96,6 +96,7 @@ struct tpm_space {
u8 *context_buf;
u32 session_tbl[3];
u8 *session_buf;
+ u32 buf_size;
};
struct tpm_bios_log {
diff --git a/include/linux/tpm_eventlog.h b/include/linux/tpm_eventlog.h
index 64356b199e94..739ba9a03ec1 100644
--- a/include/linux/tpm_eventlog.h
+++ b/include/linux/tpm_eventlog.h
@@ -211,9 +211,16 @@ static inline int __calc_tpm2_event_size(struct tcg_pcr_event2_head *event,
efispecid = (struct tcg_efi_specid_event_head *)event_header->event;
- /* Check if event is malformed. */
+ /*
+ * Perform validation of the event in order to identify malformed
+ * events. This function may be asked to parse arbitrary byte sequences
+ * immediately following a valid event log. The caller expects this
+ * function to recognize that the byte sequence is not a valid event
+ * and to return an event size of 0.
+ */
if (memcmp(efispecid->signature, TCG_SPECID_SIG,
- sizeof(TCG_SPECID_SIG)) || count > efispecid->num_algs) {
+ sizeof(TCG_SPECID_SIG)) ||
+ !efispecid->num_algs || count != efispecid->num_algs) {
size = 0;
goto out;
}