pub trait KeySet<'a, const KL: usize> {
// Required methods
fn set_key(
&self,
key: &'static mut [u8; KL],
) -> Result<(), (ErrorCode, &'static mut [u8; KL])>;
fn set_client(&self, client: &'a dyn KeySetClient<KL>);
}
Expand description
Interface for setting keys by a slice.
KL
is the length of the keys.
Implementers must be able to store keys from a slice. This is most commonly used for implementations that hold keys in memory. However, this interface is asynchronous as keys may be stored in external storage or an external chip and require an asynchronous operations.
Required Methods§
Sourcefn set_key(
&self,
key: &'static mut [u8; KL],
) -> Result<(), (ErrorCode, &'static mut [u8; KL])>
fn set_key( &self, key: &'static mut [u8; KL], ) -> Result<(), (ErrorCode, &'static mut [u8; KL])>
Set the current key.
This is asynchronous. If there is an existing key that key will be
returned in the set_key_done()
callback.
§Return
Ok()
if the key setting operation was accepted. Otherwise:
Err(ErrorCode::FAIL)
if the key cannot be set.