[PATCH v2 0/4] smb: client: Use AES-CMAC library

Eric Biggers
2026-04-18T22:13:37Z

This series updates the SMB client to use the AES-CMAC library functions
that were recently added, instead of a "cmac(aes)" crypto_shash. As
usual, this simplifies the code considerably and is much more efficient.

These patches were originally sent as patches 8-11 of the series
https://lore.kernel.org/r/20260218213501.136844-1-ebiggers@kernel.org/
The only change from that version was adding tags and rebasing.
I also added some microbenchmark results below.

This is intended to be taken through the smb tree, either 7.1 or 7.2
depending on maintainer preference.

A few microbenchmarks that demonstrate improved performance:

- Total cycles spent in generate_key() during SMB3 mount
decreased from 20640 to 10780 (3 calls total).

- Total cycles spent in smb3_calc_signature() during SMB3 mount
decreased from 177620 to 73180 (32 calls & 4255 bytes total).

- Total cycles spent in smb3_calc_signature() while writing 10MB file
decreased from 27551180 to 26628360 (10 calls & 10001392 bytes total)

- Total cycles spent in smb3_calc_signature() while reading 10MB file
decreased from 28390900 to 27879340 (14 calls & 10001781 bytes total)

Note that my "before" numbers were taken from current mainline which has
my changes that made the "cmac(aes)" crypto_shash a bit faster as well.
So the speedup vs v7.0 is actually even greater.

Eric Biggers (4):
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()

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 +++++++++-------------------------
10 files changed, 53 insertions(+), 205 deletions(-)

base-commit: 8541d8f725c673db3bd741947f27974358b2e163
--
2.53.0