pub trait AES128GCM<'a> {
    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

Set the client instance which will receive crypt_done() callbacks

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

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

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