pub struct TpmDevice { /* private fields */ }Implementations§
Source§impl TpmDevice
impl TpmDevice
Sourcepub fn builder() -> TpmDeviceBuilder
pub fn builder() -> TpmDeviceBuilder
Creates a new builder for TpmDevice.
Sourcepub fn transmit<C: TpmFrame>(
&mut self,
command: &C,
sessions: &[TpmsAuthCommand],
) -> Result<(TpmResponse, TpmAuthResponses), TpmDeviceError>
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.
Sourcepub fn fetch_algorithm_properties(
&mut self,
) -> Result<Vec<TpmsAlgProperty>, TpmDeviceError>
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.
Sourcepub fn fetch_handles(
&mut self,
class: TpmHt,
) -> Result<Vec<TpmHandle>, TpmDeviceError>
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.
Sourcepub fn fetch_ecc_curves(&mut self) -> Result<Vec<TpmEccCurve>, TpmDeviceError>
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.
Sourcepub fn fetch_pcr_bank_list(
&mut self,
) -> Result<(Vec<TpmAlgId>, TpmsPcrSelect), TpmDeviceError>
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.
Sourcepub fn get_tpm_property(
&mut self,
property: TpmPt,
) -> Result<TpmUint32, TpmDeviceError>
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.
Sourcepub fn read_public(
&mut self,
handle: TpmHandle,
) -> Result<(TpmtPublic, Tpm2bName), TpmDeviceError>
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.
Sourcepub fn find_persistent(
&mut self,
target_name: &Tpm2bName,
) -> Result<Option<TpmHandle>, TpmDeviceError>
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.
Sourcepub fn save_context(
&mut self,
save_handle: TpmHandle,
) -> Result<TpmsContext, TpmDeviceError>
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.
Sourcepub fn load_context(
&mut self,
context: TpmsContext,
) -> Result<TpmHandle, TpmDeviceError>
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.
Sourcepub fn flush_context(&mut self, handle: TpmHandle) -> Result<(), TpmDeviceError>
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.
Sourcepub fn flush_session(
&mut self,
context: TpmsContext,
) -> Result<(), TpmDeviceError>
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.