linux/crypto
Linus Torvalds 370c388319 Crypto library updates for 7.1
- Migrate more hash algorithms from the traditional crypto subsystem
   to lib/crypto/.
 
   Like the algorithms migrated earlier (e.g. SHA-*), this simplifies
   the implementations, improves performance, enables further
   simplifications in calling code, and solves various other issues:
 
     - AES CBC-based MACs (AES-CMAC, AES-XCBC-MAC, and AES-CBC-MAC)
 
         - Support these algorithms in lib/crypto/ using the AES
           library and the existing arm64 assembly code
 
         - Reimplement the traditional crypto API's "cmac(aes)",
           "xcbc(aes)", and "cbcmac(aes)" on top of the library
 
         - Convert mac80211 to use the AES-CMAC library. Note: several
           other subsystems can use it too and will be converted later
 
         - Drop the broken, nonstandard, and likely unused support for
           "xcbc(aes)" with key lengths other than 128 bits
 
         - Enable optimizations by default
 
     - GHASH
 
         - Migrate the standalone GHASH code into lib/crypto/
 
         - Integrate the GHASH code more closely with the very similar
           POLYVAL code, and improve the generic GHASH implementation
           to resist cache-timing attacks and use much less memory
 
         - Reimplement the AES-GCM library and the "gcm" crypto_aead
           template on top of the GHASH library. Remove "ghash" from
           the crypto_shash API, as it's no longer needed
 
         - Enable optimizations by default
 
     - SM3
 
         - Migrate the kernel's existing SM3 code into lib/crypto/, and
           reimplement the traditional crypto API's "sm3" on top of it
 
         - I don't recommend using SM3, but this cleanup is worthwhile
           to organize the code the same way as other algorithms
 
 - Testing improvements
 
     - Add a KUnit test suite for each of the new library APIs
 
     - Migrate the existing ChaCha20Poly1305 test to KUnit
 
     - Make the KUnit all_tests.config enable all crypto library tests
 
     - Move the test kconfig options to the Runtime Testing menu
 
 - Other updates to arch-optimized crypto code
 
     - Optimize SHA-256 for Zhaoxin CPUs using the Padlock Hash Engine
 
     - Remove some MD5 implementations that are no longer worth keeping
 
     - Drop big endian and voluntary preemption support from the arm64
       code, as those configurations are no longer supported on arm64
 
 - Make jitterentropy and samples/tsm-mr use the crypto library APIs
 
 Note: the overall diffstat is neutral, but when the test code is
 excluded it is significantly negative:
 
     Tests:     13 files changed, 1982 insertions(+),  888 deletions(-)
     Non-test: 141 files changed, 2897 insertions(+), 3987 deletions(-)
     All:      154 files changed, 4879 insertions(+), 4875 deletions(-)
 -----BEGIN PGP SIGNATURE-----
 
 iIoEABYIADIWIQSacvsUNc7UX4ntmEPzXCl4vpKOKwUCadWPyxQcZWJpZ2dlcnNA
 a2VybmVsLm9yZwAKCRDzXCl4vpKOK8QCAQD0i98miI1mu01RKuEwrBzmn7L/2sUH
 ReYV/dFDtnN0GwD+KMCiNAM2XTVLRKq5t3OxPHpKZ4y+gZwRowAJeFA02Q8=
 =5rip
 -----END PGP SIGNATURE-----

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

