TpmDevice

Struct TpmDevice 

Source
pub struct TpmDevice { /* private fields */ }

Implementations§

Source§

impl TpmDevice

Source

pub fn builder() -> TpmDeviceBuilder

Creates a new builder for TpmDevice.

Source

pub fn transmit<C: TpmFrame>( &mut self, command: &C, sessions: &[TpmsAuthCommand], ) -> Result<(TpmResponse, TpmAuthResponses), TpmDeviceError>

Performs the whole TPM command transmission process.

§Errors

Returns Interrupted when the interrupt callback requests cancellation. Returns Io when a write, flush, or read operation on the device file fails, or when polling the device file descriptor fails. Returns Marshal when marshal operation on TPM protocol compliant data fails. Returns Timeout when the TPM does not respond within the configured timeout. Returns TpmRc when the TPM returns an error code. Returns Unmarshal when unmarshal operation on TPM protocol compliant data fails.

Source

pub fn fetch_algorithm_properties( &mut self, ) -> Result<Vec<TpmsAlgProperty>, TpmDeviceError>

Retrieves all algorithm properties supported by the TPM.

§Errors

Returns ResponseMismatch when receiving unepected TPM response. Returns other TpmDeviceError variants when TpmDevice::transmit fails.

Source

pub fn fetch_handles( &mut self, class: TpmHt, ) -> Result<Vec<TpmHandle>, TpmDeviceError>

Retrieves all handles of a specific type from the TPM.

§Errors

Returns ResponseMismatch when receiving unepected TPM response. Returns other TpmDeviceError variants when TpmDevice::transmit fails.

Source

pub fn fetch_ecc_curves(&mut self) -> Result<Vec<TpmEccCurve>, TpmDeviceError>

Retrieves all available ECC curves supported by the TPM.

§Errors

Returns ResponseMismatch when receiving unepected TPM response. Returns other TpmDeviceError variants when TpmDevice::transmit fails.

Source

pub fn fetch_pcr_bank_list( &mut self, ) -> Result<(Vec<TpmAlgId>, TpmsPcrSelect), TpmDeviceError>

Retrieves the list of active PCR banks and the bank selection mask.

§Errors

Returns PcrBanksNotAvailable when no PCR banks are available. Return PcrBankSelectionMismatch when the PCR selection masks differ between active banks. Returns ResponseMismatch when receiving unepected TPM response. Returns other TpmDeviceError variants when TpmDevice::transmit fails.

Source

pub fn get_tpm_property( &mut self, property: TpmPt, ) -> Result<TpmUint32, TpmDeviceError>

Reads a specific TPM property.

§Errors

Returns ResponseMismatch when receiving unepected TPM response. Returns other TpmDeviceError variants when TpmDevice::transmit fails.

Source

pub fn read_public( &mut self, handle: TpmHandle, ) -> Result<(TpmtPublic, Tpm2bName), TpmDeviceError>

Reads the public area of a TPM object.

§Errors

Returns ResponseMismatch when receiving unepected TPM response. Returns other TpmDeviceError variants when TpmDevice::transmit fails.

Source

pub fn find_persistent( &mut self, target_name: &Tpm2bName, ) -> Result<Option<TpmHandle>, TpmDeviceError>

Finds a persistent handle by its Tpm2bName.

§Errors

Returns ResponseMismatch when receiving unepected TPM response. Returns other TpmDeviceError variants when TpmDevice::transmit fails.

Source

pub fn save_context( &mut self, save_handle: TpmHandle, ) -> Result<TpmsContext, TpmDeviceError>

Saves the context of a transient object or session.

§Errors

Returns ResponseMismatch when receiving unepected TPM response. Returns other TpmDeviceError variants when TpmDevice::transmit fails.

Source

pub fn load_context( &mut self, context: TpmsContext, ) -> Result<TpmHandle, TpmDeviceError>

Loads a TPM context and returns the handle.

§Errors

Returns ResponseMismatch when receiving unepected TPM response. Returns other TpmDeviceError variants when TpmDevice::transmit fails.

Source

pub fn flush_context(&mut self, handle: TpmHandle) -> Result<(), TpmDeviceError>

Flushes a transient object or session from the TPM and removes it from the cache.

§Errors

Returns TpmDeviceError variants when TpmDevice::transmit fails.

Source

pub fn flush_session( &mut self, context: TpmsContext, ) -> Result<(), TpmDeviceError>

Loads a session context and then flushes the resulting handle.

§Errors

Returns TpmDeviceError variants when TpmDevice::transmit fails.

Trait Implementations§

Source§

impl Debug for TpmDevice

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more