1 | // Providing docstrings for each constant would be a lot of work, so |
2 | // allow missing docs. Each type-level doc links to the relevant spec to |
3 | // provide more info. |
4 | // |
5 | // Setting this at the module level so that we don't have to write it |
6 | // above each constant. That's also why these enums are in a separate |
7 | // module instead of `super`, since we don't want to allow missing docs |
8 | // too broadly. |
9 | #![allow (missing_docs)] |
10 | |
11 | newtype_enum! { |
12 | /// Algorithm identifiers. |
13 | /// |
14 | /// These values are defined in the [TCG Algorithm Registry]. |
15 | /// |
16 | /// [TCG Algorithm Registry]: https://trustedcomputinggroup.org/resource/tcg-algorithm-registry/ |
17 | pub enum AlgorithmId: u16 => { |
18 | ERROR = 0x0000, |
19 | RSA = 0x0001, |
20 | TDES = 0x0003, |
21 | SHA1 = 0x0004, |
22 | HMAC = 0x0005, |
23 | AES = 0x0006, |
24 | MGF1 = 0x0007, |
25 | KEYED_HASH = 0x0008, |
26 | XOR = 0x000a, |
27 | SHA256 = 0x000b, |
28 | SHA384 = 0x000c, |
29 | SHA512 = 0x000d, |
30 | NULL = 0x0010, |
31 | SM3_256 = 0x0012, |
32 | SM4 = 0x0013, |
33 | // TODO: there are a bunch more, but the above list is probably |
34 | // more than sufficient for real devices. |
35 | } |
36 | } |
37 | |
38 | newtype_enum! { |
39 | /// Event types stored in the TPM event log. The event type defines |
40 | /// which structure type is stored in the event data. |
41 | /// |
42 | /// For details of each variant, see the [TCG PC Client Platform |
43 | /// Firmware Protocol Specification][spec], in particular the Events |
44 | /// table in the Event Logging chapter. |
45 | /// |
46 | /// [spec]: https://trustedcomputinggroup.org/resource/pc-client-specific-platform-firmware-profile-specification/ |
47 | pub enum EventType: u32 => { |
48 | PREBOOT_CERT = 0x0000_0000, |
49 | POST_CODE = 0x0000_0001, |
50 | UNUSED = 0x0000_0002, |
51 | NO_ACTION = 0x0000_0003, |
52 | SEPARATOR = 0x0000_0004, |
53 | ACTION = 0x0000_0005, |
54 | EVENT_TAG = 0x0000_0006, |
55 | CRTM_CONTENTS = 0x0000_0007, |
56 | CRTM_VERSION = 0x0000_0008, |
57 | CPU_MICROCODE = 0x0000_0009, |
58 | PLATFORM_CONFIG_FLAGS = 0x0000_000a, |
59 | TABLE_OF_DEVICES = 0x0000_000b, |
60 | COMPACT_HASH = 0x0000_000c, |
61 | IPL = 0x0000_000d, |
62 | IPL_PARTITION_DATA = 0x0000_000e, |
63 | NONHOST_CODE = 0x0000_000f, |
64 | NONHOST_CONFIG = 0x0000_0010, |
65 | NONHOST_INFO = 0x0000_0011, |
66 | OMIT_BOOT_DEVICE_EVENTS = 0x0000_0012, |
67 | EFI_EVENT_BASE = 0x8000_0000, |
68 | EFI_VARIABLE_DRIVER_CONFIG = 0x8000_0001, |
69 | EFI_VARIABLE_BOOT = 0x8000_0002, |
70 | EFI_BOOT_SERVICES_APPLICATION = 0x8000_0003, |
71 | EFI_BOOT_SERVICES_DRIVER = 0x8000_0004, |
72 | EFI_RUNTIME_SERVICES_DRIVER = 0x8000_0005, |
73 | EFI_GPT_EVENT = 0x8000_0006, |
74 | EFI_ACTION = 0x8000_0007, |
75 | EFI_PLATFORM_FIRMWARE_BLOB = 0x8000_0008, |
76 | EFI_HANDOFF_TABLES = 0x8000_0009, |
77 | EFI_PLATFORM_FIRMWARE_BLOB2 = 0x8000_000a, |
78 | EFI_HANDOFF_TABLES2 = 0x8000_000b, |
79 | EFI_VARIABLE_BOOT2 = 0x8000_000c, |
80 | EFI_HCRTM_EVENT = 0x8000_0010, |
81 | EFI_VARIABLE_AUTHORITY = 0x8000_00e0, |
82 | EFI_SPDM_FIRMWARE_BLOB = 0x8000_00e1, |
83 | EFI_SPDM_FIRMWARE_CONFIG = 0x8000_00e2, |
84 | } |
85 | } |
86 | |