Trait kernel::hil::digest::ClientHash
source · pub trait ClientHash<const L: usize> {
// Required method
fn hash_done(
&self,
result: Result<(), ErrorCode>,
digest: &'static mut [u8; L],
);
}
Expand description
Implement this trait and use set_client()
in order to receive callbacks when
a digest is completed.
‘L’ is the length of the ‘u8’ array to store the digest output.
Required Methods§
sourcefn hash_done(&self, result: Result<(), ErrorCode>, digest: &'static mut [u8; L])
fn hash_done(&self, result: Result<(), ErrorCode>, digest: &'static mut [u8; L])
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:
- OFF: the underlying digest engine is powered down and cannot be used.
- BUSY: there is an outstanding
add_data
,add_data_mut
,run
, orverify
operation, so the digest engine is busy and cannot perform a hash. - CANCEL: the operation was cancelled by a call to
clear_data
. - NOSUPPORT: the requested digest algorithm is not supported, or one was not requested.
- FAIL: an internal failure.