History

tpm: add _head suffix to tcg_efi_specid_event and tcg_pcr_event2

TCG defines two structures, TCG_EfiSpecIDEventStruct and TCG_PCR_EVENT2, which contain variable-sized arrays in the middle of the definition. Since these structures are not suitable for type casting, this patch removes structure members after the variable-sized arrays and adds the _head suffix to the structure name, to indicate that the renamed structures do not contain all fields defined by TCG. Lastly, given that variable-sized arrays are now in the last position, and given that the size of the arrays cannot be determined in advance, this patch also sets the size of those arrays to zero and removes the definition of TPM2_ACTIVE_PCR_BANKS.

Roberto Sassu committed 7 years ago

Commit c8faabf1 parent 64494d32 files · +10 −14Browse files

Showing the changes to include/linux (1 of 2 files). Show all

Unified · Split

include/linux/tpm_eventlog.h+4−8
@@ -8,7 +8,6 @@ · 7 unmodified lines
88 #define TCG_EVENT_NAME_LEN_MAX 255
99 #define MAX_TEXT_EVENT 1000 /* Max event string length */
1010 #define ACPI_TCPA_SIG "TCPA" /* 0x41504354 /'TCPA' */
11−#define TPM2_ACTIVE_PCR_BANKS 3
1211
1312 #define EFI_TCG2_EVENT_LOG_FORMAT_TCG_1_2 0x1
1413 #define EFI_TCG2_EVENT_LOG_FORMAT_TCG_2 0x2
@@ -82,7 +81,7 @@ struct tcg_efi_specid_event_algs { · 67 unmodified lines
8281 u16 digest_size;
8382 } __packed;
8483
85−struct tcg_efi_specid_event {
84+struct tcg_efi_specid_event_head {
8685 u8 signature[16];
8786 u32 platform_class;
8887 u8 spec_version_minor;
@@ -90,9 +89,7 @@ struct tcg_efi_specid_event { · 1 unmodified line
9089 u8 spec_errata;
9190 u8 uintnsize;
9291 u32 num_algs;
93− struct tcg_efi_specid_event_algs digest_sizes[TPM2_ACTIVE_PCR_BANKS];
94− u8 vendor_info_size;
95− u8 vendor_info[0];
92+ struct tcg_efi_specid_event_algs digest_sizes[];
9693 } __packed;
9794
9895 struct tcg_pcr_event {
@@ -113,12 +110,11 @@ struct tpm2_digest { · 14 unmodified lines
113110 u8 digest[SHA512_DIGEST_SIZE];
114111 } __packed;
115112
116−struct tcg_pcr_event2 {
113+struct tcg_pcr_event2_head {
117114 u32 pcr_idx;
118115 u32 event_type;
119116 u32 count;
120− struct tpm2_digest digests[TPM2_ACTIVE_PCR_BANKS];
121− struct tcg_event_field event;
117+ struct tpm2_digest digests[];
122118 } __packed;
123119
124120 #endif

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t