linux/crypto
Linus Torvalds d47db9bf50 Crypto library updates for 7.3
Add library APIs for most AES encryption modes that are used in the
 kernel (ECB, CBC, CBC-CTS, CTR, XCTR, XTS, GCM, CCM).
 
 These AES modes have many in-kernel users that are currently using the
 crypto_skcipher or crypto_aead APIs. These existing APIs are difficult
 to use and inefficient. Until now, the lack of proper library support
 for these has been the main gap in the crypto library.
 
 This set of changes is the next stage of addressing it:
 
   - Implement the new APIs on top of the existing support for
     single-block AES in the library.
 
   - Fully document the new APIs.
 
   - Migrate the only user of the old AES-GCM library API to the new,
     more flexible API; then remove the old API and its implementation.
 
   - Wire up the new APIs to the traditional crypto API by adding
     crypto_skcipher and crypto_aead algorithms.
 
     This makes the new APIs be covered by the traditional crypto API's
     self-tests. It also makes them be already used for real on systems
     that don't have architecture-optimized code for these modes.
 
     But most importantly, this is a prerequisite for migrating the
     architecture-optimized code for these AES modes (i.e.
     arch/*/crypto/aes*) into the library, which as usual will
     eliminate a lot of redundant "glue" code.
 
 Note that unlike some of the other algorithms that have been migrated
 to the library, e.g. SHA-512, for these AES modes there was too much
 to get done in one cycle. Nor did it make sense to handle these modes
 one at a time, because they tend to be coupled together or depend on
 each other, especially in the architecture-optimized AES code.
 
 Thus, most of the benefits (reductions in lines of code, performance
 improvements, etc.) will follow in later cycles when
 architecture-optimized code is migrated into the library and users of
 crypto_skcipher and crypto_aead are updated to use the new APIs.
 
 The design of the new APIs was informed by writing proof-of-concept
 patches for many kernel subsystems currently accessing these same
 algorithms via crypto_skcipher or crypto_aead (patches 18-33 of
 https://lore.kernel.org/r/20260707053503.209874-1-ebiggers@kernel.org/).
 
 While those patches will be resent for real later, the total diffstat
 for them was negative 1905 lines. So clearly the new APIs are quite a
 bit easier to use and align better with what users actually need.
 
 Besides the new AES encryption APIs, there are also a few changes for
 improved AES-CMAC key and context zeroization.
 -----BEGIN PGP SIGNATURE-----
 
 iIoEABYIADIWIQSacvsUNc7UX4ntmEPzXCl4vpKOKwUCaoEqhRQcZWJpZ2dlcnNA
 a2VybmVsLm9yZwAKCRDzXCl4vpKOKy8YAP4o44z09KdugtigFIFX7qQnLk0uPAw+
 sTPqmu+FA4jOGAD/Vy23hzAVpWmSBFhyo7HMK9W0ABK7cqj6x23I/N6JRgM=
 =SLPT
 -----END PGP SIGNATURE-----

Merge tag 'libcrypto-updates-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux

Pull crypto library updates from Eric Biggers:
 "Add library APIs for most AES encryption modes that are used in the
  kernel (ECB, CBC, CBC-CTS, CTR, XCTR, XTS, GCM, CCM).

  These AES modes have many in-kernel users that are currently using the
  crypto_skcipher or crypto_aead APIs. These existing APIs are difficult
  to use and inefficient. Until now, the lack of proper library support
  for these has been the main gap in the crypto library.

  This set of changes is the next stage of addressing it:

   - Implement the new APIs on top of the existing support for
     single-block AES in the library.

   - Fully document the new APIs.

   - Migrate the only user of the old AES-GCM library API to the new,
     more flexible API; then remove the old API and its implementation.

   - Wire up the new APIs to the traditional crypto API by adding
     crypto_skcipher and crypto_aead algorithms.

     This makes the new APIs be covered by the traditional crypto API's
     self-tests. It also makes them be already used for real on systems
     that don't have architecture-optimized code for these modes.

     But most importantly, this is a prerequisite for migrating the
     architecture-optimized code for these AES modes (i.e.
     arch/*/crypto/aes*) into the library, which as usual will eliminate
     a lot of redundant "glue" code.

  Note that unlike some of the other algorithms that have been migrated
  to the library, e.g. SHA-512, for these AES modes there was too much
  to get done in one cycle. Nor did it make sense to handle these modes
  one at a time, because they tend to be coupled together or depend on
  each other, especially in the architecture-optimized AES code.

  Thus, most of the benefits (reductions in lines of code, performance
  improvements, etc.) will follow in later cycles when
  architecture-optimized code is migrated into the library and users of
  crypto_skcipher and crypto_aead are updated to use the new APIs.

  The design of the new APIs was informed by writing proof-of-concept
  patches for many kernel subsystems currently accessing these same
  algorithms via crypto_skcipher or crypto_aead (patches 18-33 of
  https://lore.kernel.org/r/20260707053503.209874-1-ebiggers@kernel.org/).

  While those patches will be resent for real later, the total diffstat
  for them was negative 1905 lines. So clearly the new APIs are quite a
  bit easier to use and align better with what users actually need.

  Besides the new AES encryption APIs, there are also a few changes for
  improved AES-CMAC key and context zeroization"

* tag 'libcrypto-updates-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux:
  mac80211: fils_aead: Use __cleanup() instead of memzero_explicit()
  Bluetooth: SMP: clear the aes_cmac_key when done
  smb: clear the aes_cmac_key and aes_cmac_ctx when done
  lib/crypto: aes-cmac: Add zeroization functions
  lib/crypto: aesgcm: Remove old AES-GCM library
  x86/sev: Remove obsolete virtual address check
  x86/sev: Use new AES-GCM library
  crypto: aes - Add CCM support using library
  crypto: aes - Add GCM support using library
  crypto: aes - Add XTS support using library
  crypto: aes - Add CTR and XCTR support using library
  crypto: aes - Add CBC and CBC-CTS support using library
  crypto: aes - Add ECB support using library
  lib/crypto: aes: Add CCM support
  lib/crypto: aes: Add GCM support
  lib/crypto: aes: Add XTS support
  lib/crypto: aes: Add CTR and XCTR support
  lib/crypto: aes: Add CBC and CBC-CTS support
  lib/crypto: aes: Add ECB support
  crypto: xts - Split out __xts_verify_key() helper
2026-08-17 19:16:42 -07:00
..
asymmetric_keys X.509: Fix validation of ASN.1 certificate header 2026-05-22 20:25:29 +08:00
async_tx raid6: hide internals 2026-05-28 21:24:54 -07:00
krb5 This update includes the following changes: 2026-06-16 09:01:23 +05:30
842.c crypto: comp - Use same definition of context alloc and free ops 2025-09-20 20:21:03 +08:00
acompress.c crypto: api - use designated initializers for report structs 2026-05-15 18:08:48 +08:00
adiantum.c crypto: adiantum - Drop support for asynchronous xchacha ciphers 2026-01-12 11:07:50 -08:00
aead.c crypto: api - use designated initializers for report structs 2026-05-15 18:08:48 +08:00
aegis-neon.h
aegis.h crypto: aegis - Switch from crypto_ft_tab[] to aes_enc_tab[] 2026-01-12 11:39:58 -08:00
aegis128-core.c Revert "crypto: run initcalls for generic implementations earlier" 2025-05-05 18:20:44 +08:00
aegis128-neon-inner.c crypto: aegis128 - Use neon-intrinsics.h on ARM too 2026-05-28 13:14:25 -07:00
aegis128-neon.c crypto: aegis128-neon - Move to more abstract 'ksimd' guard API 2025-11-12 09:52:01 +01:00
aes.c crypto: aes - Add CCM support using library 2026-07-22 12:01:21 -07:00
af_alg.c crypto: af_alg - Drop support for off-CPU cryptography 2026-05-29 14:05:30 +08:00
ahash.c Networking changes for 7.2. 2026-06-17 08:17:00 +01:00
akcipher.c crypto: api - use designated initializers for report structs 2026-05-15 18:08:48 +08:00
algapi.c Locking updates for v6.20: 2026-02-10 12:28:44 -08:00
algboss.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
algif_aead.c crypto: af_alg - Drop support for off-CPU cryptography 2026-05-29 14:05:30 +08:00
algif_hash.c crypto: af_alg - Drop support for off-CPU cryptography 2026-05-29 14:05:30 +08:00
algif_rng.c crypto: af_alg - Drop support for off-CPU cryptography 2026-05-29 14:05:30 +08:00
algif_skcipher.c crypto: af_alg - Allow cbc(paes) 2026-07-30 17:44:21 +10:00
anubis.c crypto: anubis - simplify return statement in anubis_mod_init 2025-09-20 20:21:04 +08:00
api.c crypto: api - Fold crypto_alloc_tfmmem() into crypto_create_tfm_node() 2026-05-28 17:45:46 -07:00
arc4.c Revert "crypto: run initcalls for generic implementations earlier" 2025-05-05 18:20:44 +08:00
aria_generic.c Revert "crypto: run initcalls for generic implementations earlier" 2025-05-05 18:20:44 +08:00
authenc.c crypto: authenc - Correctly pass EINPROGRESS back up to the caller 2025-10-17 16:03:58 +08:00
authencesn.c crypto: authencesn - Use memcpy_from/to_sglist 2026-05-07 16:10:03 +08:00
blake2b.c crypto: blake2b - Reimplement using library API 2025-10-29 22:04:24 -07:00
blowfish_common.c crypto: blowfish - fix typo in comment 2026-01-23 13:48:44 +08:00
blowfish_generic.c Revert "crypto: run initcalls for generic implementations earlier" 2025-05-05 18:20:44 +08:00
bpf_crypto_skcipher.c crypto: bpf - Add MODULE_DESCRIPTION for skcipher 2025-03-02 15:19:43 +08:00
camellia_generic.c Revert "crypto: run initcalls for generic implementations earlier" 2025-05-05 18:20:44 +08:00
cast_common.c
cast5_generic.c Revert "crypto: run initcalls for generic implementations earlier" 2025-05-05 18:20:44 +08:00
cast6_generic.c Revert "crypto: run initcalls for generic implementations earlier" 2025-05-05 18:20:44 +08:00
cbc.c Revert "crypto: run initcalls for generic implementations earlier" 2025-05-05 18:20:44 +08:00
ccm.c crypto: ccm - Set rfc4309 maxauthsize from child 2026-07-30 17:30:50 +10:00
chacha.c crypto: chacha - register only "-lib" drivers 2025-08-29 09:50:19 -07:00
chacha20poly1305.c crypto: chacha20poly1305 - validate poly1305 template argument 2026-06-05 19:36:36 +08:00
cipher.c crypto: cipher - Remove crypto_clone_cipher() 2026-05-28 17:45:45 -07:00
cmac.c crypto: hash - Remove support for cloning hash tfms 2026-05-28 17:45:45 -07:00
compress.h crypto: acomp - Move stream management into scomp layer 2025-03-15 16:21:22 +08:00
crc32.c crypto/crc32[c]: register only "-lib" drivers 2025-06-30 09:31:56 -07:00
crc32c.c crypto: crc32c - Remove another outdated comment 2026-03-17 09:29:22 -07:00
cryptd.c crypto: hash - Remove support for cloning hash tfms 2026-05-28 17:45:45 -07:00
crypto_engine.c Locking updates for v6.20: 2026-02-10 12:28:44 -08:00
crypto_null.c crypto: crypto_null - Drop unused cipher_null crypto_alg 2026-05-07 16:10:01 +08:00
crypto_user.c crypto: api - use designated initializers for report structs 2026-05-15 18:08:48 +08:00
ctr.c Revert "crypto: run initcalls for generic implementations earlier" 2025-05-05 18:20:44 +08:00
cts.c Revert "crypto: run initcalls for generic implementations earlier" 2025-05-05 18:20:44 +08:00
deflate.c crypto: deflate - fix spurious -ENOSPC 2026-03-26 18:10:58 +09:00
des_generic.c Revert "crypto: run initcalls for generic implementations earlier" 2025-05-05 18:20:44 +08:00
dh_helper.c
dh.c crypto: dh - Use crypto_stdrng_get_bytes() 2026-04-03 08:56:11 +08:00
drbg.c crypto: drbg - Remove support for "prediction resistance" 2026-05-15 18:08:47 +08:00
ecb.c Revert "crypto: run initcalls for generic implementations earlier" 2025-05-05 18:20:44 +08:00
ecc_curve_defs.h
ecc.c crypto: ecc - Fix carry overflow in vli multiplication 2026-05-22 20:25:29 +08:00
ecdh_helper.c
ecdh.c Revert "crypto: run initcalls for generic implementations earlier" 2025-05-05 18:20:44 +08:00
ecdsa-p1363.c crypto: ecdsa - Fix NIST P521 key size reported by KEYCTL_PKEY_QUERY 2025-04-16 15:16:21 +08:00
ecdsa-x962.c crypto: ecdsa - Fix NIST P521 key size reported by KEYCTL_PKEY_QUERY 2025-04-16 15:16:21 +08:00
ecdsa.c Revert "crypto: run initcalls for generic implementations earlier" 2025-05-05 18:20:44 +08:00
ecdsasignature.asn1
echainiv.c crypto: geniv - use memcpy_sglist() instead of null skcipher 2025-05-12 13:32:53 +08:00
ecrdsa_defs.h
ecrdsa_params.asn1
ecrdsa_pub_key.asn1
ecrdsa.c crypto: ecrdsa - remove empty sig_alg exit callback 2026-05-29 13:54:43 +08:00
essiv.c crypto: essiv - Check ssize for decryption and in-place encryption 2025-10-09 15:02:35 +08:00
fips.c crypto: fips - annotate fips_enable() with __init to free init memory after boot 2025-12-19 14:47:47 +08:00
gcm.c crypto: gcm - Use GHASH library instead of crypto_ahash 2026-03-23 16:44:29 -07:00
geniv.c crypto: geniv - Remove unused spinlock from struct aead_geniv_ctx 2026-04-12 16:47:09 +08:00
hash.h
hctr2.c lib/crypto: gf128hash: Rename polyval module to gf128hash 2026-03-23 13:15:13 -07:00
hmac.c crypto: hash - Remove support for cloning hash tfms 2026-05-28 17:45:45 -07:00
internal.h crypto: api - Fold __crypto_alloc_tfmgfp() into __crypto_alloc_tfm() 2026-05-28 17:45:46 -07:00
jitterentropy-kcapi.c This update includes the following changes: 2026-04-15 15:22:26 -07:00
jitterentropy-testing.c crypto: jitter - output full sample from test interface 2024-10-19 08:44:30 +08:00
jitterentropy.c crypto: jitterentropy - fix URL 2026-05-15 18:08:36 +08:00
jitterentropy.h crypto: jitterentropy - Use SHA-3 library 2026-03-09 13:27:21 -07:00
Kconfig crypto: aes - Add CCM support using library 2026-07-22 12:01:21 -07:00
kdf_sp800108.c crypto: testmgr - replace CRYPTO_MANAGER_DISABLE_TESTS with CRYPTO_SELFTESTS 2025-05-12 13:33:14 +08:00
khazad.c crypto: khazad - simplify return statement in khazad_mod_init 2025-12-29 08:48:35 +08:00
kpp.c crypto: api - use designated initializers for report structs 2026-05-15 18:08:48 +08:00
krb5enc.c crypto: krb5enc - fix async decrypt skipping hash verification 2026-04-20 16:18:58 +08:00
lrw.c crypto: Fix several spelling mistakes in comments 2026-03-22 11:17:59 +09:00
lskcipher.c crypto: api - use designated initializers for report structs 2026-05-15 18:08:48 +08:00
lz4.c crypto: comp - Use same definition of context alloc and free ops 2025-09-20 20:21:03 +08:00
lz4hc.c crypto: comp - Use same definition of context alloc and free ops 2025-09-20 20:21:03 +08:00
lzo-rle.c crypto: comp - Use same definition of context alloc and free ops 2025-09-20 20:21:03 +08:00
lzo.c crypto: comp - Use same definition of context alloc and free ops 2025-09-20 20:21:03 +08:00
Makefile Networking changes for 7.2. 2026-06-17 08:17:00 +01:00
md4.c Revert "crypto: run initcalls for generic implementations earlier" 2025-05-05 18:20:44 +08:00
md5.c crypto: md5 - Implement export_core() and import_core() 2025-09-08 09:47:38 -07:00
mldsa.c crypto: Add ML-DSA crypto_sig support 2026-01-21 22:32:50 +00:00
pcrypt.c crypto: pcrypt - restore callback for non-parallel fallback 2026-06-05 19:36:35 +08:00
proc.c crypto: Enable context analysis 2026-01-05 16:43:36 +01:00
ripemd.h
rmd160.c Revert "crypto: run initcalls for generic implementations earlier" 2025-05-05 18:20:44 +08:00
rng.c crypto: rng - Free default RNG on module exit 2026-06-12 09:56:45 +08:00
rsa_helper.c
rsa-pkcs1pad.c crypto: rsassa-pkcs1 - Migrate to sig_alg backend 2024-10-05 13:22:04 +08:00
rsa.c Revert "crypto: run initcalls for generic implementations earlier" 2025-05-05 18:20:44 +08:00
rsaprivkey.asn1
rsapubkey.asn1
rsassa-pkcs1.c crypto: ecdsa - Fix NIST P521 key size reported by KEYCTL_PKEY_QUERY 2025-04-16 15:16:21 +08:00
scatterwalk.c Revert "crypto: scatterwalk - Move skcipher walk and use it for memcpy_sglist" 2025-11-22 10:04:50 +08:00
scompress.c crypto: api - use designated initializers for report structs 2026-05-15 18:08:48 +08:00
seed.c Revert "crypto: run initcalls for generic implementations earlier" 2025-05-05 18:20:44 +08:00
seqiv.c crypto: seqiv - Do not use req->iv after crypto_aead_encrypt 2025-12-19 14:47:06 +08:00
serpent_generic.c Revert "crypto: run initcalls for generic implementations earlier" 2025-05-05 18:20:44 +08:00
sha1.c crypto: sha1 - Implement export_core() and import_core() 2025-09-02 19:02:35 -07:00
sha3.c crypto: sha3 - Reimplement using library API 2025-11-05 20:30:51 -08:00
sha256.c crypto: sha256 - Implement export_core() and import_core() 2025-09-02 19:02:37 -07:00
sha512.c crypto: sha512 - Implement export_core() and import_core() 2025-09-02 19:02:39 -07:00
shash.c Networking changes for 7.2. 2026-06-17 08:17:00 +01:00
sig.c crypto: api - use designated initializers for report structs 2026-05-15 18:08:48 +08:00
simd.c crypto: simd - Remove unused skcipher support 2026-03-22 11:17:59 +09:00
skcipher.c crypto: api - use designated initializers for report structs 2026-05-15 18:08:48 +08:00
skcipher.h
sm3.c crypto: sm3 - Replace with wrapper around library 2026-03-23 17:50:59 -07:00
sm4_generic.c Revert "crypto: run initcalls for generic implementations earlier" 2025-05-05 18:20:44 +08:00
sm4.c
streebog_generic.c Revert "crypto: run initcalls for generic implementations earlier" 2025-05-05 18:20:44 +08:00
tcrypt.c crypto: fcrypt - Remove support for FCrypt block cipher 2026-06-09 17:03:03 -07:00
tcrypt.h crypto: tcrypt - Remove unused poly1305 support 2025-11-22 10:04:50 +08:00
tea.c crypto: Fix several spelling mistakes in comments 2026-03-22 11:17:59 +09:00
testmgr.c Networking changes for 7.2. 2026-06-17 08:17:00 +01:00
testmgr.h Networking changes for 7.2. 2026-06-17 08:17:00 +01:00
twofish_common.c
twofish_generic.c Revert "crypto: run initcalls for generic implementations earlier" 2025-05-05 18:20:44 +08:00
wp512.c crypto: wp512 - Use API partial block handling 2025-06-23 16:56:56 +08:00
xcbc.c Revert "crypto: run initcalls for generic implementations earlier" 2025-05-05 18:20:44 +08:00
xctr.c Revert "crypto: run initcalls for generic implementations earlier" 2025-05-05 18:20:44 +08:00
xts.c crypto: Fix several spelling mistakes in comments 2026-03-22 11:17:59 +09:00
xxhash_generic.c Revert "crypto: run initcalls for generic implementations earlier" 2025-05-05 18:20:44 +08:00
zstd.c Convert 'alloc_flex' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00