Re: [PATCH v2 04/13] lib/crypto: aes: Add CTR and XCTR support
From: Thomas Huth
Date: Thu Jul 16 2026 - 03:41:31 EST
On 16/07/2026 00.11, Eric Biggers wrote:
Add support for AES-CTR and AES-XCTR to the crypto library.Reviewed-by: Thomas Huth <thuth@xxxxxxxxxx>
These will be used to provide streamlined implementations of the
"ctr(aes)" and "xctr(aes)" crypto_skcipher algorithms. Most users of
"ctr(aes)" will also be able to switch to the library, which as usual
will be simpler and faster, e.g.:
- net/mac80211/fils_aead.c
- net/mac802154/llsec.c
As usual, the architecture-optimized AES-CTR and AES-XCTR code will be
migrated into the library as well (using the hooks provided in this
commit), eliminating lots of repetitive boilerplate code.
This is also a prerequisite for supporting AES-GCM, AES-CCM, and
AES-HCTR2 in the crypto library.
Initial test coverage is provided by the crypto_skcipher support added
in a later commit. I'm planning a KUnit test suite as well.
Signed-off-by: Eric Biggers <ebiggers@xxxxxxxxxx>
---
.../crypto/libcrypto-unauth-encryption.rst | 7 ++
include/crypto/aes-ctr.h | 65 +++++++++++++
lib/crypto/Kconfig | 6 ++
lib/crypto/aes.c | 96 +++++++++++++++++++
lib/crypto/tests/Kconfig | 1 +
5 files changed, 175 insertions(+)
create mode 100644 include/crypto/aes-ctr.h