afs: Fix whole-volume callback handling
[sfrench/cifs-2.6.git] / include / linux / tpm_eventlog.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2
3 #ifndef __LINUX_TPM_EVENTLOG_H__
4 #define __LINUX_TPM_EVENTLOG_H__
5
6 #include <crypto/hash_info.h>
7
8 #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' */
11 #define TPM2_ACTIVE_PCR_BANKS   3
12
13 #define EFI_TCG2_EVENT_LOG_FORMAT_TCG_1_2 0x1
14 #define EFI_TCG2_EVENT_LOG_FORMAT_TCG_2   0x2
15
16 #ifdef CONFIG_PPC64
17 #define do_endian_conversion(x) be32_to_cpu(x)
18 #else
19 #define do_endian_conversion(x) x
20 #endif
21
22 enum bios_platform_class {
23         BIOS_CLIENT = 0x00,
24         BIOS_SERVER = 0x01,
25 };
26
27 struct tcpa_event {
28         u32 pcr_index;
29         u32 event_type;
30         u8 pcr_value[20];       /* SHA1 */
31         u32 event_size;
32         u8 event_data[0];
33 };
34
35 enum tcpa_event_types {
36         PREBOOT = 0,
37         POST_CODE,
38         UNUSED,
39         NO_ACTION,
40         SEPARATOR,
41         ACTION,
42         EVENT_TAG,
43         SCRTM_CONTENTS,
44         SCRTM_VERSION,
45         CPU_MICROCODE,
46         PLATFORM_CONFIG_FLAGS,
47         TABLE_OF_DEVICES,
48         COMPACT_HASH,
49         IPL,
50         IPL_PARTITION_DATA,
51         NONHOST_CODE,
52         NONHOST_CONFIG,
53         NONHOST_INFO,
54 };
55
56 struct tcpa_pc_event {
57         u32 event_id;
58         u32 event_size;
59         u8 event_data[0];
60 };
61
62 enum tcpa_pc_event_ids {
63         SMBIOS = 1,
64         BIS_CERT,
65         POST_BIOS_ROM,
66         ESCD,
67         CMOS,
68         NVRAM,
69         OPTION_ROM_EXEC,
70         OPTION_ROM_CONFIG,
71         OPTION_ROM_MICROCODE = 10,
72         S_CRTM_VERSION,
73         S_CRTM_CONTENTS,
74         POST_CONTENTS,
75         HOST_TABLE_OF_DEVICES,
76 };
77
78 /* http://www.trustedcomputinggroup.org/tcg-efi-protocol-specification/ */
79
80 struct tcg_efi_specid_event_algs {
81         u16 alg_id;
82         u16 digest_size;
83 } __packed;
84
85 struct tcg_efi_specid_event {
86         u8 signature[16];
87         u32 platform_class;
88         u8 spec_version_minor;
89         u8 spec_version_major;
90         u8 spec_errata;
91         u8 uintnsize;
92         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];
96 } __packed;
97
98 struct tcg_pcr_event {
99         u32 pcr_idx;
100         u32 event_type;
101         u8 digest[20];
102         u32 event_size;
103         u8 event[0];
104 } __packed;
105
106 struct tcg_event_field {
107         u32 event_size;
108         u8 event[0];
109 } __packed;
110
111 struct tpm2_digest {
112         u16 alg_id;
113         u8 digest[SHA512_DIGEST_SIZE];
114 } __packed;
115
116 struct tcg_pcr_event2 {
117         u32 pcr_idx;
118         u32 event_type;
119         u32 count;
120         struct tpm2_digest digests[TPM2_ACTIVE_PCR_BANKS];
121         struct tcg_event_field event;
122 } __packed;
123
124 #endif