mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-25 19:42:19 +00:00
crypto: testmgr - replace CRYPTO_MANAGER_DISABLE_TESTS with CRYPTO_SELFTESTS
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. Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
@@ -25,9 +25,11 @@ obj-$(CONFIG_CRYPTO_LIB_GF128MUL) += gf128mul.o
|
||||
obj-y += libblake2s.o
|
||||
libblake2s-y := blake2s.o
|
||||
libblake2s-$(CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC) += blake2s-generic.o
|
||||
libblake2s-$(CONFIG_CRYPTO_SELFTESTS) += blake2s-selftest.o
|
||||
|
||||
obj-$(CONFIG_CRYPTO_LIB_CHACHA20POLY1305) += libchacha20poly1305.o
|
||||
libchacha20poly1305-y += chacha20poly1305.o
|
||||
libchacha20poly1305-$(CONFIG_CRYPTO_SELFTESTS) += chacha20poly1305-selftest.o
|
||||
|
||||
obj-$(CONFIG_CRYPTO_LIB_CURVE25519_GENERIC) += libcurve25519-generic.o
|
||||
libcurve25519-generic-y := curve25519-fiat32.o
|
||||
@@ -36,6 +38,7 @@ libcurve25519-generic-y += curve25519-generic.o
|
||||
|
||||
obj-$(CONFIG_CRYPTO_LIB_CURVE25519) += libcurve25519.o
|
||||
libcurve25519-y += curve25519.o
|
||||
libcurve25519-$(CONFIG_CRYPTO_SELFTESTS) += curve25519-selftest.o
|
||||
|
||||
obj-$(CONFIG_CRYPTO_LIB_DES) += libdes.o
|
||||
libdes-y := des.o
|
||||
@@ -57,12 +60,6 @@ libsha256-y := sha256.o
|
||||
obj-$(CONFIG_CRYPTO_LIB_SHA256_GENERIC) += libsha256-generic.o
|
||||
libsha256-generic-y := sha256-generic.o
|
||||
|
||||
ifneq ($(CONFIG_CRYPTO_MANAGER_DISABLE_TESTS),y)
|
||||
libblake2s-y += blake2s-selftest.o
|
||||
libchacha20poly1305-y += chacha20poly1305-selftest.o
|
||||
libcurve25519-y += curve25519-selftest.o
|
||||
endif
|
||||
|
||||
obj-$(CONFIG_MPILIB) += mpi/
|
||||
|
||||
obj-$(CONFIG_CRYPTO_MANAGER_EXTRA_TESTS) += simd.o
|
||||
|
||||
@@ -99,7 +99,7 @@ MODULE_DESCRIPTION("Generic AES-CFB library");
|
||||
MODULE_AUTHOR("Ard Biesheuvel <ardb@kernel.org>");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
#ifndef CONFIG_CRYPTO_MANAGER_DISABLE_TESTS
|
||||
#ifdef CONFIG_CRYPTO_SELFTESTS
|
||||
|
||||
/*
|
||||
* Test code below. Vectors taken from crypto/testmgr.h
|
||||
|
||||
@@ -199,7 +199,7 @@ MODULE_DESCRIPTION("Generic AES-GCM library");
|
||||
MODULE_AUTHOR("Ard Biesheuvel <ardb@kernel.org>");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
#ifndef CONFIG_CRYPTO_MANAGER_DISABLE_TESTS
|
||||
#ifdef CONFIG_CRYPTO_SELFTESTS
|
||||
|
||||
/*
|
||||
* Test code below. Vectors taken from crypto/testmgr.h
|
||||
|
||||
@@ -60,7 +60,7 @@ 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;
|
||||
|
||||
@@ -358,7 +358,7 @@ 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;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user