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
8#define TCG_EVENT_NAME_LEN_MAX 2558#define TCG_EVENT_NAME_LEN_MAX 255
9#define MAX_TEXT_EVENT 1000 /* Max event string length */9#define MAX_TEXT_EVENT 1000 /* Max event string length */
10#define ACPI_TCPA_SIG "TCPA" /* 0x41504354 /'TCPA' */10#define ACPI_TCPA_SIG "TCPA" /* 0x41504354 /'TCPA' */
11#define TPM2_ACTIVE_PCR_BANKS 3
12 11
13#define EFI_TCG2_EVENT_LOG_FORMAT_TCG_1_2 0x112#define EFI_TCG2_EVENT_LOG_FORMAT_TCG_1_2 0x1
14#define EFI_TCG2_EVENT_LOG_FORMAT_TCG_2 0x213#define EFI_TCG2_EVENT_LOG_FORMAT_TCG_2 0x2
@@ -82,7 +81,7 @@ struct tcg_efi_specid_event_algs { · 67 unmodified lines
82 u16 digest_size;81 u16 digest_size;
83} __packed;82} __packed;
84 83
85struct tcg_efi_specid_event {84struct tcg_efi_specid_event_head {
86 u8 signature[16];85 u8 signature[16];
87 u32 platform_class;86 u32 platform_class;
88 u8 spec_version_minor;87 u8 spec_version_minor;
@@ -90,9 +89,7 @@ struct tcg_efi_specid_event { · 1 unmodified line
90 u8 spec_errata;89 u8 spec_errata;
91 u8 uintnsize;90 u8 uintnsize;
92 u32 num_algs;91 u32 num_algs;
93 struct tcg_efi_specid_event_algs digest_sizes[TPM2_ACTIVE_PCR_BANKS];92 struct tcg_efi_specid_event_algs digest_sizes[];
94 u8 vendor_info_size;
95 u8 vendor_info[0];
96} __packed;93} __packed;
97 94
98struct tcg_pcr_event {95struct tcg_pcr_event {
@@ -113,12 +110,11 @@ struct tpm2_digest { · 14 unmodified lines
113 u8 digest[SHA512_DIGEST_SIZE];110 u8 digest[SHA512_DIGEST_SIZE];
114} __packed;111} __packed;
115 112
116struct tcg_pcr_event2 {113struct tcg_pcr_event2_head {
117 u32 pcr_idx;114 u32 pcr_idx;
118 u32 event_type;115 u32 event_type;
119 u32 count;116 u32 count;
120 struct tpm2_digest digests[TPM2_ACTIVE_PCR_BANKS];117 struct tpm2_digest digests[];
121 struct tcg_event_field event;
122} __packed;118} __packed;
123 119
124#endif120#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