Expand description
§Trusted Platform Module 2.0 (TPM2) Structures and Commands
This base crate provides:
- Definitions of the TPM2 constants and structures.
- Definitions of the TPM2 Commands.
- Common traits for
Marshaling andUnmarshaling.
§Design Goals
This crate defines a low-level interface to any TPM2. The types and commands in this crate can be used to either communicate with an existing TPM2 (i.e., be used in a client) or to implement a TPM2.
Many types in this crate have a direct counterpart in “Part 2: Structures”
of the TPM2 Specification. Types that map 1:1 to the specification have a
Tpm prefix. For example:
- The
TpmtHaenum corresponds to theTPMT_HAtype. - The
TpmiAlgHashC-like enum corresponds to theTPMI_ALG_HASHtype.
Conversely, types or items that either do not map to a type in the spec
(e.g., Marshal or Command) or have semantics differing from those in
the spec (e.g., Alg) will not have a Tpm prefix.
will not have a Tpm prefix.
§Platform Support
Unlike some other crates under the TPM-RS project, this crate is intended
to work on platforms and in environments which lack the Rust Standard
Library or memory allocation. To that end, this crate is #[no_std],
and does not use the std or alloc libraries (only core is used).
§Panics
Furthermore, we strive to avoid panics in this library. While this cannot be statically guaranteed by Rust, we will run tests to ensure that panic code is not emitted, provided sufficient optimizations are enabled.
§Dependencies
To allow this crate to be used in constrained environments (like kernels or
TPM2 implementations), we disallow any runtime dependencies. Also, we
restrict our build-dependencies to a subset necessary to create Procedural
Macros (proc_macro, syn, quote, etc…). We will have more
dev-dependencies for running additional tests, but such additional
dev-dependencies should be gated by opt-in Cargo features.
Re-exports§
pub use commands::Command;
Modules§
Structs§
- Alg
- Algorithms defined by either the
TPM_ALG_IDlisting in Part 2 of the [TPM2 Specification] or theTCG_ALG_IDlist in the TCG Algorithm Registry.
Enums§
- Tpmi
AlgHash TPMI_ALG_HASH- TpmtHa
TPMT_HA
Traits§
- Limits
- Allows an implementation to restrict which values it can
MarshalandUnmarshal. - Marshal
- A type that can be marshalled into a destincation byte buffer
- Marshal
Array - A type that has a consistent size when marshalled
- Unmarshal
- A type that can be unmarshalled from a source byte buffer
- Unmarshal
Array - Similar to
MarshalArraybut for unmarshalling