Re: [PATCH 03/33] lib/crypto: aes: Add CBC and CBC-CTS support

From: David Laight

Date: Tue Jul 14 2026 - 04:02:38 EST


On Mon, 6 Jul 2026 22:34:33 -0700
Eric Biggers <ebiggers@xxxxxxxxxx> wrote:

> Add support for AES-CBC and AES-CBC-CTS to the crypto library.
>
> These will be used to provide streamlined implementations of the
> "cbc(aes)" and "cts(cbc(aes))" crypto_skcipher algorithms. Most users
> of these crypto_skcipher algorithms will also be able to switch to the
> library, which as usual will be simpler and faster, e.g.:
>
> - block/blk-crypto-fallback.c (for AES-128-CBC-ESSIV)
> - fs/crypto/crypto.c (for AES-128-CBC-ESSIV)
> - fs/crypto/fname.c (for AES-256-CTS and AES-128-CBC)
> - kernel/bpf/crypto.c
> - net/ceph/crypto.c
> - security/keys/encrypted-keys/encrypted.c
>
...
> +void aes_cbc_encrypt(u8 *dst, const u8 *src, size_t len, u8 iv[AES_BLOCK_SIZE],
> + aes_encrypt_arg key)


Does embedding the 'u8 iv[]' in a structure work?
It gives better type-checking for the length of the array.

David