pub trait ClientHash<const DIGEST_LEN: usize> {
// Required method
fn hash_done(
&self,
result: Result<(), ErrorCode>,
digest: &'static mut [u8; DIGEST_LEN],
);
}Expand description
Implement this trait and use set_client() in order to receive callbacks when
a digest is completed.
‘DIGEST_LEN’ 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; DIGEST_LEN],
)
fn hash_done( &self, result: Result<(), ErrorCode>, digest: &'static mut [u8; DIGEST_LEN], )
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, orverifyoperation, 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.