Skip to main content

SignatureVerify

Trait SignatureVerify 

Source
pub trait SignatureVerify<'a, const HASH_LEN: usize, const SIGNATURE_LEN: usize> {
    // Required methods
    fn set_verify_client(
        &self,
        client: &'a dyn ClientVerify<HASH_LEN, SIGNATURE_LEN>,
    );
    fn verify(
        &self,
        hash: &'static mut [u8; HASH_LEN],
        signature: &'static mut [u8; SIGNATURE_LEN],
    ) -> Result<(), (ErrorCode, &'static mut [u8; HASH_LEN], &'static mut [u8; SIGNATURE_LEN])>;
}
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.

  • HASH_LEN: The length in bytes of the hash.
  • SIGNATURE_LEN: The length in bytes of the signature.

Required Methods§

Source

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

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

Source

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

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.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§