embassy-crypto-driver

Crates

git

Versions

default

Flavors

Skip to main content

Aes128Ctr

Trait Aes128Ctr 

Source
pub trait Aes128Ctr {
    type Context;

    // Required methods
    fn init(key: &[u8; 16], iv: &[u8; 16]) -> Self::Context;
    fn apply_keystream(ctx: &mut Self::Context, buf: InOutBuf<'_, '_, u8>);
}
Expand description

AES-128 CTR stream cipher trait.

CTR mode turns a block cipher into a synchronous stream cipher. Encryption and decryption are identical: XOR data with the AES-ECB encrypted counter keystream. The counter is a 128-bit big-endian integer incremented after each block, matching NIST SP 800-38A.

Required Associated Types§

Source

type Context

Opaque storage for key schedule, counter state, and partial-block buffer.

Required Methods§

Source

fn init(key: &[u8; 16], iv: &[u8; 16]) -> Self::Context

Initialize with a 128-bit key and 128-bit initial counter (IV).

Source

fn apply_keystream(ctx: &mut Self::Context, buf: InOutBuf<'_, '_, u8>)

Apply keystream to buf in-place (encrypt == decrypt for CTR).

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§