Re: [PATCH bpf-next v4] bpf: crypto: Use AES-CBC and AES-ECB libraries
From: Eric Biggers
Date: Wed Sep 23 2026 - 00:56:54 EST
On Wed, Sep 23, 2026 at 04:22:57AM +0000, bot+bpf-ci@xxxxxxxxxx wrote:
> This isn't a bug, but struct aes_enckey pads itself so the round keys
> can be 16-byte aligned for better performance (as documented in
> include/crypto/aes.h). Putting the 4-byte algo enum before the key union
> means key.aes lands at offset 4, so the round keys can never hit that
> alignment. Would putting key first (or aligning it) be worth considering
> here?
Sure, but it's very much bikeshedding. If someone cared about
performance enough to be micro-optimizing the data alignment here, they
would also have noticed than the optimized implementations of AES modes
aren't actually being used, which is way, *way* more important.
Coincidentally, I'm addressing that in a separate series
(https://lore.kernel.org/linux-crypto/20260921050910.296144-1-ebiggers@xxxxxxxxxx/)...
I would not consider it worth worrying about the alignment here.
> This isn't a bug, but both helpers repeat the same src_len %
> AES_BLOCK_SIZE and dst_len < src_len checks. Could that validation stay
> in bpf_crypto_crypt() next to the existing length checks, leaving only
> the iv_len check per mode?
It's done the way it is because it makes it more straightforward to add
AES-GCM support, which is desired as per previous discussions.
Anyway, these random bpf-ci bot comments on every version are getting a
bit annoying. Especially when it explicitly says "This isn't a bug",
and then the instructions at the end of the email assume it is.
- Eric