Skip to content

AES-CMAC library

Eric Biggers linux-arm-kernel linux-cifs linux-crypto linux-wireless lkml stable 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest15 patches 12 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/15lib/crypto: aes: Add support for CBC-based MACsinclude/crypto/aes-cbc-macs.h lib/crypto/Kconfig lib/crypto/aes.c+362 -00 replies
2/15crypto: aes - Add cmac, xcbc, and cbcmac algorithms using librarycrypto/Kconfig crypto/aes.c crypto/testmgr.c +1 more+190 -70 replies
3/15crypto: arm64/aes - Fix 32-bit aes_mac_update() arg treated as 64-bitarch/arm64/crypto/aes-modes.S+2 -22 replies
4/15lib/crypto: arm64/aes: Move assembly code for AES modes into libaesarch/arm64/crypto/Makefile arch/arm64/crypto/aes-ce-ccm-glue.c arch/arm64/crypto/aes-glue.c +7 more+106 -670 replies
5/15lib/crypto: arm64/aes: Migrate optimized CBC-based MACs into libraryarch/arm64/crypto/Kconfig arch/arm64/crypto/aes-glue.c include/crypto/aes.h +2 more+61 -2300 replies
6/15lib/crypto: tests: Add KUnit tests for CBC-based MACslib/crypto/tests/Kconfig lib/crypto/tests/Makefile lib/crypto/tests/aes-cmac-testvecs.h +2 more+448 -30 replies
7/15lib/crypto: aes: Add FIPS self-test for CMAClib/crypto/aes.c lib/crypto/fips.h scripts/crypto/gen-fips-testvecs.py+47 -30 replies
8/15smb: client: Use AES-CMAC library for SMB3 signature calculationfs/smb/client/Kconfig fs/smb/client/cifsencrypt.c fs/smb/client/cifsglob.h +1 more+30 -740 replies
9/15smb: client: Remove obsolete cmac(aes) allocationfs/smb/client/Kconfig fs/smb/client/cifs_unicode.c fs/smb/client/cifsencrypt.c +7 more+2 -950 replies
10/15smb: client: Make generate_key() return voidfs/smb/client/smb2transport.c+16 -290 replies
11/15smb: client: Drop 'allocate_crypto' arg from smb*_calc_signature()fs/smb/client/smb2transport.c+5 -71 reply
12/15ksmbd: Use AES-CMAC library for SMB3 signature calculationfs/smb/server/Kconfig fs/smb/server/auth.c fs/smb/server/auth.h +4 more+19 -1171 reply
13/15Bluetooth: SMP: Use AES-CMAC library APInet/bluetooth/Kconfig net/bluetooth/smp.c+65 -1180 replies
14/15wifi: mac80211: Use AES-CMAC library in ieee80211_aes_cmac()net/mac80211/Kconfig net/mac80211/aes_cmac.c net/mac80211/aes_cmac.h +3 more+26 -793 replies
15/15wifi: mac80211: Use AES-CMAC library in aes_s2v()net/mac80211/Kconfig net/mac80211/fils_aead.c+17 -323 replies

Reviews trailers per patch

4 of 15 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchSteve FrenchNamjae JeonArd BiesheuvelJohannes Berg
SeriesR-b
1/15
2/15
3/15
4/15
5/15
6/15
7/15
8/15
9/15
10/15
11/15A-b
12/15A-b
13/15
14/15A-b
15/15A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 4 reviewers.

Read the v1 thread

Cover letter [PATCH 00/15] AES-CMAC library

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

Signature · 1 line
2.53.0