kernel::hil::symmetric_encryption

Trait AES128GCM

Source
pub trait AES128GCM<'a> {
    // Required methods
    fn set_client(&'a self, client: &'a dyn GCMClient);
    fn set_key(&self, key: &[u8]) -> Result<(), ErrorCode>;
    fn set_iv(&self, nonce: &[u8]) -> Result<(), ErrorCode>;
    fn crypt(
        &self,
        buf: &'static mut [u8],
        aad_offset: usize,
        message_offset: usize,
        message_len: usize,
        encrypting: bool,
    ) -> Result<(), (ErrorCode, &'static mut [u8])>;
}

Required Methods§

Source

fn set_client(&'a self, client: &'a dyn GCMClient)

Set the client instance which will receive crypt_done() callbacks

Source

fn set_key(&self, key: &[u8]) -> Result<(), ErrorCode>

Set the key to be used for GCM encryption Returns INVAL if length is not AES128_KEY_SIZE

Source

fn set_iv(&self, nonce: &[u8]) -> Result<(), ErrorCode>

Set the IV to be used for GCM encryption. The IV should be less or equal to 12 bytes (96 bits) as recommened in NIST-800-38D. Returns INVAL if length is greater then 12 bytes

Source

fn crypt( &self, buf: &'static mut [u8], aad_offset: usize, message_offset: usize, message_len: usize, encrypting: bool, ) -> Result<(), (ErrorCode, &'static mut [u8])>

Try to begin the encryption/decryption process The possible ErrorCodes are: - BUSY: An operation is already in progress - SIZE: The offset and lengths don’t fit inside the buffer

Implementors§