blob: a2a86783f974b1e449e53929387df2a24e9ddf2c [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Kent Yodere5dcd872012-07-11 10:08:12 -05002
Thiebaud Weksteenfd3ec362017-09-20 10:13:36 +02003#ifndef __LINUX_TPM_EVENTLOG_H__
4#define __LINUX_TPM_EVENTLOG_H__
Kent Yodere5dcd872012-07-11 10:08:12 -05005
Nayna Jain4d23cc32017-01-23 02:26:27 -05006#include <crypto/hash_info.h>
7
Kent Yodere5dcd872012-07-11 10:08:12 -05008#define TCG_EVENT_NAME_LEN_MAX 255
9#define MAX_TEXT_EVENT 1000 /* Max event string length */
10#define ACPI_TCPA_SIG "TCPA" /* 0x41504354 /'TCPA' */
Nayna Jain4d23cc32017-01-23 02:26:27 -050011#define TPM2_ACTIVE_PCR_BANKS 3
Kent Yodere5dcd872012-07-11 10:08:12 -050012
Hon Ching \(Vicky\) Lo0cc698a2015-06-17 18:17:08 -040013#ifdef CONFIG_PPC64
14#define do_endian_conversion(x) be32_to_cpu(x)
15#else
16#define do_endian_conversion(x) x
17#endif
18
Kent Yodere5dcd872012-07-11 10:08:12 -050019enum bios_platform_class {
20 BIOS_CLIENT = 0x00,
21 BIOS_SERVER = 0x01,
22};
23
Kent Yodere5dcd872012-07-11 10:08:12 -050024struct tcpa_event {
25 u32 pcr_index;
26 u32 event_type;
27 u8 pcr_value[20]; /* SHA1 */
28 u32 event_size;
29 u8 event_data[0];
30};
31
32enum tcpa_event_types {
33 PREBOOT = 0,
34 POST_CODE,
35 UNUSED,
36 NO_ACTION,
37 SEPARATOR,
38 ACTION,
39 EVENT_TAG,
40 SCRTM_CONTENTS,
41 SCRTM_VERSION,
42 CPU_MICROCODE,
43 PLATFORM_CONFIG_FLAGS,
44 TABLE_OF_DEVICES,
45 COMPACT_HASH,
46 IPL,
47 IPL_PARTITION_DATA,
48 NONHOST_CODE,
49 NONHOST_CONFIG,
50 NONHOST_INFO,
51};
52
53struct tcpa_pc_event {
54 u32 event_id;
55 u32 event_size;
56 u8 event_data[0];
57};
58
59enum tcpa_pc_event_ids {
60 SMBIOS = 1,
61 BIS_CERT,
62 POST_BIOS_ROM,
63 ESCD,
64 CMOS,
65 NVRAM,
66 OPTION_ROM_EXEC,
67 OPTION_ROM_CONFIG,
68 OPTION_ROM_MICROCODE = 10,
69 S_CRTM_VERSION,
70 S_CRTM_CONTENTS,
71 POST_CONTENTS,
72 HOST_TABLE_OF_DEVICES,
73};
74
Nayna Jain4d23cc32017-01-23 02:26:27 -050075/* http://www.trustedcomputinggroup.org/tcg-efi-protocol-specification/ */
76
77struct tcg_efi_specid_event_algs {
78 u16 alg_id;
79 u16 digest_size;
80} __packed;
81
82struct tcg_efi_specid_event {
83 u8 signature[16];
84 u32 platform_class;
85 u8 spec_version_minor;
86 u8 spec_version_major;
87 u8 spec_errata;
88 u8 uintnsize;
89 u32 num_algs;
90 struct tcg_efi_specid_event_algs digest_sizes[TPM2_ACTIVE_PCR_BANKS];
91 u8 vendor_info_size;
92 u8 vendor_info[0];
93} __packed;
94
95struct tcg_pcr_event {
96 u32 pcr_idx;
97 u32 event_type;
98 u8 digest[20];
99 u32 event_size;
100 u8 event[0];
101} __packed;
102
103struct tcg_event_field {
104 u32 event_size;
105 u8 event[0];
106} __packed;
107
Thiebaud Weksteenfd3ec362017-09-20 10:13:36 +0200108struct tpm2_digest {
109 u16 alg_id;
110 u8 digest[SHA512_DIGEST_SIZE];
111} __packed;
112
Nayna Jain4d23cc32017-01-23 02:26:27 -0500113struct tcg_pcr_event2 {
114 u32 pcr_idx;
115 u32 event_type;
116 u32 count;
117 struct tpm2_digest digests[TPM2_ACTIVE_PCR_BANKS];
118 struct tcg_event_field event;
119} __packed;
120
Kent Yodere5dcd872012-07-11 10:08:12 -0500121#endif