pub struct TpmCommand(/* private fields */);Expand description
A zero-copy TPM command wire view over caller-owned bytes.
Implementations§
Source§impl TpmCommand
impl TpmCommand
Sourcepub fn cast(buf: &[u8]) -> TpmResult<&Self>
pub fn cast(buf: &[u8]) -> TpmResult<&Self>
Casts a byte slice into a TPM command wire view.
§Errors
Returns Err(TpmError) when the command envelope is malformed.
Sourcepub fn cast_prefix(buf: &[u8]) -> TpmResult<(&Self, &[u8])>
pub fn cast_prefix(buf: &[u8]) -> TpmResult<(&Self, &[u8])>
Casts the first TPM command frame in a byte slice into a wire view.
§Errors
Returns Err(TpmError) when the command envelope is malformed or
incomplete.
Sourcepub unsafe fn cast_unchecked(buf: &[u8]) -> &Self
pub unsafe fn cast_unchecked(buf: &[u8]) -> &Self
Casts a byte slice into a TPM command wire view without validation.
§Safety
The caller must ensure that buf contains exactly one complete TPM
command frame with a valid command code and handle area layout.
Sourcepub fn cast_mut(buf: &mut [u8]) -> TpmResult<&mut Self>
pub fn cast_mut(buf: &mut [u8]) -> TpmResult<&mut Self>
Casts a mutable byte slice into a mutable TPM command wire view.
§Errors
Returns Err(TpmError) when the command envelope is malformed.
Sourcepub fn cast_prefix_mut(buf: &mut [u8]) -> TpmResult<(&mut Self, &mut [u8])>
pub fn cast_prefix_mut(buf: &mut [u8]) -> TpmResult<(&mut Self, &mut [u8])>
Casts the first mutable TPM command frame in a byte slice into a wire view.
§Errors
Returns Err(TpmError) when the command envelope is malformed or
incomplete.
Sourcepub unsafe fn cast_mut_unchecked(buf: &mut [u8]) -> &mut Self
pub unsafe fn cast_mut_unchecked(buf: &mut [u8]) -> &mut Self
Casts a mutable byte slice into a mutable TPM command wire view without validation.
§Safety
The caller must ensure that buf contains exactly one complete TPM
command frame with a valid command code and handle area layout. The
returned reference inherits the exclusive access represented by buf.
Sourcepub fn as_bytes_mut(&mut self) -> &mut [u8]
pub fn as_bytes_mut(&mut self) -> &mut [u8]
Returns the mutable command frame bytes.
Sourcepub fn handles(&self) -> TpmResult<&[u8]>
pub fn handles(&self) -> TpmResult<&[u8]>
Returns the command handle area bytes.
§Errors
Returns Err(TpmError) when the command envelope is malformed.
Sourcepub fn handles_mut(&mut self) -> TpmResult<&mut [u8]>
pub fn handles_mut(&mut self) -> TpmResult<&mut [u8]>
Returns the mutable command handle area bytes.
§Errors
Returns Err(TpmError) when the command envelope is malformed.
Sourcepub fn auth_area(&self) -> TpmResult<&[u8]>
pub fn auth_area(&self) -> TpmResult<&[u8]>
Returns the command authorization area bytes.
§Errors
Returns Err(TpmError) when the command has no sessions or its
authorization area is malformed.
Sourcepub fn auth_area_mut(&mut self) -> TpmResult<&mut [u8]>
pub fn auth_area_mut(&mut self) -> TpmResult<&mut [u8]>
Returns the mutable command authorization area bytes.
§Errors
Returns Err(TpmError) when the command has no sessions or its
authorization area is malformed.
Sourcepub fn parameters(&self) -> TpmResult<&[u8]>
pub fn parameters(&self) -> TpmResult<&[u8]>
Returns the command parameter area bytes.
§Errors
Returns Err(TpmError) when the command envelope is malformed.
Sourcepub fn parameters_mut(&mut self) -> TpmResult<&mut [u8]>
pub fn parameters_mut(&mut self) -> TpmResult<&mut [u8]>
Returns the mutable command parameter area bytes.
§Errors
Returns Err(TpmError) when the command envelope is malformed.