Struct tpm2::Simulator

source ·
pub struct Simulator {
    pub(crate) _priv: (),
}
Expand description

A libtpm2-based TPM simulator.

At most one simulator may exist per process because libtpm2 uses a static global response buffer.

Examples

let mut simulator = tpm2::Simulator::singleton_in_current_directory();

let command = &[ /* ... */ ];
let response = simulator.execute_command(command);
println!("{:?}", response);

Fields§

§_priv: ()

Implementations§

Initializes a TPM simulator in the current working directory.

Panics

Panics if a TPM simulator has already been initialized by this process.

Sends a TPM command to the TPM simulator, waits for the work to be performed, and receives back the TPM response.

Executing a command requires exclusive access to the TPM simulator because it mutates libtpm2 static state.

The returned response buffer remains valid until the next TPM command is executed.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.