Skip to main content

aes128_encrypt_block

Function aes128_encrypt_block 

Source
pub fn aes128_encrypt_block(
    key: &[u8],
    block: &[u8],
    out: &mut [u8],
) -> Result<(), CryptoError>
Expand description

Encrypt a single 16-byte block with AES-128 in raw ECB mode.

This is the QUIC header-protection mask primitive for the AES-128 suite (RFC 9001 §5.4.3): mask = AES-ECB(hp_key, sample).

key must be exactly 16 bytes; block must be exactly 16 bytes. The ciphertext block is written into out (16 bytes).

§Errors

Returns CryptoError::InvalidKey if key is not 16 bytes, CryptoError::BadInput if block is not 16 bytes, and CryptoError::BufferTooSmall if out is shorter than 16 bytes.