Skip to main content

uefi_raw/protocol/tcg/
enums.rs

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