pub struct Tpm2bAttestWire(/* private fields */);Implementations§
Source§impl Tpm2bAttestWire
impl Tpm2bAttestWire
Sourcepub fn cast(buf: &[u8]) -> TpmResult<&Self>where
TpmsAttest: for<'a> TpmField<'a>,
pub fn cast(buf: &[u8]) -> TpmResult<&Self>where
TpmsAttest: for<'a> TpmField<'a>,
Casts bytes into a typed TPM2B wire view.
§Errors
Returns Err(TpmError) when buf is not exactly one valid TPM2B
wrapper for the inner type.
Sourcepub fn cast_prefix(buf: &[u8]) -> TpmResult<(&Self, &[u8])>where
TpmsAttest: for<'a> TpmField<'a>,
pub fn cast_prefix(buf: &[u8]) -> TpmResult<(&Self, &[u8])>where
TpmsAttest: for<'a> TpmField<'a>,
Casts the first TPM2B wire view from buf and returns the remainder.
§Errors
Returns Err(TpmError) when buf does not start with a valid TPM2B
wrapper for the inner type.
Sourcepub unsafe fn cast_unchecked(buf: &[u8]) -> &Self
pub unsafe fn cast_unchecked(buf: &[u8]) -> &Self
Casts bytes into a typed TPM2B wire view without validation.
§Safety
The caller must ensure buf is exactly one valid TPM2B wrapper for
the inner type.
Sourcepub fn inner(&self) -> TpmResult<<TpmsAttest as TpmField<'_>>::View>where
TpmsAttest: for<'a> TpmField<'a>,
pub fn inner(&self) -> TpmResult<<TpmsAttest as TpmField<'_>>::View>where
TpmsAttest: for<'a> TpmField<'a>,
Returns the borrowed inner structure view.
§Errors
Returns Err(TpmError) when the TPM2B payload is not exactly one
valid inner structure.
Sourcepub fn validate(buf: &[u8]) -> TpmResult<()>where
TpmsAttest: for<'a> TpmField<'a>,
pub fn validate(buf: &[u8]) -> TpmResult<()>where
TpmsAttest: for<'a> TpmField<'a>,
Validates an exact typed TPM2B wire view.
§Errors
Returns Err(TpmError) when buf is not exactly one valid TPM2B
wrapper for the inner type.
Sourcepub fn validate_prefix(buf: &[u8]) -> TpmResult<usize>where
TpmsAttest: for<'a> TpmField<'a>,
pub fn validate_prefix(buf: &[u8]) -> TpmResult<usize>where
TpmsAttest: for<'a> TpmField<'a>,
Validates a typed TPM2B wire view prefix.
§Errors
Returns Err(TpmError) when buf does not start with a valid TPM2B
wrapper for the inner type.