linux-stable/arch/x86/crypto
Roxana Nicolescu 3a2adf48d8 crypto: x86/sha - load modules based on CPU features
commit 1c43c0f1f8 upstream.

x86 optimized crypto modules are built as modules rather than build-in and
they are not loaded when the crypto API is initialized, resulting in the
generic builtin module (sha1-generic) being used instead.

It was discovered when creating a sha1/sha256 checksum of a 2Gb file by
using kcapi-tools because it would take significantly longer than creating
a sha512 checksum of the same file. trace-cmd showed that for sha1/256 the
generic module was used, whereas for sha512 the optimized module was used
instead.

Add module aliases() for these x86 optimized crypto modules based on CPU
feature bits so udev gets a chance to load them later in the boot
process. This resulted in ~3x decrease in the real-time execution of
kcapi-dsg.

Fix is inspired from commit
aa031b8f70 ("crypto: x86/sha512 - load based on CPU features")
where a similar fix was done for sha512.

Cc: stable@vger.kernel.org # 5.15+
Suggested-by: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
Suggested-by: Julian Andres Klode <julian.klode@canonical.com>
Signed-off-by: Roxana Nicolescu <roxana.nicolescu@canonical.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-11-28 16:56:27 +00:00
..
.gitignore .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
aegis128-aesni-asm.S x86: Prepare asm files for straight-line-speculation 2022-05-15 20:18:49 +02:00
aegis128-aesni-glue.c crypto: remove CRYPTO_TFM_RES_BAD_KEY_LEN 2020-01-09 11:30:53 +08:00
aes_ctrby8_avx-x86_64.S x86: Prepare asm files for straight-line-speculation 2022-05-15 20:18:49 +02:00
aesni-intel_asm.S x86: Prepare asm files for straight-line-speculation 2022-05-15 20:18:49 +02:00
aesni-intel_avx-x86_64.S x86: Prepare asm files for straight-line-speculation 2022-05-15 20:18:49 +02:00
aesni-intel_glue.c crypto: x86/aesni - don't require alignment of data 2022-01-27 11:02:51 +01:00
blake2s-core.S x86: Prepare asm files for straight-line-speculation 2022-05-15 20:18:49 +02:00
blake2s-glue.c crypto: blake2s - remove shash module 2022-08-17 14:24:19 +02:00
blowfish-x86_64-asm_64.S x86: Prepare asm files for straight-line-speculation 2022-05-15 20:18:49 +02:00
blowfish_glue.c crypto: x86/blowfish - drop CTR mode implementation 2021-01-14 17:10:29 +11:00
camellia-aesni-avx-asm_64.S x86: Prepare asm files for straight-line-speculation 2022-05-15 20:18:49 +02:00
camellia-aesni-avx2-asm_64.S x86: Prepare asm files for straight-line-speculation 2022-05-15 20:18:49 +02:00
camellia-x86_64-asm_64.S x86: Prepare asm files for straight-line-speculation 2022-05-15 20:18:49 +02:00
camellia.h crypto: x86 - use local headers for x86 specific shared declarations 2021-01-14 17:10:30 +11:00
camellia_aesni_avx2_glue.c crypto: x86 - use local headers for x86 specific shared declarations 2021-01-14 17:10:30 +11:00
camellia_aesni_avx_glue.c crypto: x86 - use local headers for x86 specific shared declarations 2021-01-14 17:10:30 +11:00
camellia_glue.c crypto: x86 - use local headers for x86 specific shared declarations 2021-01-14 17:10:30 +11:00
cast5-avx-x86_64-asm_64.S x86: Prepare asm files for straight-line-speculation 2022-05-15 20:18:49 +02:00
cast5_avx_glue.c crypto: x86/cast5 - drop dependency on glue helper 2021-01-14 17:10:29 +11:00
cast6-avx-x86_64-asm_64.S x86: Prepare asm files for straight-line-speculation 2022-05-15 20:18:49 +02:00
cast6_avx_glue.c crypto: x86/cast6 - drop dependency on glue helper 2021-01-14 17:10:29 +11:00
chacha-avx2-x86_64.S x86: Prepare asm files for straight-line-speculation 2022-05-15 20:18:49 +02:00
chacha-avx512vl-x86_64.S crypto: x86/chacha20 - Avoid spurious jumps to other functions 2022-05-25 09:57:24 +02:00
chacha-ssse3-x86_64.S x86: Prepare asm files for straight-line-speculation 2022-05-15 20:18:49 +02:00
chacha_glue.c crypto: algapi - Remove skbuff.h inclusion 2020-08-20 14:04:28 +10:00
crc32-pclmul_asm.S x86: Prepare asm files for straight-line-speculation 2022-05-15 20:18:49 +02:00
crc32-pclmul_glue.c x86: Fix various typos in comments, take #2 2021-03-21 23:50:28 +01:00
crc32c-intel_glue.c crypto: x86/crc32c-intel - Use CRC32 mnemonic 2020-08-21 14:45:28 +10:00
crc32c-pcl-intel-asm_64.S x86: Prepare asm files for straight-line-speculation 2022-05-15 20:18:49 +02:00
crct10dif-pcl-asm_64.S x86: Prepare asm files for straight-line-speculation 2022-05-15 20:18:49 +02:00
crct10dif-pclmul_glue.c crypto: Convert to new CPU match macros 2020-03-24 21:36:06 +01:00
curve25519-x86_64.c crypto: x86/curve25519 - fix cpu feature checking logic in mod_exit 2021-06-11 15:03:29 +08:00
des3_ede-asm_64.S x86: Prepare asm files for straight-line-speculation 2022-05-15 20:18:49 +02:00
des3_ede_glue.c crypto: x86/des - drop CTR mode implementation 2021-01-14 17:10:28 +11:00
ecb_cbc_helpers.h crypto: x86 - add some helper macros for ECB and CBC modes 2021-01-14 17:10:29 +11:00
ghash-clmulni-intel_asm.S x86: Prepare asm files for straight-line-speculation 2022-05-15 20:18:49 +02:00
ghash-clmulni-intel_glue.c crypto: x86/ghash - fix unaligned access in ghash_setkey() 2023-03-10 09:39:08 +01:00
glue_helper-asm-avx.S crypto: x86/glue-helper - drop CTR helper routines 2021-01-14 17:10:28 +11:00
glue_helper-asm-avx2.S crypto: x86/glue-helper - drop CTR helper routines 2021-01-14 17:10:28 +11:00
Makefile crypto: blake2s - remove shash module 2022-08-17 14:24:19 +02:00
nh-avx2-x86_64.S x86: Prepare asm files for straight-line-speculation 2022-05-15 20:18:49 +02:00
nh-sse2-x86_64.S x86: Prepare asm files for straight-line-speculation 2022-05-15 20:18:49 +02:00
nhpoly1305-avx2-glue.c crypto: algapi - Remove skbuff.h inclusion 2020-08-20 14:04:28 +10:00
nhpoly1305-sse2-glue.c crypto: algapi - Remove skbuff.h inclusion 2020-08-20 14:04:28 +10:00
poly1305-x86_64-cryptogams.pl crypto: x86/poly1305 - Fixup SLS 2022-05-15 20:18:51 +02:00
poly1305_glue.c crypto: poly1305 - fix poly1305_core_setkey() declaration 2021-04-02 18:28:12 +11:00
serpent-avx-x86_64-asm_64.S x86: Prepare asm files for straight-line-speculation 2022-05-15 20:18:49 +02:00
serpent-avx.h crypto: x86 - use local headers for x86 specific shared declarations 2021-01-14 17:10:30 +11:00
serpent-avx2-asm_64.S x86: Prepare asm files for straight-line-speculation 2022-05-15 20:18:49 +02:00
serpent-sse2-i586-asm_32.S x86: Prepare asm files for straight-line-speculation 2022-05-15 20:18:49 +02:00
serpent-sse2-x86_64-asm_64.S x86: Prepare asm files for straight-line-speculation 2022-05-15 20:18:49 +02:00
serpent-sse2.h crypto: x86 - use local headers for x86 specific shared declarations 2021-01-14 17:10:30 +11:00
serpent_avx2_glue.c crypto: x86 - use local headers for x86 specific shared declarations 2021-01-14 17:10:30 +11:00
serpent_avx_glue.c crypto: x86 - use local headers for x86 specific shared declarations 2021-01-14 17:10:30 +11:00
serpent_sse2_glue.c crypto: x86 - use local headers for x86 specific shared declarations 2021-01-14 17:10:30 +11:00
sha1_avx2_x86_64_asm.S x86: Prepare asm files for straight-line-speculation 2022-05-15 20:18:49 +02:00
sha1_ni_asm.S x86: Prepare asm files for straight-line-speculation 2022-05-15 20:18:49 +02:00
sha1_ssse3_asm.S x86: Prepare asm files for straight-line-speculation 2022-05-15 20:18:49 +02:00
sha1_ssse3_glue.c crypto: x86/sha - load modules based on CPU features 2023-11-28 16:56:27 +00:00
sha256-avx-asm.S x86: Prepare asm files for straight-line-speculation 2022-05-15 20:18:49 +02:00
sha256-avx2-asm.S x86: Prepare asm files for straight-line-speculation 2022-05-15 20:18:49 +02:00
sha256-ssse3-asm.S x86: Prepare asm files for straight-line-speculation 2022-05-15 20:18:49 +02:00
sha256_ni_asm.S x86: Prepare asm files for straight-line-speculation 2022-05-15 20:18:49 +02:00
sha256_ssse3_glue.c crypto: x86/sha - load modules based on CPU features 2023-11-28 16:56:27 +00:00
sha512-avx-asm.S x86: Prepare asm files for straight-line-speculation 2022-05-15 20:18:49 +02:00
sha512-avx2-asm.S x86: Prepare asm files for straight-line-speculation 2022-05-15 20:18:49 +02:00
sha512-ssse3-asm.S x86: Prepare asm files for straight-line-speculation 2022-05-15 20:18:49 +02:00
sha512_ssse3_glue.c crypto: sha - split sha.h into sha1.h and sha2.h 2020-11-20 14:45:33 +11:00
sm4-aesni-avx-asm_64.S x86: Prepare asm files for straight-line-speculation 2022-05-15 20:18:49 +02:00
sm4-aesni-avx2-asm_64.S x86: Prepare asm files for straight-line-speculation 2022-05-15 20:18:49 +02:00
sm4-avx.h crypto: x86/sm4 - export reusable AESNI/AVX functions 2021-08-27 16:30:18 +08:00
sm4_aesni_avx2_glue.c crypto: x86/sm4 - add AES-NI/AVX2/x86_64 implementation 2021-08-27 16:30:18 +08:00
sm4_aesni_avx_glue.c crypto: x86/sm4 - export reusable AESNI/AVX functions 2021-08-27 16:30:18 +08:00
twofish-avx-x86_64-asm_64.S x86: Prepare asm files for straight-line-speculation 2022-05-15 20:18:49 +02:00
twofish-i586-asm_32.S x86: Prepare asm files for straight-line-speculation 2022-05-15 20:18:49 +02:00
twofish-x86_64-asm_64-3way.S x86: Prepare asm files for straight-line-speculation 2022-05-15 20:18:49 +02:00
twofish-x86_64-asm_64.S x86: Prepare asm files for straight-line-speculation 2022-05-15 20:18:49 +02:00
twofish.h crypto: x86 - use local headers for x86 specific shared declarations 2021-01-14 17:10:30 +11:00
twofish_avx_glue.c crypto: x86 - use local headers for x86 specific shared declarations 2021-01-14 17:10:30 +11:00
twofish_glue.c
twofish_glue_3way.c x86: Fix various typos in comments 2021-03-18 15:31:53 +01:00