Struct capsules_extra::hmac_sha256::HmacSha256Software
source · pub struct HmacSha256Software<'a, S: Sha256 + DigestDataHash<'a, 32>> { /* private fields */ }
Implementations§
Trait Implementations§
source§impl<'a, S: Sha256 + DigestDataHash<'a, 32>> ClientData<32> for HmacSha256Software<'a, S>
impl<'a, S: Sha256 + DigestDataHash<'a, 32>> ClientData<32> for HmacSha256Software<'a, S>
source§fn add_data_done(
&self,
result: Result<(), ErrorCode>,
data: SubSlice<'static, u8>,
)
fn add_data_done( &self, result: Result<(), ErrorCode>, data: SubSlice<'static, u8>, )
Called when the data has been added to the digest.
data
is
the SubSlice
passed in the call to add_data
, whose
active slice contains the data that was not added. On Ok
,
data
has an active slice of size zero (all data was added).
Valid ErrorCode
values are: Read moresource§fn add_mut_data_done(
&self,
result: Result<(), ErrorCode>,
data: SubSliceMut<'static, u8>,
)
fn add_mut_data_done( &self, result: Result<(), ErrorCode>, data: SubSliceMut<'static, u8>, )
Called when the data has been added to the digest.
data
is
the SubSliceMut
passed in the call to
add_mut_data
, whose active slice contains the data that was
not added. On Ok
, data
has an active slice of size zero
(all data was added). Valid ErrorCode
values are: Read moresource§impl<'a, S: Sha256 + DigestDataHash<'a, 32>> ClientHash<32> for HmacSha256Software<'a, S>
impl<'a, S: Sha256 + DigestDataHash<'a, 32>> ClientHash<32> for HmacSha256Software<'a, S>
source§fn hash_done(
&self,
result: Result<(), ErrorCode>,
digest: &'static mut [u8; 32],
)
fn hash_done( &self, result: Result<(), ErrorCode>, digest: &'static mut [u8; 32], )
Called when a digest is computed.
digest
is the same
reference passed to run()
to store the hash value. If
result
is Ok
, digest
stores the computed hash. If
result
is Err
, the data stored in digest
is undefined
and may have any value. Valid ErrorCode
values are: Read moresource§impl<'a, S: Sha256 + DigestDataHash<'a, 32>> ClientVerify<32> for HmacSha256Software<'a, S>
impl<'a, S: Sha256 + DigestDataHash<'a, 32>> ClientVerify<32> for HmacSha256Software<'a, S>
source§fn verification_done(
&self,
_result: Result<bool, ErrorCode>,
_compare: &'static mut [u8; 32],
)
fn verification_done( &self, _result: Result<bool, ErrorCode>, _compare: &'static mut [u8; 32], )
Called when a verification is computed.
compare
is the
reference supplied to verify()
and the data stored in
compare
is unchanged. On Ok
the bool
indicates if the
computed hash matches the value in compare
. Valid
ErrorCode
values are: Read moresource§impl<'a, S: Sha256 + DigestDataHash<'a, 32>> Digest<'a, 32> for HmacSha256Software<'a, S>
impl<'a, S: Sha256 + DigestDataHash<'a, 32>> Digest<'a, 32> for HmacSha256Software<'a, S>
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, S: Sha256 + DigestDataHash<'a, 32>> DigestData<'a, 32> for HmacSha256Software<'a, S>
impl<'a, S: Sha256 + DigestDataHash<'a, 32>> DigestData<'a, 32> for HmacSha256Software<'a, S>
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>)
fn set_data_client(&'a self, _client: &'a dyn ClientData<32>)
Set the client instance which will handle the
add_data_done
and add_mut_data_done
callbacks.source§impl<'a, S: Sha256 + DigestDataHash<'a, 32>> DigestDataHash<'a, 32> for HmacSha256Software<'a, S>
impl<'a, S: Sha256 + DigestDataHash<'a, 32>> DigestDataHash<'a, 32> for HmacSha256Software<'a, S>
source§fn set_client(&'a self, _client: &'a dyn ClientDataHash<32>)
fn set_client(&'a self, _client: &'a dyn ClientDataHash<32>)
Set the client instance which will receive
hash_done()
and
add_data_done()
callbacks.source§impl<'a, S: Sha256 + DigestDataHash<'a, 32>> DigestHash<'a, 32> for HmacSha256Software<'a, S>
impl<'a, S: Sha256 + DigestDataHash<'a, 32>> DigestHash<'a, 32> for HmacSha256Software<'a, S>
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>)
fn set_hash_client(&'a self, _client: &'a dyn ClientHash<32>)
Set the client instance which will receive the
hash_done()
callback.source§impl<'a, S: Sha256 + DigestDataHash<'a, 32>> DigestVerify<'a, 32> for HmacSha256Software<'a, S>
impl<'a, S: Sha256 + DigestDataHash<'a, 32>> DigestVerify<'a, 32> for HmacSha256Software<'a, S>
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>)
fn set_verify_client(&'a self, _client: &'a dyn ClientVerify<32>)
Set the client instance which will receive the
verification_done()
callback.source§impl<'a, S: Sha256 + DigestDataHash<'a, 32>> HmacSha256 for HmacSha256Software<'a, S>
impl<'a, S: Sha256 + DigestDataHash<'a, 32>> HmacSha256 for HmacSha256Software<'a, S>
source§impl<'a, S: Sha256 + DigestDataHash<'a, 32>> HmacSha384 for HmacSha256Software<'a, S>
impl<'a, S: Sha256 + DigestDataHash<'a, 32>> HmacSha384 for HmacSha256Software<'a, S>
source§impl<'a, S: Sha256 + DigestDataHash<'a, 32>> HmacSha512 for HmacSha256Software<'a, S>
impl<'a, S: Sha256 + DigestDataHash<'a, 32>> HmacSha512 for HmacSha256Software<'a, S>
Auto Trait Implementations§
impl<'a, S> !Freeze for HmacSha256Software<'a, S>
impl<'a, S> !RefUnwindSafe for HmacSha256Software<'a, S>
impl<'a, S> !Send for HmacSha256Software<'a, S>
impl<'a, S> !Sync for HmacSha256Software<'a, S>
impl<'a, S> Unpin for HmacSha256Software<'a, S>
impl<'a, S> !UnwindSafe for HmacSha256Software<'a, S>
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