Pull crypto library updates from Eric Biggers:

 - Migrate more hash algorithms from the traditional crypto subsystem to
   lib/crypto/

   Like the algorithms migrated earlier (e.g. SHA-*), this simplifies
   the implementations, improves performance, enables further
   simplifications in calling code, and solves various other issues:

     - AES CBC-based MACs (AES-CMAC, AES-XCBC-MAC, and AES-CBC-MAC)

         - Support these algorithms in lib/crypto/ using the AES library
           and the existing arm64 assembly code

         - Reimplement the traditional crypto API's "cmac(aes)",
           "xcbc(aes)", and "cbcmac(aes)" on top of the library

         - Convert mac80211 to use the AES-CMAC library. Note: several
           other subsystems can use it too and will be converted later

         - Drop the broken, nonstandard, and likely unused support for
           "xcbc(aes)" with key lengths other than 128 bits

         - Enable optimizations by default

     - GHASH

         - Migrate the standalone GHASH code into lib/crypto/

         - Integrate the GHASH code more closely with the very similar
           POLYVAL code, and improve the generic GHASH implementation to
           resist cache-timing attacks and use much less memory

         - Reimplement the AES-GCM library and the "gcm" crypto_aead
           template on top of the GHASH library. Remove "ghash" from the
           crypto_shash API, as it's no longer needed

         - Enable optimizations by default

     - SM3

         - Migrate the kernel's existing SM3 code into lib/crypto/, and
           reimplement the traditional crypto API's "sm3" on top of it

         - I don't recommend using SM3, but this cleanup is worthwhile
           to organize the code the same way as other algorithms

 - Testing improvements:

     - Add a KUnit test suite for each of the new library APIs

     - Migrate the existing ChaCha20Poly1305 test to KUnit

     - Make the KUnit all_tests.config enable all crypto library tests

     - Move the test kconfig options to the Runtime Testing menu

 - Other updates to arch-optimized crypto code:

     - Optimize SHA-256 for Zhaoxin CPUs using the Padlock Hash Engine

     - Remove some MD5 implementations that are no longer worth keeping

     - Drop big endian and voluntary preemption support from the arm64
       code, as those configurations are no longer supported on arm64

 - Make jitterentropy and samples/tsm-mr use the crypto library APIs

* tag 'libcrypto-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux: (66 commits)
  lib/crypto: arm64: Assume a little-endian kernel
  arm64: fpsimd: Remove obsolete cond_yield macro
  lib/crypto: arm64/sha3: Remove obsolete chunking logic
  lib/crypto: arm64/sha512: Remove obsolete chunking logic
  lib/crypto: arm64/sha256: Remove obsolete chunking logic
  lib/crypto: arm64/sha1: Remove obsolete chunking logic
  lib/crypto: arm64/poly1305: Remove obsolete chunking logic
  lib/crypto: arm64/gf128hash: Remove obsolete chunking logic
  lib/crypto: arm64/chacha: Remove obsolete chunking logic
  lib/crypto: arm64/aes: Remove obsolete chunking logic
  lib/crypto: Include <crypto/utils.h> instead of <crypto/algapi.h>
  lib/crypto: aesgcm: Don't disable IRQs during AES block encryption
  lib/crypto: aescfb: Don't disable IRQs during AES block encryption
  lib/crypto: tests: Migrate ChaCha20Poly1305 self-test to KUnit
  lib/crypto: sparc: Drop optimized MD5 code
  lib/crypto: mips: Drop optimized MD5 code
  lib: Move crypto library tests to Runtime Testing menu
  crypto: sm3 - Remove 'struct sm3_state'
  crypto: sm3 - Remove the original "sm3_block_generic()"
  crypto: sm3 - Remove sm3_base.h
  ...
