pub trait DigestVerify<'a, const L: usize> {
    // Required methods
    fn set_verify_client(&'a self, client: &'a dyn ClientVerify<L>);
    fn verify(
        &'a self,
        compare: &'static mut [u8; L]
    ) -> Result<(), (ErrorCode, &'static mut [u8; L])>;
}
Expand description

Verifies a digest (cryptographic hash) over data provided through a separate trait

‘L’ is the length of the ‘u8’ array to store the digest output.

Required Methods§

source

fn set_verify_client(&'a self, client: &'a dyn ClientVerify<L>)

Set the client instance which will receive the verification_done() callback.

source

fn verify( &'a self, compare: &'static mut [u8; L] ) -> Result<(), (ErrorCode, &'static mut [u8; L])>

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:

  • OFF: the underlying digest engine is powered down and cannot be used.
  • BUSY: there is an outstanding add_data, add_data_mut, run, or verify operation, so the digest engine is busy and cannot accept more data.
  • SIZE: the active slice of the SubSlice has zero size.
  • NOSUPPORT: the currently selected digest algorithm is not supported.

If an appropriate set_mode*() wasn’t called before this function the implementation should try to use a default option. In the case where there is only one digest supported this should be used. If there is no suitable or obvious default option, the implementation can return ErrorCode::NOSUPPORT.

Implementors§