Skip to contentSkip to conversation

ksmbd: select CRYPTO_AES

PATCH Applied Michail Andreas Michalopoulos 2 participants 2 messages Oct 23

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ksmbd: select CRYPTO_AES

ksmbd allocates "gcm(aes)" and "ccm(aes)" AEAD transforms for SMB3 encryption, but SMB_SERVER only selects CRYPTO_GCM and CRYPTO_CCM, not an AES cipher. With a configuration in which nothing else enables CRYPTO_AES, ksmbd builds but cannot allocate the transforms, and every session that uses encryption fails:

ksmbd: Failed to alloc encrypt aead : -2
ksmbd: crypto alloc failed

Select CRYPTO_AES, as the SMB client already does.

Fixes a848c4f15ab6 ("cifsd: add Kconfig and Makefile")
Assisted-by LLM

---
On x86_64, defconfig plus SMB_SERVER=y ends up with CRYPTO_AES unset once MAC80211, XFRM_ESP and CRYPTO_KRB5 are disabled; with this patch olddefconfig enables it. Without CRYPTO_AES, ksmbd logs the messages above when a client negotiates encryption (seen under UML on ksmbd-for-next f75c93278608), and with CRYPTO_AES the same client connects. Distribution configs already enable CRYPTO_AES, so this only affects custom configs.

The smbtorture smb2 tests run here (dir, create, getinfo, setinfo, rename, compound, streams, dosmode, read, lock) passed on the kernel without CRYPTO_AES, as they do not negotiate encryption by default.

 fs/smb/server/Kconfig | 1 +
 1 file changed, 1 insertion(+)
fs/smb/server/Kconfig +1 -0
index b7665e0e494..f8b03605db5 100644
@@ -16,6 +16,7 @@ config SMB_SERVER
 	select CRYPTO_AEAD2
 	select CRYPTO_CCM
 	select CRYPTO_GCM
+	select CRYPTO_AES
 	select ASN1
 	select OID_REGISTRY
 	select CRC32
Signature · 1 line
2.43.0
maintainer Applied
#1 lore raw
Quoted 7 lines · Michail Andreas Michalopoulos

ksmbd allocates "gcm(aes)" and "ccm(aes)" AEAD transforms for SMB3 encryption, but SMB_SERVER only selects CRYPTO_GCM and CRYPTO_CCM, not an AES cipher. With a configuration in which nothing else enables CRYPTO_AES, ksmbd builds but cannot allocate the transforms, and every session that uses encryption fails:

Quoted 8 lines

ksmbd: Failed to alloc encrypt aead : -2
ksmbd: crypto alloc failed

Select CRYPTO_AES, as the SMB client already does.

Fixes a848c4f15ab6 ("cifsd: add Kconfig and Makefile")
Assisted-by LLM

Applied it to #ksmbd-for-next.
Thanks!