Skip to main content

Crate tpm2

Crate tpm2 

Source
Expand description

§Trusted Platform Module 2.0 (TPM2) Structures and Commands

This base crate provides:

§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 TpmtHa enum corresponds to the TPMT_HA type.
  • The TpmiAlgHash C-like enum corresponds to the TPMI_ALG_HASH type.

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§

commands
TPM2 Commands and Responses
errors
Errors used thoughout this base crate.

Structs§

Alg
Algorithms defined by either the TPM_ALG_ID listing in Part 2 of the [TPM2 Specification] or the TCG_ALG_ID list in the TCG Algorithm Registry.

Enums§

TpmiAlgHash
TPMI_ALG_HASH
TpmtHa
TPMT_HA

Traits§

Limits
Allows an implementation to restrict which values it can Marshal and Unmarshal.
Marshal
A type that can be marshalled into a destincation byte buffer
MarshalArray
A type that has a consistent size when marshalled
Unmarshal
A type that can be unmarshalled from a source byte buffer
UnmarshalArray
Similar to MarshalArray but for unmarshalling

Type Aliases§

Tpm2bDigest