Clean up the crypto testing options
Subsystems (14)
Eric Biggers
maintainercover Clean up the crypto testing options
This series reworks the crypto testing kconfig options to fix some longstanding issues:
- Replace the inverted option CONFIG_CRYPTO_MANAGER_DISABLE_TESTS with a regular option CONFIG_CRYPTO_SELFTESTS.
- Make CONFIG_CRYPTO_SELFTESTS enable the full set of tests by default, removing CONFIG_CRYPTO_MANAGER_EXTRA_TESTS.
- Automatically enable CONFIG_CRYPTO_MANAGER when needed for the tests.
- Rename cryptomgr.noextratests to cryptomgr.noslowtests.
- Remove cryptomgr.panic_on_fail, as panic_on_warn can be used instead.
- Rename CONFIG_CRYPTO_TEST to CONFIG_CRYPTO_BENCHMARK.
Eric Biggers (9):
crypto: tcrypt - remove CRYPTO_TEST from defconfigs
crypto: tcrypt - rename CRYPTO_TEST to CRYPTO_BENCHMARK
crypto: testmgr - remove CRYPTO_MANAGER_DISABLE_TESTS from defconfigs
crypto: testmgr - remove panic_on_fail
crypto: testmgr - replace CRYPTO_MANAGER_DISABLE_TESTS with
CRYPTO_SELFTESTS
crypto: testmgr - make it easier to enable the full set of tests
crypto: testmgr - rename noextratests to noslowtests
crypto: Kconfig - make CRYPTO_MANAGER a hidden symbol
crypto: testmgr - enable CRYPTO_MANAGER when CRYPTO_SELFTESTS
arch/arm/configs/exynos_defconfig | 1 - arch/arm/configs/milbeaut_m10v_defconfig | 2 - arch/arm/configs/pxa_defconfig | 2 - arch/arm/configs/spitz_defconfig | 1 - arch/arm64/configs/defconfig | 1 - arch/loongarch/configs/loongson3_defconfig | 1 - arch/m68k/configs/amiga_defconfig | 1 - arch/m68k/configs/apollo_defconfig | 1 - arch/m68k/configs/atari_defconfig | 1 - arch/m68k/configs/bvme6000_defconfig | 1 - arch/m68k/configs/hp300_defconfig | 1 - arch/m68k/configs/mac_defconfig | 1 - arch/m68k/configs/multi_defconfig | 1 - arch/m68k/configs/mvme147_defconfig | 1 - arch/m68k/configs/mvme16x_defconfig | 1 - arch/m68k/configs/q40_defconfig | 1 - arch/m68k/configs/sun3_defconfig | 1 - arch/m68k/configs/sun3x_defconfig | 1 - arch/mips/configs/decstation_64_defconfig | 1 - arch/mips/configs/decstation_defconfig | 1 - arch/mips/configs/decstation_r4k_defconfig | 1 - arch/mips/configs/gpr_defconfig | 1 - arch/mips/configs/ip28_defconfig | 1 - arch/mips/configs/lemote2f_defconfig | 1 - arch/mips/configs/mtx1_defconfig | 1 - arch/mips/configs/rb532_defconfig | 1 - arch/parisc/configs/generic-32bit_defconfig | 1 - arch/parisc/configs/generic-64bit_defconfig | 1 - arch/powerpc/configs/g5_defconfig | 1 - arch/powerpc/configs/powernv_defconfig | 1 - arch/powerpc/configs/ppc64_defconfig | 1 - arch/powerpc/configs/ppc64e_defconfig | 1 - arch/powerpc/configs/ppc6xx_defconfig | 1 - arch/s390/configs/debug_defconfig | 2 - arch/s390/configs/defconfig | 2 - arch/sh/configs/migor_defconfig | 1 - arch/sparc/configs/sparc64_defconfig | 1 - crypto/Kconfig | 44 ++++---- crypto/Makefile | 2 +- crypto/algapi.c | 5 +- crypto/algboss.c | 2 +- crypto/api.c | 3 +- crypto/hkdf.c | 2 +- crypto/internal.h | 5 +- crypto/kdf_sp800108.c | 2 +- crypto/tcrypt.c | 8 +- crypto/tcrypt.h | 4 +- crypto/testmgr.c | 115 +++++--------------- include/crypto/internal/simd.h | 6 +- lib/crypto/Makefile | 10 +- lib/crypto/aescfb.c | 2 +- lib/crypto/aesgcm.c | 2 +- lib/crypto/blake2s.c | 2 +- lib/crypto/chacha20poly1305.c | 2 +- lib/crypto/curve25519.c | 2 +- 55 files changed, 77 insertions(+), 182 deletions(-)
base-commit: bb9c648b334be581a791c7669abaa594e4b5ebb7
Signature · 1 line
2.49.0
Eric Biggers
maintainerPATCH 1/9 crypto: tcrypt - remove CRYPTO_TEST from defconfigs
From: Eric Biggers <[email protected]>
CONFIG_CRYPTO_TEST enables a benchmarking module that is only really useful for developers working on the crypto subsystem. It is in a bunch of defconfigs. But as with most of the other crypto options that tend to be randomly set in defconfigs, it is unlikely that much thought was put into these, especially when placed in "production" defconfigs. Clear it out of the defconfigs for now.
--- arch/arm/configs/exynos_defconfig | 1 - arch/arm/configs/pxa_defconfig | 1 - arch/arm/configs/spitz_defconfig | 1 - arch/arm64/configs/defconfig | 1 - arch/m68k/configs/amiga_defconfig | 1 - arch/m68k/configs/apollo_defconfig | 1 - arch/m68k/configs/atari_defconfig | 1 - arch/m68k/configs/bvme6000_defconfig | 1 - arch/m68k/configs/hp300_defconfig | 1 - arch/m68k/configs/mac_defconfig | 1 - arch/m68k/configs/multi_defconfig | 1 - arch/m68k/configs/mvme147_defconfig | 1 - arch/m68k/configs/mvme16x_defconfig | 1 - arch/m68k/configs/q40_defconfig | 1 - arch/m68k/configs/sun3_defconfig | 1 - arch/m68k/configs/sun3x_defconfig | 1 - arch/mips/configs/gpr_defconfig | 1 - arch/mips/configs/lemote2f_defconfig | 1 - arch/mips/configs/mtx1_defconfig | 1 - arch/mips/configs/rb532_defconfig | 1 - arch/parisc/configs/generic-32bit_defconfig | 1 - arch/powerpc/configs/g5_defconfig | 1 - arch/powerpc/configs/powernv_defconfig | 1 - arch/powerpc/configs/ppc64_defconfig | 1 - arch/powerpc/configs/ppc64e_defconfig | 1 - arch/powerpc/configs/ppc6xx_defconfig | 1 - arch/s390/configs/debug_defconfig | 1 - arch/s390/configs/defconfig | 1 - arch/sparc/configs/sparc64_defconfig | 1 - 29 files changed, 29 deletions(-)
arch/arm/configs/exynos_defconfig +0 -1
@@ -347,11 +347,10 @@ CONFIG_ROOT_NFS=y CONFIG_NLS_CODEPAGE_437=y CONFIG_NLS_ASCII=y CONFIG_NLS_ISO8859_1=y CONFIG_NLS_UTF8=y CONFIG_CRYPTO_USER=m -CONFIG_CRYPTO_TEST=m CONFIG_CRYPTO_DH=m CONFIG_CRYPTO_LRW=m CONFIG_CRYPTO_XTS=m CONFIG_CRYPTO_MD5=m CONFIG_CRYPTO_SHA512=m
arch/arm/configs/pxa_defconfig +0 -1
@@ -637,11 +637,10 @@ CONFIG_NLS_UTF8=m CONFIG_TIMER_STATS=y CONFIG_SECURITY=y CONFIG_CRYPTO_MANAGER=y CONFIG_CRYPTO_CRYPTD=m CONFIG_CRYPTO_AUTHENC=m -CONFIG_CRYPTO_TEST=m CONFIG_CRYPTO_BLOWFISH=m CONFIG_CRYPTO_CAST5=m CONFIG_CRYPTO_CAST6=m CONFIG_CRYPTO_FCRYPT=m CONFIG_CRYPTO_KHAZAD=m
arch/arm/configs/spitz_defconfig +0 -1
@@ -213,11 +213,10 @@ CONFIG_NLS_DEFAULT="cp437" CONFIG_NLS_CODEPAGE_437=y CONFIG_NLS_ISO8859_1=y CONFIG_NLS_UTF8=y CONFIG_DEBUG_KERNEL=y CONFIG_CRYPTO_NULL=m -CONFIG_CRYPTO_TEST=m CONFIG_CRYPTO_ECB=m CONFIG_CRYPTO_SHA256=m CONFIG_CRYPTO_AES=m CONFIG_CRYPTO_ANUBIS=m CONFIG_CRYPTO_ARC4=m
arch/arm64/configs/defconfig +0 -1
@@ -1727,11 +1727,10 @@ CONFIG_ROOT_NFS=y CONFIG_9P_FS=y CONFIG_NLS_CODEPAGE_437=y CONFIG_NLS_ISO8859_1=y CONFIG_SECURITY=y CONFIG_CRYPTO_USER=y -CONFIG_CRYPTO_TEST=m CONFIG_CRYPTO_ECHAINIV=y CONFIG_CRYPTO_MICHAEL_MIC=m CONFIG_CRYPTO_ANSI_CPRNG=y CONFIG_CRYPTO_USER_API_RNG=m CONFIG_CRYPTO_CHACHA20_NEON=m
arch/m68k/configs/amiga_defconfig +0 -1
@@ -549,11 +549,10 @@ CONFIG_NLS_MAC_TURKISH=m CONFIG_DLM=m CONFIG_ENCRYPTED_KEYS=m CONFIG_HARDENED_USERCOPY=y CONFIG_CRYPTO_USER=m CONFIG_CRYPTO_CRYPTD=m -CONFIG_CRYPTO_TEST=m CONFIG_CRYPTO_RSA=m CONFIG_CRYPTO_DH=m CONFIG_CRYPTO_ECDH=m CONFIG_CRYPTO_ECDSA=m CONFIG_CRYPTO_ECRDSA=m
arch/m68k/configs/apollo_defconfig +0 -1
@@ -506,11 +506,10 @@ CONFIG_NLS_MAC_TURKISH=m CONFIG_DLM=m CONFIG_ENCRYPTED_KEYS=m CONFIG_HARDENED_USERCOPY=y CONFIG_CRYPTO_USER=m CONFIG_CRYPTO_CRYPTD=m -CONFIG_CRYPTO_TEST=m CONFIG_CRYPTO_RSA=m CONFIG_CRYPTO_DH=m CONFIG_CRYPTO_ECDH=m CONFIG_CRYPTO_ECDSA=m CONFIG_CRYPTO_ECRDSA=m
arch/m68k/configs/atari_defconfig +0 -1
@@ -526,11 +526,10 @@ CONFIG_NLS_MAC_TURKISH=m CONFIG_DLM=m CONFIG_ENCRYPTED_KEYS=m CONFIG_HARDENED_USERCOPY=y CONFIG_CRYPTO_USER=m CONFIG_CRYPTO_CRYPTD=m -CONFIG_CRYPTO_TEST=m CONFIG_CRYPTO_RSA=m CONFIG_CRYPTO_DH=m CONFIG_CRYPTO_ECDH=m CONFIG_CRYPTO_ECDSA=m CONFIG_CRYPTO_ECRDSA=m
arch/m68k/configs/bvme6000_defconfig +0 -1
@@ -498,11 +498,10 @@ CONFIG_NLS_MAC_TURKISH=m CONFIG_DLM=m CONFIG_ENCRYPTED_KEYS=m CONFIG_HARDENED_USERCOPY=y CONFIG_CRYPTO_USER=m CONFIG_CRYPTO_CRYPTD=m -CONFIG_CRYPTO_TEST=m CONFIG_CRYPTO_RSA=m CONFIG_CRYPTO_DH=m CONFIG_CRYPTO_ECDH=m CONFIG_CRYPTO_ECDSA=m CONFIG_CRYPTO_ECRDSA=m
arch/m68k/configs/hp300_defconfig +0 -1
@@ -508,11 +508,10 @@ CONFIG_NLS_MAC_TURKISH=m CONFIG_DLM=m CONFIG_ENCRYPTED_KEYS=m CONFIG_HARDENED_USERCOPY=y CONFIG_CRYPTO_USER=m CONFIG_CRYPTO_CRYPTD=m -CONFIG_CRYPTO_TEST=m CONFIG_CRYPTO_RSA=m CONFIG_CRYPTO_DH=m CONFIG_CRYPTO_ECDH=m CONFIG_CRYPTO_ECDSA=m CONFIG_CRYPTO_ECRDSA=m
arch/m68k/configs/mac_defconfig +0 -1
@@ -525,11 +525,10 @@ CONFIG_NLS_MAC_TURKISH=m CONFIG_DLM=m CONFIG_ENCRYPTED_KEYS=m CONFIG_HARDENED_USERCOPY=y CONFIG_CRYPTO_USER=m CONFIG_CRYPTO_CRYPTD=m -CONFIG_CRYPTO_TEST=m CONFIG_CRYPTO_RSA=m CONFIG_CRYPTO_DH=m CONFIG_CRYPTO_ECDH=m CONFIG_CRYPTO_ECDSA=m CONFIG_CRYPTO_ECRDSA=m
arch/m68k/configs/multi_defconfig +0 -1
@@ -612,11 +612,10 @@ CONFIG_NLS_MAC_TURKISH=m CONFIG_DLM=m CONFIG_ENCRYPTED_KEYS=m CONFIG_HARDENED_USERCOPY=y CONFIG_CRYPTO_USER=m CONFIG_CRYPTO_CRYPTD=m -CONFIG_CRYPTO_TEST=m CONFIG_CRYPTO_RSA=m CONFIG_CRYPTO_DH=m CONFIG_CRYPTO_ECDH=m CONFIG_CRYPTO_ECDSA=m CONFIG_CRYPTO_ECRDSA=m
arch/m68k/configs/mvme147_defconfig +0 -1
@@ -498,11 +498,10 @@ CONFIG_NLS_MAC_TURKISH=m CONFIG_DLM=m CONFIG_ENCRYPTED_KEYS=m CONFIG_HARDENED_USERCOPY=y CONFIG_CRYPTO_USER=m CONFIG_CRYPTO_CRYPTD=m -CONFIG_CRYPTO_TEST=m CONFIG_CRYPTO_RSA=m CONFIG_CRYPTO_DH=m CONFIG_CRYPTO_ECDH=m CONFIG_CRYPTO_ECDSA=m CONFIG_CRYPTO_ECRDSA=m
arch/m68k/configs/mvme16x_defconfig +0 -1
@@ -499,11 +499,10 @@ CONFIG_NLS_MAC_TURKISH=m CONFIG_DLM=m CONFIG_ENCRYPTED_KEYS=m CONFIG_HARDENED_USERCOPY=y CONFIG_CRYPTO_USER=m CONFIG_CRYPTO_CRYPTD=m -CONFIG_CRYPTO_TEST=m CONFIG_CRYPTO_RSA=m CONFIG_CRYPTO_DH=m CONFIG_CRYPTO_ECDH=m CONFIG_CRYPTO_ECDSA=m CONFIG_CRYPTO_ECRDSA=m
arch/m68k/configs/q40_defconfig +0 -1
@@ -515,11 +515,10 @@ CONFIG_NLS_MAC_TURKISH=m CONFIG_DLM=m CONFIG_ENCRYPTED_KEYS=m CONFIG_HARDENED_USERCOPY=y CONFIG_CRYPTO_USER=m CONFIG_CRYPTO_CRYPTD=m -CONFIG_CRYPTO_TEST=m CONFIG_CRYPTO_RSA=m CONFIG_CRYPTO_DH=m CONFIG_CRYPTO_ECDH=m CONFIG_CRYPTO_ECDSA=m CONFIG_CRYPTO_ECRDSA=m
arch/m68k/configs/sun3_defconfig +0 -1
@@ -496,11 +496,10 @@ CONFIG_NLS_MAC_TURKISH=m CONFIG_DLM=m CONFIG_ENCRYPTED_KEYS=m CONFIG_HARDENED_USERCOPY=y CONFIG_CRYPTO_USER=m CONFIG_CRYPTO_CRYPTD=m -CONFIG_CRYPTO_TEST=m CONFIG_CRYPTO_RSA=m CONFIG_CRYPTO_DH=m CONFIG_CRYPTO_ECDH=m CONFIG_CRYPTO_ECDSA=m CONFIG_CRYPTO_ECRDSA=m
arch/m68k/configs/sun3x_defconfig +0 -1
@@ -496,11 +496,10 @@ CONFIG_NLS_MAC_TURKISH=m CONFIG_DLM=m CONFIG_ENCRYPTED_KEYS=m CONFIG_HARDENED_USERCOPY=y CONFIG_CRYPTO_USER=m CONFIG_CRYPTO_CRYPTD=m -CONFIG_CRYPTO_TEST=m CONFIG_CRYPTO_RSA=m CONFIG_CRYPTO_DH=m CONFIG_CRYPTO_ECDH=m CONFIG_CRYPTO_ECDSA=m CONFIG_CRYPTO_ECRDSA=m
arch/mips/configs/gpr_defconfig +0 -1
@@ -271,11 +271,10 @@ CONFIG_NFS_V4=y CONFIG_ROOT_NFS=y CONFIG_NLS_CODEPAGE_437=y CONFIG_NLS_CODEPAGE_850=y CONFIG_NLS_ISO8859_1=y CONFIG_CRYPTO_AUTHENC=m -CONFIG_CRYPTO_TEST=m CONFIG_CRYPTO_PCBC=m CONFIG_CRYPTO_MD4=m CONFIG_CRYPTO_MICHAEL_MIC=m CONFIG_CRYPTO_SHA512=m CONFIG_CRYPTO_WP512=m
arch/mips/configs/lemote2f_defconfig +0 -1
@@ -295,11 +295,10 @@ CONFIG_NLS_ISO8859_14=m CONFIG_NLS_ISO8859_15=m CONFIG_NLS_KOI8_R=m CONFIG_NLS_KOI8_U=m CONFIG_NLS_UTF8=y CONFIG_CRYPTO_CRYPTD=m -CONFIG_CRYPTO_TEST=m CONFIG_CRYPTO_BLOWFISH=m CONFIG_CRYPTO_CAMELLIA=m CONFIG_CRYPTO_CAST5=m CONFIG_CRYPTO_CAST6=m CONFIG_CRYPTO_FCRYPT=m
arch/mips/configs/mtx1_defconfig +0 -1
@@ -660,11 +660,10 @@ CONFIG_NLS_ISO8859_13=m CONFIG_NLS_ISO8859_14=m CONFIG_NLS_ISO8859_15=m CONFIG_NLS_KOI8_R=m CONFIG_NLS_KOI8_U=m CONFIG_NLS_UTF8=m -CONFIG_CRYPTO_TEST=m CONFIG_CRYPTO_PCBC=m CONFIG_CRYPTO_HMAC=y CONFIG_CRYPTO_MD5=y CONFIG_CRYPTO_MICHAEL_MIC=m CONFIG_CRYPTO_WP512=m
arch/mips/configs/rb532_defconfig +0 -1
@@ -151,9 +151,8 @@ CONFIG_TMPFS=y CONFIG_CONFIGFS_FS=y CONFIG_JFFS2_FS=y CONFIG_JFFS2_SUMMARY=y CONFIG_JFFS2_COMPRESSION_OPTIONS=y CONFIG_SQUASHFS=y -CONFIG_CRYPTO_TEST=m # CONFIG_CRYPTO_HW is not set CONFIG_CRC16=m CONFIG_STRIP_ASM_SYMS=y
arch/parisc/configs/generic-32bit_defconfig +0 -1
@@ -249,11 +249,10 @@ CONFIG_NFS_FS=m CONFIG_NFSD=m CONFIG_CIFS=m CONFIG_CIFS_XATTR=y CONFIG_CIFS_POSIX=y # CONFIG_CIFS_DEBUG is not set -CONFIG_CRYPTO_TEST=m CONFIG_CRYPTO_BLOWFISH=m CONFIG_CRYPTO_CAST5=m CONFIG_CRYPTO_CAST6=m CONFIG_CRYPTO_DES=y CONFIG_CRYPTO_SERPENT=m
arch/powerpc/configs/g5_defconfig +0 -1
@@ -234,11 +234,10 @@ CONFIG_NLS_UTF8=y CONFIG_CRC_T10DIF=y CONFIG_MAGIC_SYSRQ=y CONFIG_DEBUG_KERNEL=y CONFIG_DEBUG_MUTEXES=y CONFIG_BOOTX_TEXT=y -CONFIG_CRYPTO_TEST=m CONFIG_CRYPTO_PCBC=m CONFIG_CRYPTO_HMAC=y CONFIG_CRYPTO_MICHAEL_MIC=m CONFIG_CRYPTO_SHA512=m CONFIG_CRYPTO_WP512=m
arch/powerpc/configs/powernv_defconfig +0 -1
@@ -315,11 +315,10 @@ CONFIG_BLK_DEV_IO_TRACE=y CONFIG_PPC_EMULATED_STATS=y CONFIG_CODE_PATCHING_SELFTEST=y CONFIG_FTR_FIXUP_SELFTEST=y CONFIG_MSI_BITMAP_SELFTEST=y CONFIG_XMON=y -CONFIG_CRYPTO_TEST=m CONFIG_CRYPTO_PCBC=m CONFIG_CRYPTO_HMAC=y CONFIG_CRYPTO_MD5_PPC=m CONFIG_CRYPTO_MICHAEL_MIC=m CONFIG_CRYPTO_SHA1_PPC=m
arch/powerpc/configs/ppc64_defconfig +0 -1
@@ -375,11 +375,10 @@ CONFIG_IMA_KEXEC=y CONFIG_IMA_DEFAULT_HASH_SHA256=y CONFIG_IMA_WRITE_POLICY=y CONFIG_IMA_APPRAISE=y CONFIG_IMA_ARCH_POLICY=y CONFIG_IMA_APPRAISE_MODSIG=y -CONFIG_CRYPTO_TEST=m CONFIG_CRYPTO_BLOWFISH=m CONFIG_CRYPTO_CAST6=m CONFIG_CRYPTO_SERPENT=m CONFIG_CRYPTO_TWOFISH=m CONFIG_CRYPTO_PCBC=m
arch/powerpc/configs/ppc64e_defconfig +0 -1
@@ -219,11 +219,10 @@ CONFIG_SCHED_TRACER=y CONFIG_BLK_DEV_IO_TRACE=y CONFIG_CODE_PATCHING_SELFTEST=y CONFIG_FTR_FIXUP_SELFTEST=y CONFIG_MSI_BITMAP_SELFTEST=y CONFIG_XMON=y -CONFIG_CRYPTO_TEST=m CONFIG_CRYPTO_CCM=m CONFIG_CRYPTO_GCM=m CONFIG_CRYPTO_PCBC=m CONFIG_CRYPTO_HMAC=y CONFIG_CRYPTO_MICHAEL_MIC=m
arch/powerpc/configs/ppc6xx_defconfig +0 -1
@@ -1071,11 +1071,10 @@ CONFIG_SECURITY=y CONFIG_SECURITY_NETWORK=y CONFIG_SECURITY_NETWORK_XFRM=y CONFIG_SECURITY_SELINUX=y CONFIG_SECURITY_SELINUX_BOOTPARAM=y CONFIG_SECURITY_SELINUX_DISABLE=y -CONFIG_CRYPTO_TEST=m CONFIG_CRYPTO_CTS=m CONFIG_CRYPTO_LRW=m CONFIG_CRYPTO_PCBC=m CONFIG_CRYPTO_XTS=m CONFIG_CRYPTO_HMAC=y
arch/s390/configs/debug_defconfig +0 -1
@@ -744,11 +744,10 @@ CONFIG_IMA_APPRAISE=y CONFIG_BUG_ON_DATA_CORRUPTION=y CONFIG_CRYPTO_USER=m # CONFIG_CRYPTO_MANAGER_DISABLE_TESTS is not set CONFIG_CRYPTO_PCRYPT=m CONFIG_CRYPTO_CRYPTD=m -CONFIG_CRYPTO_TEST=m CONFIG_CRYPTO_DH=m CONFIG_CRYPTO_ECDH=m CONFIG_CRYPTO_ECDSA=m CONFIG_CRYPTO_ECRDSA=m CONFIG_CRYPTO_CURVE25519=m
arch/s390/configs/defconfig +0 -1
@@ -730,11 +730,10 @@ CONFIG_BUG_ON_DATA_CORRUPTION=y CONFIG_CRYPTO_FIPS=y CONFIG_CRYPTO_USER=m # CONFIG_CRYPTO_MANAGER_DISABLE_TESTS is not set CONFIG_CRYPTO_PCRYPT=m CONFIG_CRYPTO_CRYPTD=m -CONFIG_CRYPTO_TEST=m CONFIG_CRYPTO_DH=m CONFIG_CRYPTO_ECDH=m CONFIG_CRYPTO_ECDSA=m CONFIG_CRYPTO_ECRDSA=m CONFIG_CRYPTO_CURVE25519=m
arch/sparc/configs/sparc64_defconfig +0 -1
@@ -203,11 +203,10 @@ CONFIG_DETECT_HUNG_TASK=y CONFIG_SCHEDSTATS=y CONFIG_BLK_DEV_IO_TRACE=y CONFIG_UPROBE_EVENTS=y CONFIG_KEYS=y CONFIG_CRYPTO_NULL=m -CONFIG_CRYPTO_TEST=m CONFIG_CRYPTO_LRW=m CONFIG_CRYPTO_PCBC=m CONFIG_CRYPTO_XTS=m CONFIG_CRYPTO_XCBC=y CONFIG_CRYPTO_MD4=y
Signature · 1 line
2.49.0
Eric Biggers
maintainerPATCH 2/9 crypto: tcrypt - rename CRYPTO_TEST to CRYPTO_BENCHMARK
In reply to Eric BiggersFrom: Eric Biggers <[email protected]>
tcrypt is actually a benchmarking module and not the actual tests. This regularly causes confusion. Update the kconfig option name and help text accordingly.
--- crypto/Kconfig | 10 +++++++--- crypto/Makefile | 2 +- crypto/tcrypt.c | 8 ++++---- crypto/tcrypt.h | 4 ++-- 4 files changed, 14 insertions(+), 10 deletions(-)
crypto/Kconfig +7 -3
@@ -244,16 +244,20 @@ config CRYPTO_KRB5ENC help Combined hash and cipher support for Kerberos 5 RFC3961 simplified profile. This is required for Kerberos 5-style encryption, used by sunrpc/NFS and rxrpc/AFS. -config CRYPTO_TEST - tristate "Testing module" +config CRYPTO_BENCHMARK + tristate "Crypto benchmarking module" depends on m || EXPERT select CRYPTO_MANAGER help - Quick & dirty crypto test module. + Quick & dirty crypto benchmarking module. + + This is mainly intended for use by people developing cryptographic + algorithms in the kernel. It should not be enabled in production + kernels. config CRYPTO_SIMD tristate select CRYPTO_CRYPTD
crypto/Makefile +1 -1
@@ -171,11 +171,11 @@ obj-$(CONFIG_CRYPTO_JITTERENTROPY) += jitterentropy_rng.o CFLAGS_jitterentropy.o = -O0 KASAN_SANITIZE_jitterentropy.o = n UBSAN_SANITIZE_jitterentropy.o = n jitterentropy_rng-y := jitterentropy.o jitterentropy-kcapi.o obj-$(CONFIG_CRYPTO_JITTERENTROPY_TESTINTERFACE) += jitterentropy-testing.o -obj-$(CONFIG_CRYPTO_TEST) += tcrypt.o +obj-$(CONFIG_CRYPTO_BENCHMARK) += tcrypt.o obj-$(CONFIG_CRYPTO_GHASH) += ghash-generic.o obj-$(CONFIG_CRYPTO_POLYVAL) += polyval-generic.o obj-$(CONFIG_CRYPTO_USER_API) += af_alg.o obj-$(CONFIG_CRYPTO_USER_API_HASH) += algif_hash.o obj-$(CONFIG_CRYPTO_USER_API_SKCIPHER) += algif_skcipher.o
crypto/tcrypt.c +4 -4
@@ -1,10 +1,10 @@// SPDX-License-Identifier: GPL-2.0-or-later /* -* Quick & dirty crypto testing module. +* Quick & dirty crypto benchmarking module. * -* This will only exist until we have a better testing mechanism +* This will only exist until we have a better benchmarking mechanism * (e.g. a char device). * * Copyright (c) 2002 James Morris <[email protected]> * Copyright (c) 2002 Jean-Francois Dive <[email protected]> * Copyright (c) 2007 Nokia Siemens Networks
@@ -37,11 +37,11 @@#include "internal.h" #include "tcrypt.h" /* -* Need slab memory for testing (size in number of pages). +* Need slab memory for benchmarking (size in number of pages). */ #define TVMEMSIZE 4/* * Used by test_cipher_speed()
@@ -2866,7 +2866,7 @@ module_param(num_mb, uint, 0000);MODULE_PARM_DESC (num_mb,"Number of concurrent requests to be used in mb speed tests (defaults to 8)" );module_param (klen, uint,0 );MODULE_PARM_DESC (klen,"Key length (defaults to 0)" );MODULE_LICENSE ("GPL" ); -MODULE_DESCRIPTION ("Quick & dirty crypto testing module" ); +MODULE_DESCRIPTION ("Quick & dirty crypto benchmarking module" );MODULE_AUTHOR ("James Morris <[email protected]>" );
crypto/tcrypt.h +2 -2
@@ -1,10 +1,10 @@/* SPDX-License-Identifier: GPL-2.0-or-later */ /* -* Quick & dirty crypto testing module. +* Quick & dirty crypto benchmarking module. * -* This will only exist until we have a better testing mechanism +* This will only exist until we have a better benchmarking mechanism * (e.g. a char device). * * Copyright (c) 2002 James Morris <[email protected]> * Copyright (c) 2002 Jean-Francois Dive <[email protected]> * Copyright (c) 2007 Nokia Siemens Networks
Signature · 1 line
2.49.0
Eric Biggers
maintainerPATCH 3/9 crypto: testmgr - remove CRYPTO_MANAGER_DISABLE_TESTS from defconfigs
In reply to Eric BiggersFrom: Eric Biggers <[email protected]>
Unsetting CONFIG_CRYPTO_MANAGER_DISABLE_TESTS enables the crypto self-tests, which are only really useful for developers working on the crypto subsystem. Some defconfigs did this. But as with most of the other crypto options that tend to be randomly set in defconfigs, it is unlikely that much thought was put into these, especially when placed in "production" defconfigs. Clear it out of the defconfigs for now.
--- arch/arm/configs/milbeaut_m10v_defconfig | 1 - arch/loongarch/configs/loongson3_defconfig | 1 - arch/s390/configs/debug_defconfig | 1 - arch/s390/configs/defconfig | 1 - 4 files changed, 4 deletions(-)
arch/arm/configs/milbeaut_m10v_defconfig +0 -1
@@ -92,11 +92,10 @@ CONFIG_CONFIGFS_FS=y CONFIG_NLS_CODEPAGE_437=y CONFIG_NLS_ISO8859_1=y CONFIG_NLS_UTF8=y CONFIG_KEYS=y CONFIG_CRYPTO_MANAGER=y -# CONFIG_CRYPTO_MANAGER_DISABLE_TESTS is not set # CONFIG_CRYPTO_ECHAINIV is not set CONFIG_CRYPTO_AES=y CONFIG_CRYPTO_SEQIV=m CONFIG_CRYPTO_GHASH_ARM_CE=m CONFIG_CRYPTO_SHA1_ARM_NEON=m
arch/loongarch/configs/loongson3_defconfig +0 -1
@@ -1024,11 +1024,10 @@ CONFIG_SECURITY_SELINUX=y CONFIG_SECURITY_SELINUX_BOOTPARAM=y CONFIG_SECURITY_APPARMOR=y CONFIG_SECURITY_YAMA=y CONFIG_DEFAULT_SECURITY_DAC=y CONFIG_CRYPTO_USER=m -# CONFIG_CRYPTO_MANAGER_DISABLE_TESTS is not set CONFIG_CRYPTO_PCRYPT=m CONFIG_CRYPTO_CRYPTD=m CONFIG_CRYPTO_ANUBIS=m CONFIG_CRYPTO_BLOWFISH=m CONFIG_CRYPTO_CAST5=m
arch/s390/configs/debug_defconfig +0 -1
@@ -741,11 +741,10 @@ CONFIG_IMA=y CONFIG_IMA_DEFAULT_HASH_SHA256=y CONFIG_IMA_WRITE_POLICY=y CONFIG_IMA_APPRAISE=y CONFIG_BUG_ON_DATA_CORRUPTION=y CONFIG_CRYPTO_USER=m -# CONFIG_CRYPTO_MANAGER_DISABLE_TESTS is not set CONFIG_CRYPTO_PCRYPT=m CONFIG_CRYPTO_CRYPTD=m CONFIG_CRYPTO_DH=m CONFIG_CRYPTO_ECDH=m CONFIG_CRYPTO_ECDSA=m
arch/s390/configs/defconfig +0 -1
@@ -727,11 +727,10 @@ CONFIG_IMA_DEFAULT_HASH_SHA256=y CONFIG_IMA_WRITE_POLICY=y CONFIG_IMA_APPRAISE=y CONFIG_BUG_ON_DATA_CORRUPTION=y CONFIG_CRYPTO_FIPS=y CONFIG_CRYPTO_USER=m -# CONFIG_CRYPTO_MANAGER_DISABLE_TESTS is not set CONFIG_CRYPTO_PCRYPT=m CONFIG_CRYPTO_CRYPTD=m CONFIG_CRYPTO_DH=m CONFIG_CRYPTO_ECDH=m CONFIG_CRYPTO_ECDSA=m
Signature · 1 line
2.49.0
Eric Biggers
maintainerPATCH 4/9 crypto: testmgr - remove panic_on_fail
In reply to Eric BiggersFrom: Eric Biggers <[email protected]>
The cryptomgr.panic_on_fail=1 kernel command-line parameter is not very useful now that the tests have been fixed to WARN on failure, since developers can just use panic_on_warn=1 instead. There's no need for a special option just for the crypto self-tests. Remove it.
--- crypto/testmgr.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
crypto/testmgr.c +3 -7
@@ -43,13 +43,10 @@ MODULE_IMPORT_NS("CRYPTO_INTERNAL");static bool notests;module_param (notests, bool,0644 );MODULE_PARM_DESC (notests,"disable crypto self-tests" ); -static bool panic_on_fail; -module_param (panic_on_fail, bool,0444 ); -#ifdef CONFIG_CRYPTO_MANAGER_EXTRA_TESTS static bool noextratests;module_param (noextratests, bool,0644 );MODULE_PARM_DESC (noextratests,"disable expensive crypto self-tests" );
@@ -5858,15 +5855,14 @@ int alg_test(const char *driver, const char *alg, u32 type, u32 mask) rc |= alg_test_descs[j].test (alg_test_descs + j, driver, type, mask); test_done:if (rc) { -if (fips_enabled || panic_on_fail) { +if (fips_enabled) {fips_fail_notify (); -panic ("alg: self-tests for %s (%s) failed in %s mode!\n" , - driver, alg, - fips_enabled ?"fips" :"panic_on_fail" ); +panic ("alg: self-tests for %s (%s) failed in fips mode!\n" , + driver, alg); }pr_warn ("alg: self-tests for %s using %s failed (rc=%d)" , alg, driver, rc); WARN(rc != -ENOENT, "alg: self-tests for %s using %s failed (rc=%d)",
Signature · 1 line
2.49.0
Eric Biggers
maintainerPATCH 5/9 crypto: testmgr - replace CRYPTO_MANAGER_DISABLE_TESTS with CRYPTO_SELFTESTS
In reply to Eric BiggersFrom: Eric Biggers <[email protected]>
The negative-sense of CRYPTO_MANAGER_DISABLE_TESTS is a longstanding mistake that regularly causes confusion. Especially bad is that you can have CRYPTO=n && CRYPTO_MANAGER_DISABLE_TESTS=n, which is ambiguous.
Replace CRYPTO_MANAGER_DISABLE_TESTS with CRYPTO_SELFTESTS which has the expected behavior.
The tests continue to be disabled by default.
--- crypto/Kconfig | 23 ++++++++++++++--------- crypto/algapi.c | 4 ++-- crypto/algboss.c | 2 +- crypto/api.c | 3 +-- crypto/hkdf.c | 2 +- crypto/internal.h | 5 ++--- crypto/kdf_sp800108.c | 2 +- crypto/testmgr.c | 12 ++++++------ lib/crypto/Makefile | 8 +++----- lib/crypto/aescfb.c | 2 +- lib/crypto/aesgcm.c | 2 +- lib/crypto/blake2s.c | 2 +- lib/crypto/chacha20poly1305.c | 2 +- lib/crypto/curve25519.c | 2 +- 14 files changed, 36 insertions(+), 35 deletions(-)
crypto/Kconfig +14 -9
@@ -23,11 +23,11 @@ if CRYPTO menu "Crypto core or helper" config CRYPTO_FIPS bool "FIPS 200 compliance" - depends on (CRYPTO_ANSI_CPRNG || CRYPTO_DRBG) && !CRYPTO_MANAGER_DISABLE_TESTS + depends on (CRYPTO_ANSI_CPRNG || CRYPTO_DRBG) && CRYPTO_SELFTESTS depends on (MODULE_SIG || !MODULES) help This option enables the fips boot option which is required if you want the system to operate in a FIPS 200 certification. You should say no unless you know what
@@ -141,12 +141,12 @@ config CRYPTO_ACOMP select CRYPTO_ALGAPI select CRYPTO_ACOMP2 config CRYPTO_HKDF tristate - select CRYPTO_SHA256 if !CONFIG_CRYPTO_MANAGER_DISABLE_TESTS - select CRYPTO_SHA512 if !CONFIG_CRYPTO_MANAGER_DISABLE_TESTS + select CRYPTO_SHA256 if CRYPTO_SELFTESTS + select CRYPTO_SHA512 if CRYPTO_SELFTESTS select CRYPTO_HASH2 config CRYPTO_MANAGER tristate "Cryptographic algorithm manager" select CRYPTO_MANAGER2
@@ -171,20 +171,25 @@ config CRYPTO_USER select CRYPTO_MANAGER help Userspace configuration for cryptographic instantiations such as cbc(aes). -config CRYPTO_MANAGER_DISABLE_TESTS - bool "Disable run-time self tests" - default y +config CRYPTO_SELFTESTS + bool "Enable crypto self-tests" help - Disable run-time self tests that normally take place at - algorithm registration. + Enable the cryptographic self-tests. + + The cryptographic self-tests run at boot time, or at algorithm + registration time if algorithms are dynamically loaded later. + + This is primarily intended for developer use. It should not be + enabled in production kernels, unless you are trying to use these + tests to fulfill a FIPS testing requirement. config CRYPTO_MANAGER_EXTRA_TESTS bool "Enable extra run-time crypto self tests" - depends on DEBUG_KERNEL && !CRYPTO_MANAGER_DISABLE_TESTS && CRYPTO_MANAGER + depends on DEBUG_KERNEL && CRYPTO_SELFTESTS && CRYPTO_MANAGER help Enable extra run-time self tests of registered crypto algorithms, including randomized fuzz tests. This is intended for developer use only, as these tests take much
crypto/algapi.c +2 -2
@@ -273,11 +273,11 @@ static void crypto_alg_finish_registration(struct crypto_alg *alg,static struct crypto_larval *crypto_alloc_test_larval (struct crypto_alg *alg) {struct crypto_larval *larval;if (!IS_ENABLED (CONFIG_CRYPTO_MANAGER ) || -IS_ENABLED (CONFIG_CRYPTO_MANAGER_DISABLE_TESTS ) || + !IS_ENABLED (CONFIG_CRYPTO_SELFTESTS ) || (alg->cra_flags &CRYPTO_ALG_INTERNAL ))return NULL ;/* No self-test needed */ larval =crypto_larval_alloc (alg->cra_name, alg->cra_flags |CRYPTO_ALG_TESTED ,0 );
@@ -1057,11 +1057,11 @@ EXPORT_SYMBOL_GPL(crypto_type_has_alg);static void __init crypto_start_tests (void ) {if (!IS_BUILTIN (CONFIG_CRYPTO_ALGAPI ))return ; -if (IS_ENABLED (CONFIG_CRYPTO_MANAGER_DISABLE_TESTS )) +if (!IS_ENABLED (CONFIG_CRYPTO_SELFTESTS ))return ;set_crypto_boot_test_finished ();for (;;) {
crypto/algboss.c +1 -1
@@ -187,11 +187,11 @@ static int cryptomgr_test(void *data)static int cryptomgr_schedule_test (struct crypto_alg *alg) {struct task_struct *thread;struct crypto_test_param *param; -if (IS_ENABLED (CONFIG_CRYPTO_MANAGER_DISABLE_TESTS )) +if (!IS_ENABLED (CONFIG_CRYPTO_SELFTESTS ))return NOTIFY_DONE ;if (!try_module_get (THIS_MODULE )) goto err;
crypto/api.c +1 -2
@@ -29,12 +29,11 @@ DECLARE_RWSEM(crypto_alg_sem);EXPORT_SYMBOL_GPL (crypto_alg_sem);BLOCKING_NOTIFIER_HEAD (crypto_chain);EXPORT_SYMBOL_GPL (crypto_chain); -#if IS_BUILTIN (CONFIG_CRYPTO_ALGAPI ) && \ - !IS_ENABLED (CONFIG_CRYPTO_MANAGER_DISABLE_TESTS ) +#if IS_BUILTIN (CONFIG_CRYPTO_ALGAPI ) &&IS_ENABLED (CONFIG_CRYPTO_SELFTESTS )DEFINE_STATIC_KEY_FALSE (__crypto_boot_test_finished);#endif static struct crypto_alg *crypto_larval_wait (struct crypto_alg *alg,u32 type,u32 mask);
crypto/hkdf.c +1 -1
@@ -541,11 +541,11 @@ static int hkdf_test(const char *shash, const struct hkdf_testvec *tv)static int __init crypto_hkdf_module_init (void ) {int ret =0 , i; -if (IS_ENABLED (CONFIG_CRYPTO_MANAGER_DISABLE_TESTS )) +if (!IS_ENABLED (CONFIG_CRYPTO_SELFTESTS ))return 0 ;for (i =0 ; i <ARRAY_SIZE (hkdf_sha256_tv); i++) { ret =hkdf_test ("hmac(sha256)" , &hkdf_sha256_tv[i]);if (ret)
crypto/internal.h +2 -3
@@ -65,12 +65,11 @@ extern struct list_head crypto_alg_list;extern struct rw_semaphore crypto_alg_sem;extern struct blocking_notifier_head crypto_chain;int alg_test (const char *driver,const char *alg,u32 type,u32 mask); -#if !IS_BUILTIN (CONFIG_CRYPTO_ALGAPI ) || \ -IS_ENABLED (CONFIG_CRYPTO_MANAGER_DISABLE_TESTS ) +#if !IS_BUILTIN (CONFIG_CRYPTO_ALGAPI ) || !IS_ENABLED (CONFIG_CRYPTO_SELFTESTS )static inline bool crypto_boot_test_finished (void ) {return true; }static inline void set_crypto_boot_test_finished (void )
@@ -85,11 +84,11 @@ static inline bool crypto_boot_test_finished(void)static inline void set_crypto_boot_test_finished (void ) {static_branch_enable (&__crypto_boot_test_finished); }#endif /* !IS_BUILTIN(CONFIG_CRYPTO_ALGAPI) || -* IS_ENABLED(CONFIG_CRYPTO_MANAGER_DISABLE_TESTS) +* !IS_ENABLED(CONFIG_CRYPTO_SELFTESTS) */ #ifdef CONFIG_PROC_FS void __init crypto_init_proc (void ); void __exit crypto_exit_proc(void);
crypto/kdf_sp800108.c +1 -1
@@ -125,11 +125,11 @@ static const struct kdf_testvec kdf_ctr_hmac_sha256_tv_template[] = {static int __init crypto_kdf108_init (void ) {int ret; -if (IS_ENABLED (CONFIG_CRYPTO_MANAGER_DISABLE_TESTS )) +if (!IS_ENABLED (CONFIG_CRYPTO_SELFTESTS ))return 0 ; ret =kdf_test (&kdf_ctr_hmac_sha256_tv_template[0 ],"hmac(sha256)" , crypto_kdf108_setkey, crypto_kdf108_ctr_generate);if (ret) {
crypto/testmgr.c +6 -6
@@ -53,11 +53,11 @@ MODULE_PARM_DESC(noextratests, "disable expensive crypto self-tests");static unsigned int fuzz_iterations =100 ;module_param (fuzz_iterations, uint,0644 );MODULE_PARM_DESC (fuzz_iterations,"number of fuzz test iterations" );#endif -#ifdef CONFIG_CRYPTO_MANAGER_DISABLE_TESTS +#ifndef CONFIG_CRYPTO_SELFTESTS /* a perfect nop */ int alg_test (const char *driver,const char *alg,u32 type,u32 mask) {return 0 ;
@@ -319,14 +319,14 @@ struct testvec_config {#define TESTVEC_CONFIG_NAMELEN 192/* * The following are the lists of testvec_configs to test for each algorithm -* type when the basic crypto self-tests are enabled, i.e. when -* CONFIG_CRYPTO_MANAGER_DISABLE_TESTS is unset. They aim to provide good test -* coverage, while keeping the test time much shorter than the full fuzz tests -* so that the basic tests can be enabled in a wider range of circumstances. +* type when the basic crypto self-tests are enabled. They aim to provide good +* test coverage, while keeping the test time much shorter than the full fuzz +* tests so that the basic tests can be enabled in a wider range of +* circumstances. */ /* Configs for skciphers and aeads */ static const struct testvec_config default_cipher_testvec_configs[] = { {
@@ -5903,8 +5903,8 @@ int alg_test(const char *driver, const char *alg, u32 type, u32 mask)return 0 ; non_fips_alg: return alg_fips_disabled(driver, alg); } -#endif /* CONFIG_CRYPTO_MANAGER_DISABLE_TESTS */ +#endif /* CONFIG_CRYPTO_SELFTESTS */ EXPORT_SYMBOL_GPL (alg_test);
lib/crypto/Makefile +3 -5
@@ -49,15 +49,13 @@ obj-$(CONFIG_CRYPTO_LIB_SHA1) += libsha1.o libsha1-y := sha1.o obj-$(CONFIG_CRYPTO_LIB_SHA256) += libsha256.o libsha256-y := sha256.o -ifneq ($(CONFIG_CRYPTO_MANAGER_DISABLE_TESTS),y) -libblake2s-y += blake2s-selftest.o -libchacha20poly1305-y += chacha20poly1305-selftest.o -libcurve25519-y += curve25519-selftest.o -endif +libblake2s-$(CONFIG_CRYPTO_SELFTESTS) += blake2s-selftest.o +libchacha20poly1305-$(CONFIG_CRYPTO_SELFTESTS) += chacha20poly1305-selftest.o +libcurve25519-$(CONFIG_CRYPTO_SELFTESTS) += curve25519-selftest.o obj-$(CONFIG_MPILIB) += mpi/ obj-$(CONFIG_CRYPTO_MANAGER_EXTRA_TESTS) += simd.o
lib/crypto/aescfb.c +1 -1
@@ -97,11 +97,11 @@ EXPORT_SYMBOL(aescfb_decrypt);MODULE_DESCRIPTION ("Generic AES-CFB library" );MODULE_AUTHOR ("Ard Biesheuvel <[email protected]>" );MODULE_LICENSE ("GPL" ); -#ifndef CONFIG_CRYPTO_MANAGER_DISABLE_TESTS +#ifdef CONFIG_CRYPTO_SELFTESTS /* * Test code below. Vectors taken from crypto/testmgr.h */
lib/crypto/aesgcm.c +1 -1
@@ -197,11 +197,11 @@ EXPORT_SYMBOL(aesgcm_decrypt);MODULE_DESCRIPTION ("Generic AES-GCM library" );MODULE_AUTHOR ("Ard Biesheuvel <[email protected]>" );MODULE_LICENSE ("GPL" ); -#ifndef CONFIG_CRYPTO_MANAGER_DISABLE_TESTS +#ifdef CONFIG_CRYPTO_SELFTESTS /* * Test code below. Vectors taken from crypto/testmgr.h */
lib/crypto/blake2s.c +1 -1
@@ -58,11 +58,11 @@ void blake2s_final(struct blake2s_state *state, u8 *out) }EXPORT_SYMBOL (blake2s_final);static int __init blake2s_mod_init (void ) { -if (!IS_ENABLED (CONFIG_CRYPTO_MANAGER_DISABLE_TESTS ) && +if (IS_ENABLED (CONFIG_CRYPTO_SELFTESTS ) &&WARN_ON (!blake2s_selftest ()))return -ENODEV ;return 0 ; }
lib/crypto/chacha20poly1305.c +1 -1
@@ -353,11 +353,11 @@ bool chacha20poly1305_decrypt_sg_inplace(struct scatterlist *src, size_t src_len }EXPORT_SYMBOL (chacha20poly1305_decrypt_sg_inplace);static int __init chacha20poly1305_init (void ) { -if (!IS_ENABLED (CONFIG_CRYPTO_MANAGER_DISABLE_TESTS ) && +if (IS_ENABLED (CONFIG_CRYPTO_SELFTESTS ) &&WARN_ON (!chacha20poly1305_selftest ()))return -ENODEV ;return 0 ; }
lib/crypto/curve25519.c +1 -1
@@ -13,11 +13,11 @@#include <linux/module.h> #include <linux/init.h> static int __init curve25519_init (void ) { -if (!IS_ENABLED (CONFIG_CRYPTO_MANAGER_DISABLE_TESTS ) && +if (IS_ENABLED (CONFIG_CRYPTO_SELFTESTS ) &&WARN_ON (!curve25519_selftest ()))return -ENODEV ;return 0 ; }
Signature · 1 line
2.49.0
Eric Biggers
maintainerPATCH 6/9 crypto: testmgr - make it easier to enable the full set of tests
In reply to Eric BiggersFrom: Eric Biggers <[email protected]>
Currently the full set of crypto self-tests requires CONFIG_CRYPTO_MANAGER_EXTRA_TESTS=y. This is problematic in two ways. First, developers regularly overlook this option. Second, the description of the tests as "extra" sometimes gives the impression that it is not required that all algorithms pass these tests.
Given that the main use case for the crypto self-tests is for developers, make enabling CONFIG_CRYPTO_SELFTESTS=y just enable the full set of crypto self-tests by default.
The slow tests can still be disabled by adding the command-line parameter cryptomgr.noextratests=1, soon to be renamed to cryptomgr.noslowtests=1. The only known use case for doing this is for people trying to use the crypto self-tests to satisfy the FIPS 140-3 pre-operational self-testing requirements when the kernel is being validated as a FIPS 140-3 cryptographic module.
--- crypto/Kconfig | 10 ------ crypto/testmgr.c | 62 +++------------------------------- include/crypto/internal/simd.h | 6 ++-- lib/crypto/Makefile | 2 +- 4 files changed, 8 insertions(+), 72 deletions(-)
crypto/Kconfig +0 -10
@@ -183,20 +183,10 @@ config CRYPTO_SELFTESTS This is primarily intended for developer use. It should not be enabled in production kernels, unless you are trying to use these tests to fulfill a FIPS testing requirement. -config CRYPTO_MANAGER_EXTRA_TESTS - bool "Enable extra run-time crypto self tests" - depends on DEBUG_KERNEL && CRYPTO_SELFTESTS && CRYPTO_MANAGER - help - Enable extra run-time self tests of registered crypto algorithms, - including randomized fuzz tests. - - This is intended for developer use only, as these tests take much - longer to run than the normal self tests. - config CRYPTO_NULL tristate "Null algorithms" select CRYPTO_NULL2 help These are 'Null' algorithms, used by IPsec, which do nothing.
crypto/testmgr.c +5 -57
218 lines not on this page · raw message
include/crypto/internal/simd.h +2 -4
@@ -42,15 +42,13 @@ void simd_unregister_aeads(struct aead_alg *algs, int count,* crypto_simd_usable() - is it allowed at this time to use SIMD instructions or * access the SIMD register file? * * This delegates to may_use_simd(), except that this also returns false if SIMD * in crypto code has been temporarily disabled on this CPU by the crypto -* self-tests, in order to test the no-SIMD fallback code. This override is -* currently limited to configurations where the extra self-tests are enabled, -* because it might be a bit too invasive to be part of the regular self-tests. +* self-tests, in order to test the no-SIMD fallback code. */ -#ifdef CONFIG_CRYPTO_MANAGER_EXTRA_TESTS +#ifdef CONFIG_CRYPTO_SELFTESTS DECLARE_PER_CPU (bool, crypto_simd_disabled_for_test);#define crypto_simd_usable () \ (may_use_simd() && !this_cpu_read(crypto_simd_disabled_for_test))#else #define crypto_simd_usable () may_use_simd()
lib/crypto/Makefile +1 -1
@@ -55,9 +55,9 @@ libblake2s-$(CONFIG_CRYPTO_SELFTESTS) += blake2s-selftest.o libchacha20poly1305-$(CONFIG_CRYPTO_SELFTESTS) += chacha20poly1305-selftest.o libcurve25519-$(CONFIG_CRYPTO_SELFTESTS) += curve25519-selftest.o obj-$(CONFIG_MPILIB) += mpi/ -obj-$(CONFIG_CRYPTO_MANAGER_EXTRA_TESTS) += simd.o +obj-$(CONFIG_CRYPTO_SELFTESTS) += simd.o obj-$(CONFIG_CRYPTO_LIB_SM3) += libsm3.o libsm3-y := sm3.o
Signature · 1 line
2.49.0
Eric Biggers
maintainerPATCH 7/9 crypto: testmgr - rename noextratests to noslowtests
In reply to Eric BiggersFrom: Eric Biggers <[email protected]>
Rename the noextratests module parameter to noslowtests, and replace other remaining mentions of "extra" in the code with "slow". This addresses confusion regarding the word "extra" like that seen at
https://lore.kernel.org/r/[email protected]/.
--- crypto/testmgr.c | 41 ++++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 21 deletions(-)
crypto/testmgr.c +20 -21
@@ -41,15 +41,15 @@MODULE_IMPORT_NS ("CRYPTO_INTERNAL" );static bool notests;module_param (notests, bool,0644 ); -MODULE_PARM_DESC (notests,"disable crypto self-tests" ); +MODULE_PARM_DESC (notests,"disable all crypto self-tests" ); -static bool noextratests; -module_param (noextratests, bool,0644 ); -MODULE_PARM_DESC (noextratests,"disable expensive crypto self-tests" ); +static bool noslowtests; +module_param (noslowtests, bool,0644 ); +MODULE_PARM_DESC (noslowtests,"disable slow crypto self-tests" );static unsigned int fuzz_iterations =100 ;module_param (fuzz_iterations, uint,0644 );MODULE_PARM_DESC (fuzz_iterations,"number of fuzz test iterations" );
@@ -1672,11 +1672,11 @@ static int test_hash_vec(const struct hash_testvec *vec, unsigned int vec_num, req, desc, tsgl, hashstate);if (err)return err; } -if (!noextratests) { +if (!noslowtests) {struct rnd_state rng;struct testvec_config cfg;char cfgname[TESTVEC_CONFIG_NAMELEN ];init_rnd_state (&rng);
@@ -1762,11 +1762,11 @@ static int test_hash_vs_generic_impl(const char *generic_driver,char vec_name[64 ];struct testvec_config *cfg;char cfgname[TESTVEC_CONFIG_NAMELEN ];int err; -if (noextratests) +if (noslowtests)return 0 ;init_rnd_state (&rng);if (!generic_driver) {/* Use default naming convention? */
@@ -2230,11 +2230,11 @@ static int test_aead_vec(int enc, const struct aead_testvec *vec, req, tsgls);if (err)return err; } -if (!noextratests) { +if (!noslowtests) {struct rnd_state rng;struct testvec_config cfg;char cfgname[TESTVEC_CONFIG_NAMELEN ];init_rnd_state (&rng);
@@ -2250,11 +2250,11 @@ static int test_aead_vec(int enc, const struct aead_testvec *vec, } }return 0 ; } -struct aead_extra_tests_ctx { +struct aead_slow_tests_ctx {struct rnd_state rng;struct aead_request *req;struct crypto_aead *tfm;const struct alg_test_desc *test_desc;struct cipher_test_sglists *tsgls;
@@ -2425,12 +2425,11 @@ static void generate_random_aead_testvec(struct rnd_state *rng,snprintf (name, max_namelen,"\"random: alen=%u plen=%u authsize=%u klen=%u novrfy=%d\"" , vec->alen, vec->plen, authsize, vec->klen, vec->novrfy); } -static void try_to_generate_inauthentic_testvec ( -struct aead_extra_tests_ctx *ctx) +static void try_to_generate_inauthentic_testvec (struct aead_slow_tests_ctx *ctx) {int i;for (i =0 ; i <10 ; i++) { generate_random_aead_testvec(&ctx->rng, ctx->req, &ctx->vec,
@@ -2445,11 +2444,11 @@ static void try_to_generate_inauthentic_testvec(/* * Generate inauthentic test vectors (i.e. ciphertext, AAD pairs that aren't the * result of an encryption with the key) and verify that decryption fails. */ -static int test_aead_inauthentic_inputs (struct aead_extra_tests_ctx *ctx) +static int test_aead_inauthentic_inputs (struct aead_slow_tests_ctx *ctx) {unsigned int i;int err;for (i =0 ; i < fuzz_iterations *8 ; i++) {
@@ -2480,11 +2479,11 @@ static int test_aead_inauthentic_inputs(struct aead_extra_tests_ctx *ctx)/* * Test the AEAD algorithm against the corresponding generic implementation, if * one is available. */ -static int test_aead_vs_generic_impl (struct aead_extra_tests_ctx *ctx) +static int test_aead_vs_generic_impl (struct aead_slow_tests_ctx *ctx) {struct crypto_aead *tfm = ctx->tfm;const char *algname =crypto_aead_alg (tfm)->base.cra_name;const char *driver =crypto_aead_driver_name (tfm);const char *generic_driver = ctx->test_desc->generic_driver;
@@ -2584,19 +2583,19 @@ static int test_aead_vs_generic_impl(struct aead_extra_tests_ctx *ctx)crypto_free_aead (generic_tfm);aead_request_free (generic_req);return err; } -static int test_aead_extra (const struct alg_test_desc *test_desc, -struct aead_request *req, -struct cipher_test_sglists *tsgls) +static int test_aead_slow (const struct alg_test_desc *test_desc, +struct aead_request *req, +struct cipher_test_sglists *tsgls) { -struct aead_extra_tests_ctx *ctx; +struct aead_slow_tests_ctx *ctx;unsigned int i;int err; -if (noextratests) +if (noslowtests)return 0 ; ctx =kzalloc (sizeof (*ctx),GFP_KERNEL );if (!ctx)return -ENOMEM ;
@@ -2699,11 +2698,11 @@ static int alg_test_aead(const struct alg_test_desc *desc, const char *driver, err =test_aead (DECRYPT , suite, req, tsgls);if (err) goto out; - err =test_aead_extra (desc, req, tsgls); + err =test_aead_slow (desc, req, tsgls); out:free_cipher_test_sglists (tsgls);aead_request_free (req);crypto_free_aead (tfm);return err;
@@ -2973,11 +2972,11 @@ static int test_skcipher_vec(int enc, const struct cipher_testvec *vec, req, tsgls);if (err)return err; } -if (!noextratests) { +if (!noslowtests) {struct rnd_state rng;struct testvec_config cfg;char cfgname[TESTVEC_CONFIG_NAMELEN ];init_rnd_state (&rng);
@@ -3075,11 +3074,11 @@ static int test_skcipher_vs_generic_impl(const char *generic_driver,char vec_name[64 ];struct testvec_config *cfg;char cfgname[TESTVEC_CONFIG_NAMELEN ];int err; -if (noextratests) +if (noslowtests)return 0 ;init_rnd_state (&rng);if (!generic_driver) {/* Use default naming convention? */
@@ -5713,11 +5712,11 @@ static void alg_check_testvec_configs(void)static void testmgr_onetime_init (void ) {alg_check_test_descs_order ();alg_check_testvec_configs (); -if (!noextratests) +if (!noslowtests)pr_warn ("alg: full crypto tests enabled. This is intended for developer use only.\n" ); }static int alg_find_test (const char *alg) {
Signature · 1 line
2.49.0
Eric Biggers
maintainerPATCH 8/9 crypto: Kconfig - make CRYPTO_MANAGER a hidden symbol
In reply to Eric BiggersFrom: Eric Biggers <[email protected]>
There is no reason for people configuring the kernel to be asked about CRYPTO_MANAGER, so make it a hidden symbol.
--- arch/arm/configs/milbeaut_m10v_defconfig | 1 - arch/arm/configs/pxa_defconfig | 1 - arch/mips/configs/decstation_64_defconfig | 1 - arch/mips/configs/decstation_defconfig | 1 - arch/mips/configs/decstation_r4k_defconfig | 1 - arch/mips/configs/ip28_defconfig | 1 - arch/parisc/configs/generic-64bit_defconfig | 1 - arch/sh/configs/migor_defconfig | 1 - crypto/Kconfig | 2 +- 9 files changed, 1 insertion(+), 9 deletions(-)
arch/arm/configs/milbeaut_m10v_defconfig +0 -1
@@ -91,11 +91,10 @@ CONFIG_CONFIGFS_FS=y # CONFIG_MISC_FILESYSTEMS is not set CONFIG_NLS_CODEPAGE_437=y CONFIG_NLS_ISO8859_1=y CONFIG_NLS_UTF8=y CONFIG_KEYS=y -CONFIG_CRYPTO_MANAGER=y # CONFIG_CRYPTO_ECHAINIV is not set CONFIG_CRYPTO_AES=y CONFIG_CRYPTO_SEQIV=m CONFIG_CRYPTO_GHASH_ARM_CE=m CONFIG_CRYPTO_SHA1_ARM_NEON=m
arch/arm/configs/pxa_defconfig +0 -1
@@ -634,11 +634,10 @@ CONFIG_NLS_ASCII=m CONFIG_NLS_ISO8859_1=m CONFIG_NLS_ISO8859_15=m CONFIG_NLS_UTF8=m CONFIG_TIMER_STATS=y CONFIG_SECURITY=y -CONFIG_CRYPTO_MANAGER=y CONFIG_CRYPTO_CRYPTD=m CONFIG_CRYPTO_AUTHENC=m CONFIG_CRYPTO_BLOWFISH=m CONFIG_CRYPTO_CAST5=m CONFIG_CRYPTO_CAST6=m
arch/mips/configs/decstation_64_defconfig +0 -1
@@ -166,11 +166,10 @@ CONFIG_NLS_ISO8859_9=m CONFIG_NLS_ISO8859_13=m CONFIG_NLS_ISO8859_14=m CONFIG_NLS_ISO8859_15=m CONFIG_NLS_UTF8=m CONFIG_CRYPTO_RSA=m -CONFIG_CRYPTO_MANAGER=y CONFIG_CRYPTO_CCM=m CONFIG_CRYPTO_GCM=m CONFIG_CRYPTO_CHACHA20POLY1305=m CONFIG_CRYPTO_CTS=m CONFIG_CRYPTO_LRW=m
arch/mips/configs/decstation_defconfig +0 -1
@@ -161,11 +161,10 @@ CONFIG_NLS_ISO8859_9=m CONFIG_NLS_ISO8859_13=m CONFIG_NLS_ISO8859_14=m CONFIG_NLS_ISO8859_15=m CONFIG_NLS_UTF8=m CONFIG_CRYPTO_RSA=m -CONFIG_CRYPTO_MANAGER=y CONFIG_CRYPTO_CCM=m CONFIG_CRYPTO_GCM=m CONFIG_CRYPTO_CHACHA20POLY1305=m CONFIG_CRYPTO_CTS=m CONFIG_CRYPTO_LRW=m
arch/mips/configs/decstation_r4k_defconfig +0 -1
@@ -161,11 +161,10 @@ CONFIG_NLS_ISO8859_9=m CONFIG_NLS_ISO8859_13=m CONFIG_NLS_ISO8859_14=m CONFIG_NLS_ISO8859_15=m CONFIG_NLS_UTF8=m CONFIG_CRYPTO_RSA=m -CONFIG_CRYPTO_MANAGER=y CONFIG_CRYPTO_CCM=m CONFIG_CRYPTO_GCM=m CONFIG_CRYPTO_CHACHA20POLY1305=m CONFIG_CRYPTO_CTS=m CONFIG_CRYPTO_LRW=m
arch/mips/configs/ip28_defconfig +0 -1
@@ -58,8 +58,7 @@ CONFIG_PROC_KCORE=y CONFIG_TMPFS=y CONFIG_TMPFS_POSIX_ACL=y CONFIG_NFS_FS=y CONFIG_NFS_V3_ACL=y CONFIG_ROOT_NFS=y -CONFIG_CRYPTO_MANAGER=y # CONFIG_CRYPTO_HW is not set CONFIG_MAGIC_SYSRQ=y
arch/parisc/configs/generic-64bit_defconfig +0 -1
@@ -281,11 +281,10 @@ CONFIG_NLS_CODEPAGE_1250=m CONFIG_NLS_CODEPAGE_1251=m CONFIG_NLS_ASCII=m CONFIG_NLS_ISO8859_1=m CONFIG_NLS_ISO8859_2=m CONFIG_NLS_UTF8=m -CONFIG_CRYPTO_MANAGER=y CONFIG_CRYPTO_FCRYPT=m CONFIG_CRYPTO_ECB=m CONFIG_CRYPTO_PCBC=m CONFIG_CRYPTO_MD4=m CONFIG_CRYPTO_MD5=y
arch/sh/configs/migor_defconfig +0 -1
@@ -85,9 +85,8 @@ CONFIG_UIO_PDRV_GENIRQ=y CONFIG_PROC_KCORE=y CONFIG_TMPFS=y CONFIG_NFS_FS=y CONFIG_ROOT_NFS=y CONFIG_DEBUG_FS=y -CONFIG_CRYPTO_MANAGER=y # CONFIG_CRYPTO_ANSI_CPRNG is not set # CONFIG_CRYPTO_HW is not set CONFIG_CRC_T10DIF=y
crypto/Kconfig +1 -1
@@ -146,11 +146,11 @@ config CRYPTO_HKDF select CRYPTO_SHA256 if CRYPTO_SELFTESTS select CRYPTO_SHA512 if CRYPTO_SELFTESTS select CRYPTO_HASH2 config CRYPTO_MANAGER - tristate "Cryptographic algorithm manager" + tristate select CRYPTO_MANAGER2 help Create default cryptographic template instantiations such as cbc(aes).
Signature · 1 line
2.49.0
Eric Biggers
maintainerPATCH 9/9 crypto: testmgr - enable CRYPTO_MANAGER when CRYPTO_SELFTESTS
In reply to Eric BiggersFrom: Eric Biggers <[email protected]>
crypto/testmgr.c is compiled only CRYPTO_MANAGER is enabled. To make CRYPTO_SELFTESTS work as expected when CRYPTO_MANAGER doesn't get enabled for another reason, automatically set CRYPTO_MANAGER to the value of CRYPTO_ALGAPI when CRYPTO_SELFTESTS is enabled.
--- crypto/Kconfig | 5 +++-- crypto/algapi.c | 3 +-- 2 files changed, 4 insertions(+), 4 deletions(-)
crypto/Kconfig +3 -2
@@ -147,14 +147,15 @@ config CRYPTO_HKDF select CRYPTO_SHA512 if CRYPTO_SELFTESTS select CRYPTO_HASH2 config CRYPTO_MANAGER tristate + default CRYPTO_ALGAPI if CRYPTO_SELFTESTS select CRYPTO_MANAGER2 help - Create default cryptographic template instantiations such as - cbc(aes). + This provides the support for instantiating templates such as + cbc(aes), and the support for the crypto self-tests. config CRYPTO_MANAGER2 def_tristate CRYPTO_MANAGER || (CRYPTO_MANAGER!=n && CRYPTO_ALGAPI=y) select CRYPTO_ACOMP2 select CRYPTO_AEAD2
crypto/algapi.c +1 -2
@@ -272,12 +272,11 @@ static void crypto_alg_finish_registration(struct crypto_alg *alg,static struct crypto_larval *crypto_alloc_test_larval (struct crypto_alg *alg) {struct crypto_larval *larval; -if (!IS_ENABLED (CONFIG_CRYPTO_MANAGER ) || - !IS_ENABLED (CONFIG_CRYPTO_SELFTESTS ) || +if (!IS_ENABLED (CONFIG_CRYPTO_SELFTESTS ) || (alg->cra_flags &CRYPTO_ALG_INTERNAL ))return NULL ;/* No self-test needed */ larval =crypto_larval_alloc (alg->cra_name, alg->cra_flags |CRYPTO_ALG_TESTED ,0 );
Signature · 1 line
2.49.0
Geert Uytterhoeven
maintainerRe: [PATCH 1/9] crypto: tcrypt - remove CRYPTO_TEST from defconfigs
In reply to Eric BiggersHi Eric,
Quoted 10 lines · Eric Biggers
From: Eric Biggers <[email protected]>
CONFIG_CRYPTO_TESTenables a benchmarking module that is only really useful for developers working on the crypto subsystem. It is in a bunch of defconfigs. But as with most of the other crypto options that tend to be randomly set in defconfigs, it is unlikely that much thought was put into these, especially when placed in "production" defconfigs. Clear it out of the defconfigs for now.Signed-off-by Eric Biggers <[email protected]>
Thanks for your patch!
All of these are modular, so I don't think it's a big issue, even on "production" defconfigs. It just means the test is available when someone feels the urge to run it.
Hence I try to make all tests available as modules in m68k defconfigs.
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds