[PATCH 00/15] AES-CMAC library
Eric Biggers
ebiggers at kernel.org
Wed Feb 18 13:34:46 PST 2026
This series can also be retrieved from:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux.git aes-cmac-v1
This series adds support for AES CBC-based MACs to the crypto library,
specifically AES-CMAC, AES-XCBC-MAC, and AES-CBC-MAC. The
implementation is fully optimized with the existing
architecture-optimized AES code, either single-block AES en/decryption
or arm64's neon_aes_mac_update() and ce_aes_mac_update(). As usual,
optimizations are now enabled by default as well.
AES-CMAC support will be useful for at least the SMB client and server,
and the bluetooth and mac80211 drivers. Patches 8-15 convert these
users to use the crypto library API instead of crypto_shash, though
these patches will likely go in via subsystem trees later. They result
in some significant simplifications and performance improvements.
As usual, a KUnit test suite, FIPS self-test, and traditional crypto API
wrapper algorithms are included as well.
Note that I'm also planning to add additional AES modes to the library.
This is just an initial set of AES modes to get things started.
Notably, with the SMB client and server already using the SHA* and MD5
libraries, "cmac(aes)" was the only remaining use of crypto_shash there.
So it makes sense to take care of that.
Eric Biggers (15):
lib/crypto: aes: Add support for CBC-based MACs
crypto: aes - Add cmac, xcbc, and cbcmac algorithms using library
crypto: arm64/aes - Fix 32-bit aes_mac_update() arg treated as 64-bit
lib/crypto: arm64/aes: Move assembly code for AES modes into libaes
lib/crypto: arm64/aes: Migrate optimized CBC-based MACs into library
lib/crypto: tests: Add KUnit tests for CBC-based MACs
lib/crypto: aes: Add FIPS self-test for CMAC
smb: client: Use AES-CMAC library for SMB3 signature calculation
smb: client: Remove obsolete cmac(aes) allocation
smb: client: Make generate_key() return void
smb: client: Drop 'allocate_crypto' arg from smb*_calc_signature()
ksmbd: Use AES-CMAC library for SMB3 signature calculation
Bluetooth: SMP: Use AES-CMAC library API
wifi: mac80211: Use AES-CMAC library in ieee80211_aes_cmac()
wifi: mac80211: Use AES-CMAC library in aes_s2v()
arch/arm64/crypto/Kconfig | 2 +-
arch/arm64/crypto/Makefile | 4 +-
arch/arm64/crypto/aes-ce-ccm-glue.c | 4 -
arch/arm64/crypto/aes-glue.c | 260 +-----------------
arch/arm64/crypto/aes-neonbs-glue.c | 15 +-
crypto/Kconfig | 2 +
crypto/aes.c | 183 +++++++++++-
crypto/testmgr.c | 10 +-
drivers/crypto/starfive/jh7110-aes.c | 2 +-
fs/smb/client/Kconfig | 2 +-
fs/smb/client/cifs_unicode.c | 1 +
fs/smb/client/cifsencrypt.c | 62 ++---
fs/smb/client/cifsfs.c | 1 -
fs/smb/client/cifsglob.h | 7 +-
fs/smb/client/cifsproto.h | 3 -
fs/smb/client/misc.c | 57 ----
fs/smb/client/sess.c | 11 -
fs/smb/client/smb2proto.h | 1 -
fs/smb/client/smb2transport.c | 113 ++------
fs/smb/server/Kconfig | 2 +-
fs/smb/server/auth.c | 51 +---
fs/smb/server/auth.h | 4 +-
fs/smb/server/crypto_ctx.c | 58 ----
fs/smb/server/crypto_ctx.h | 12 -
fs/smb/server/server.c | 1 -
fs/smb/server/smb2pdu.c | 8 +-
include/crypto/aes-cbc-macs.h | 154 +++++++++++
include/crypto/aes.h | 66 +++++
lib/crypto/Kconfig | 10 +
lib/crypto/Makefile | 4 +-
lib/crypto/aes.c | 231 +++++++++++++++-
.../crypto => lib/crypto/arm64}/aes-ce.S | 0
.../crypto => lib/crypto/arm64}/aes-modes.S | 23 +-
.../crypto => lib/crypto/arm64}/aes-neon.S | 0
lib/crypto/arm64/aes.h | 76 ++++-
lib/crypto/fips.h | 5 +
lib/crypto/tests/Kconfig | 10 +
lib/crypto/tests/Makefile | 1 +
lib/crypto/tests/aes-cmac-testvecs.h | 181 ++++++++++++
lib/crypto/tests/aes_cbc_macs_kunit.c | 228 +++++++++++++++
net/bluetooth/Kconfig | 3 +-
net/bluetooth/smp.c | 180 +++++-------
net/mac80211/Kconfig | 2 +-
net/mac80211/aes_cmac.c | 65 +----
net/mac80211/aes_cmac.h | 12 +-
net/mac80211/fils_aead.c | 48 ++--
net/mac80211/key.c | 11 +-
net/mac80211/key.h | 3 +-
net/mac80211/wpa.c | 13 +-
scripts/crypto/gen-fips-testvecs.py | 10 +
scripts/crypto/gen-hash-testvecs.py | 31 ++-
51 files changed, 1388 insertions(+), 855 deletions(-)
create mode 100644 include/crypto/aes-cbc-macs.h
rename {arch/arm64/crypto => lib/crypto/arm64}/aes-ce.S (100%)
rename {arch/arm64/crypto => lib/crypto/arm64}/aes-modes.S (98%)
rename {arch/arm64/crypto => lib/crypto/arm64}/aes-neon.S (100%)
create mode 100644 lib/crypto/tests/aes-cmac-testvecs.h
create mode 100644 lib/crypto/tests/aes_cbc_macs_kunit.c
base-commit: 2961f841b025fb234860bac26dfb7fa7cb0fb122
prerequisite-patch-id: 8eccdd31739fb317dfda9dddbfc5c3cd64e77331
prerequisite-patch-id: ca782470cef2467042fbe8f0166933d7fa292628
--
2.53.0
More information about the linux-arm-kernel
mailing list