pub struct Hmac<'a> { /* private fields */ }
Implementations§
Source§impl Hmac<'_>
impl Hmac<'_>
pub fn new(base: StaticRef<HmacRegisters>) -> Self
pub fn handle_interrupt(&self)
Trait Implementations§
Source§impl<'a> Digest<'a, 32> for Hmac<'a>
impl<'a> Digest<'a, 32> for Hmac<'a>
Source§fn set_client(&'a self, client: &'a dyn Client<32>)
fn set_client(&'a self, client: &'a dyn Client<32>)
Set the client instance which will receive
hash_done()
,
add_data_done()
and verification_done()
callbacks.Source§impl<'a> DigestData<'a, 32> for Hmac<'a>
impl<'a> DigestData<'a, 32> for Hmac<'a>
Source§fn add_data(
&self,
data: SubSlice<'static, u8>,
) -> Result<(), (ErrorCode, SubSlice<'static, u8>)>
fn add_data( &self, data: SubSlice<'static, u8>, ) -> Result<(), (ErrorCode, SubSlice<'static, u8>)>
Add data to the input of the hash function/digest.
Ok
indicates all of the active bytes in data
will be added.
There is no guarantee the data has been added to the digest
until the add_data_done()
callback is called. On error the
cause of the error is returned along with the SubSlice
unchanged (it has the same range of active bytes as the call).
Valid ErrorCode
values are: Read moreSource§fn add_mut_data(
&self,
data: SubSliceMut<'static, u8>,
) -> Result<(), (ErrorCode, SubSliceMut<'static, u8>)>
fn add_mut_data( &self, data: SubSliceMut<'static, u8>, ) -> Result<(), (ErrorCode, SubSliceMut<'static, u8>)>
Add data to the input of the hash function/digest.
Ok
indicates all of the active bytes in data
will be added.
There is no guarantee the data has been added to the digest
until the add_mut_data_done()
callback is called. On error
the cause of the error is returned along with the
SubSlice unchanged (it has the same range of active
bytes as the call). Valid ErrorCode
values are: Read moreSource§fn clear_data(&self)
fn clear_data(&self)
Clear the keys and any other internal state. Any pending
operations terminate and issue a callback with an
ErrorCode::CANCEL
. This call does not clear buffers passed
through add_mut_data
, those are up to the client clear.Source§fn set_data_client(&'a self, _client: &'a (dyn ClientData<32> + 'a))
fn set_data_client(&'a self, _client: &'a (dyn ClientData<32> + 'a))
Set the client instance which will handle the
add_data_done
and add_mut_data_done
callbacks.Source§impl<'a> DigestHash<'a, 32> for Hmac<'a>
impl<'a> DigestHash<'a, 32> for Hmac<'a>
Source§fn run(
&'a self,
digest: &'static mut [u8; 32],
) -> Result<(), (ErrorCode, &'static mut [u8; 32])>
fn run( &'a self, digest: &'static mut [u8; 32], ) -> Result<(), (ErrorCode, &'static mut [u8; 32])>
Compute a digest of all of the data added with
add_data
and
add_data_mut
, storing the computed value in digest
. The
computed value is returned in a hash_done
callback. On
error the return value will contain a return code and the
slice passed in digest
. Valid ErrorCode
values are: Read moreSource§fn set_hash_client(&'a self, _client: &'a (dyn ClientHash<32> + 'a))
fn set_hash_client(&'a self, _client: &'a (dyn ClientHash<32> + 'a))
Set the client instance which will receive the
hash_done()
callback.Source§impl<'a> DigestVerify<'a, 32> for Hmac<'a>
impl<'a> DigestVerify<'a, 32> for Hmac<'a>
Source§fn verify(
&'a self,
compare: &'static mut [u8; 32],
) -> Result<(), (ErrorCode, &'static mut [u8; 32])>
fn verify( &'a self, compare: &'static mut [u8; 32], ) -> Result<(), (ErrorCode, &'static mut [u8; 32])>
Compute a digest of all of the data added with
add_data
and
add_data_mut
then compare it with value in compare
. The
compare value is returned in a verification_done
callback, along with
a boolean indicating whether it matches the computed value. On
error the return value will contain a return code and the
slice passed in compare
. Valid ErrorCode
values are: Read moreSource§fn set_verify_client(&'a self, _client: &'a (dyn ClientVerify<32> + 'a))
fn set_verify_client(&'a self, _client: &'a (dyn ClientVerify<32> + 'a))
Set the client instance which will receive the
verification_done()
callback.Source§impl HmacSha256 for Hmac<'_>
impl HmacSha256 for Hmac<'_>
Source§impl HmacSha384 for Hmac<'_>
impl HmacSha384 for Hmac<'_>
Source§impl HmacSha512 for Hmac<'_>
impl HmacSha512 for Hmac<'_>
Auto Trait Implementations§
impl<'a> !Freeze for Hmac<'a>
impl<'a> !RefUnwindSafe for Hmac<'a>
impl<'a> !Send for Hmac<'a>
impl<'a> !Sync for Hmac<'a>
impl<'a> Unpin for Hmac<'a>
impl<'a> !UnwindSafe for Hmac<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more