2026-04-13 17:31:39 -07:00
..
asymmetric_keys X.509: Fix out-of-bounds access when parsing extensions 2026-04-12 13:38:19 +08:00
async_tx lib/raid6: replace custom zero page with ZERO_PAGE 2025-07-09 22:57:54 -07:00
krb5 kernel.h: drop hex.h and update all hex.h users 2026-01-20 19:44:19 -08:00
842.c crypto: comp - Use same definition of context alloc and free ops 2025-09-20 20:21:03 +08:00
acompress.c Locking updates for v6.20: 2026-02-10 12:28:44 -08:00
adiantum.c crypto: adiantum - Drop support for asynchronous xchacha ciphers 2026-01-12 11:07:50 -08:00
aead.c crypto: api - remove unnecessary forward declarations 2026-01-23 13:48:43 +08:00
aegis-neon.h crypto: aegis128-neon - add header for internal prototypes 2023-05-24 18:12:33 +08:00
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-neon - add header for internal prototypes 2023-05-24 18:12:33 +08: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 cmac, xcbc, and cbcmac algorithms using library 2026-03-09 13:27:20 -07:00
af_alg.c crypto: af_alg - Fix page reassignment overflow in af_alg_pull_tsgl 2026-04-12 13:38:19 +08:00
ahash.c crypto: api - remove unnecessary forward declarations 2026-01-23 13:48:43 +08:00
akcipher.c crypto: api - remove unnecessary forward declarations 2026-01-23 13:48:43 +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: algif_aead - Fix minimum RX size check for decryption 2026-04-12 13:38:19 +08:00
algif_hash.c crypto: af_alg - zero initialize memory allocated via sock_kmalloc 2025-10-17 16:03:57 +08:00
algif_rng.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
algif_skcipher.c crypto: af_alg - limit RX SG extraction by receive buffer budget 2026-04-03 08:54:14 +08:00
anubis.c crypto: anubis - simplify return statement in anubis_mod_init 2025-09-20 20:21:04 +08:00
api.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08: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 - Do not place hiseq at end of dst for out-of-place decryption 2026-03-31 17:11:48 +09: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 crypto: Add missing MODULE_DESCRIPTION() macros 2024-05-31 17:34:56 +08:00
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 Revert "crypto: run initcalls for generic implementations earlier" 2025-05-05 18:20:44 +08:00
chacha.c crypto: chacha - register only "-lib" drivers 2025-08-29 09:50:19 -07:00
chacha20poly1305.c Revert "crypto: run initcalls for generic implementations earlier" 2025-05-05 18:20:44 +08:00
cipher.c module: Convert symbol namespace to string literal 2024-12-02 11:34:44 -08:00
cmac.c Revert "crypto: run initcalls for generic implementations earlier" 2025-05-05 18:20:44 +08: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/crc32[c]: register only "-lib" drivers 2025-06-30 09:31:56 -07:00
cryptd.c crypto: cryptd - WQ_PERCPU added to alloc_workqueue users 2025-09-13 12:11:06 +08:00
crypto_engine.c Locking updates for v6.20: 2026-02-10 12:28:44 -08:00
crypto_null.c crypto: null - use memcpy_sglist() 2025-05-12 13:32:53 +08:00
crypto_user.c crypto: aes - Replace aes-generic with wrapper around lib 2026-01-12 11:39:58 -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
df_sp80090a.c crypto: drbg - Use new AES library API 2026-01-15 14:09:08 -08:00
dh_helper.c crypto: dh - split out deserialization code from crypto_dh_decode() 2022-03-03 10:47:50 +12:00
dh.c Revert "crypto: run initcalls for generic implementations earlier" 2025-05-05 18:20:44 +08:00
drbg.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
ecb.c Revert "crypto: run initcalls for generic implementations earlier" 2025-05-05 18:20:44 +08:00
ecc_curve_defs.h crypto: ecc - Add NIST P521 curve parameters 2024-04-12 15:07:52 +08:00
ecc.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -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 crypto: ecc - Add nbits field to ecc_curve structure 2024-04-12 15:07:52 +08:00
ecrdsa_params.asn1
ecrdsa_pub_key.asn1
ecrdsa.c crypto: ecdsa - Fix NIST P521 key size reported by KEYCTL_PKEY_QUERY 2025-04-16 15:16:21 +08:00
essiv.c crypto: essiv - Check ssize for decryption and in-place encryption 2025-10-09 15:02:35 +08:00
fcrypt.c Revert "crypto: run initcalls for generic implementations earlier" 2025-05-05 18:20:44 +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 - use memcpy_sglist() instead of null skcipher 2025-05-12 13:32:53 +08:00
hash.h crypto: remove CONFIG_CRYPTO_STATS 2024-04-02 10:49:38 +08:00
hctr2.c lib/crypto: gf128hash: Rename polyval module to gf128hash 2026-03-23 13:15:13 -07:00
hmac.c crypto: hmac - Add ahash support 2025-05-19 13:48:20 +08:00
internal.h crypto: Enable context analysis 2026-01-05 16:43:36 +01:00
jitterentropy-kcapi.c crypto: jitterentropy - Use SHA-3 library 2026-03-09 13:27:21 -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 - Use SHA-3 library 2026-03-09 13:27:21 -07:00
jitterentropy.h crypto: jitterentropy - Use SHA-3 library 2026-03-09 13:27:21 -07:00
Kconfig Crypto library updates for 7.1 2026-04-13 17:31:39 -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 - remove unnecessary forward declarations 2026-01-23 13:48:43 +08:00
krb5enc.c Revert "crypto: run initcalls for generic implementations earlier" 2025-05-05 18:20:44 +08:00
lrw.c crypto: lrw - Only add ecb if it is not already there 2025-05-19 13:48:20 +08:00
lskcipher.c crypto: lskcipher - Use unregister_lskciphers in register_lskciphers 2026-01-23 13:48:42 +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 Crypto library updates for 7.1 2026-04-13 17:31:39 -07: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
michael_mic.c Revert "crypto: run initcalls for generic implementations earlier" 2025-05-05 18:20:44 +08:00
mldsa.c crypto: Add ML-DSA crypto_sig support 2026-01-21 22:32:50 +00:00
pcbc.c Revert "crypto: run initcalls for generic implementations earlier" 2025-05-05 18:20:44 +08:00
pcrypt.c crypto: pcrypt - Optimize pcrypt_aead_init_tfm() 2025-06-13 17:26:17 +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 - Use unregister_rngs in register_rngs 2026-02-06 18:52:22 +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 treewide: Add SPDX identifier to IETF ASN.1 modules 2023-10-27 18:04:28 +08:00
rsapubkey.asn1 treewide: Add SPDX identifier to IETF ASN.1 modules 2023-10-27 18:04:28 +08:00
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 Locking updates for v6.20: 2026-02-10 12:28:44 -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 crypto: api - remove unnecessary forward declarations 2026-01-23 13:48:43 +08:00
sig.c crypto: api - Add support for duplicating algorithms before registration 2025-04-16 15:36:24 +08:00
simd.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
skcipher.c crypto: api - remove unnecessary forward declarations 2026-01-23 13:48:43 +08:00
skcipher.h crypto: remove CONFIG_CRYPTO_STATS 2024-04-02 10:49:38 +08:00
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 move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
streebog_generic.c Revert "crypto: run initcalls for generic implementations earlier" 2025-05-05 18:20:44 +08:00
tcrypt.c crypto: ghash - Remove ghash from crypto_shash API 2026-03-23 16:44:30 -07:00
tcrypt.h crypto: tcrypt - Remove unused poly1305 support 2025-11-22 10:04:50 +08:00
tea.c Revert "crypto: run initcalls for generic implementations earlier" 2025-05-05 18:20:44 +08:00
testmgr.c crypto: sm3 - Replace with wrapper around library 2026-03-23 17:50:59 -07:00
testmgr.h crypto: ghash - Remove ghash from crypto_shash API 2026-03-23 16:44:30 -07:00
twofish_common.c crypto: Prepare to move crypto_tfm_ctx 2022-12-02 18:12:40 +08:00
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
xor.c crypto: xor - fix template benchmarking 2024-08-02 20:53:25 +08:00
xts.c crypto: xts - Only add ecb if it is not already there 2025-05-19 13:48:20 +08: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