kernel::hil::public_key_crypto::signature

Trait SignatureVerify

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

Verify a signature.

This is a generic interface, and it is up to the implementation as to the signature verification algorithm being used.

  • HL: The length in bytes of the hash.
  • SL: The length in bytes of the signature.

Required Methods§

Source

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

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

Source

fn verify( &self, hash: &'static mut [u8; HL], signature: &'static mut [u8; SL], ) -> Result<(), (ErrorCode, &'static mut [u8; HL], &'static mut [u8; SL])>

Verify the signature matches the given hash.

If this returns Ok(()), then the verification_done() callback will be called. If this returns Err(), no callback will be called.

The valid ErrorCodes that can occur are:

  • OFF: the underlying digest engine is powered down and cannot be used.
  • BUSY: there is an outstanding operation already in process, and the verification engine cannot accept another request.

Implementors§