Re: [PATCH bpf-next] bpf: crypto: Use AES-CBC and AES-ECB libraries
From: Eric Biggers
Date: Mon Aug 31 2026 - 17:48:35 EST
On Mon, Aug 31, 2026 at 11:25:54PM +0200, Karl Mehltretter wrote:
> On Mon, Aug 31, 2026 at 12:21:39PM +0100, Eric Biggers wrote:
> > There are library APIs for both of these now, which are much easier to
> > use and more efficient. Reimplement BPF crypto on top of them, greatly
> > simplifying the code. As part of this, the bpf_crypto_type abstraction
> > layer is removed, as it's not useful.
> >
>
> This relates to my recent patch fixing state preservation in lskcipher's
> unaligned path, which exercised ARC4 through BPF:
>
> https://lore.kernel.org/r/20260829194314.42685-1-kmehltretter@xxxxxxxxx
>
> While looking at your patch, I tested the actual BPF-visible algorithm
> surface. The ECB and CBC templates allow considerably more than AES.
Right, apparently any "crypto_cipher" can be composed with "ecb" or
"cbc" as an "lskcipher". I think in this case it's only of theoretical
interest and is a bug, not a feature, though. Especially given the
presence of ARC4, DES, TEA, etc. on that list.
We see this a lot with the "Crypto API", where a new kernel feature
actually uses one or two algorithms, then unnecessarily allows every
single algorithm to be theoretically reachable (including insecure,
obsolete, or nonsense options) just because the API takes a string.
- Eric