aienux
Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.
Brought by drakestapleton
aienux / vendor / uefi / src / proto / tcg / mod.rs
| 1 | // SPDX-License-Identifier: MIT OR Apache-2.0 |
| 2 | |
| 3 | //! [TCG] (Trusted Computing Group) protocols. |
| 4 | //! |
| 5 | //! These protocols provide access to the [TPM][tpm] (Trusted Platform Module). |
| 6 | //! |
| 7 | //! There are two versions of the protocol. The original protocol is in |
| 8 | //! the [`v1`] module. It is used with TPM 1.1 and 1.2 devices. The |
| 9 | //! newer protocol in the [`v2`] module is generally provided for TPM |
| 10 | //! 2.0 devices, although the spec indicates it can be used for older |
| 11 | //! TPM versions as well. |
| 12 | //! |
| 13 | //! [TCG]: https://trustedcomputinggroup.org/ |
| 14 | //! [TPM]: https://en.wikipedia.org/wiki/Trusted_Platform_Module |
| 15 | |
| 16 | pub mod v1; |
| 17 | pub mod v2; |
| 18 | |
| 19 | pub use uefi_raw::protocol::tcg::{AlgorithmId, EventType}; |
| 20 | |
| 21 | use bitflags::bitflags; |
| 22 | |
| 23 | /// Platform Configuration Register (PCR) index. |
| 24 | #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] |
| 25 | #[repr(transparent)] |
| 26 | pub struct PcrIndex(pub u32); |
| 27 | |
| 28 | bitflags! { |
| 29 | /// Hash algorithms the protocol can provide. |
| 30 | /// |
| 31 | /// The [`v1`] protocol only supports SHA1. |
| 32 | #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord)] |
| 33 | #[repr(transparent)] |
| 34 | pub struct HashAlgorithm: u32 { |
| 35 | /// SHA-1 hash. |
| 36 | const SHA1 = 0x0000_0001; |
| 37 | |
| 38 | /// SHA-256 hash. |
| 39 | const SHA256 = 0x0000_0002; |
| 40 | |
| 41 | /// SHA-384 hash. |
| 42 | const SHA384 = 0x0000_0004; |
| 43 | |
| 44 | /// SHA-512 hash. |
| 45 | const SHA512 = 0x0000_0008; |
| 46 | |
| 47 | /// SM3-256 hash. |
| 48 | const SM3_256 = 0x0000_0010; |
| 49 | } |
| 50 | } |