CONFIG_NLS_UTF8=y
 CONFIG_KEYS=y
 CONFIG_CRYPTO_MANAGER=y
-# CONFIG_CRYPTO_MANAGER_DISABLE_TESTS is not set
+CONFIG_CRYPTO_SELFTESTS=y
 # CONFIG_CRYPTO_ECHAINIV is not set
 CONFIG_CRYPTO_AES=y
 CONFIG_CRYPTO_SEQIV=m
 
 CONFIG_SECURITY_YAMA=y
 CONFIG_DEFAULT_SECURITY_DAC=y
 CONFIG_CRYPTO_USER=m
-# CONFIG_CRYPTO_MANAGER_DISABLE_TESTS is not set
+CONFIG_CRYPTO_SELFTESTS=y
 CONFIG_CRYPTO_PCRYPT=m
 CONFIG_CRYPTO_CRYPTD=m
 CONFIG_CRYPTO_ANUBIS=m
 
 CONFIG_IMA_APPRAISE=y
 CONFIG_BUG_ON_DATA_CORRUPTION=y
 CONFIG_CRYPTO_USER=m
-# CONFIG_CRYPTO_MANAGER_DISABLE_TESTS is not set
+CONFIG_CRYPTO_SELFTESTS=y
 CONFIG_CRYPTO_PCRYPT=m
 CONFIG_CRYPTO_CRYPTD=m
 CONFIG_CRYPTO_BENCHMARK=m
 
 CONFIG_BUG_ON_DATA_CORRUPTION=y
 CONFIG_CRYPTO_FIPS=y
 CONFIG_CRYPTO_USER=m
-# CONFIG_CRYPTO_MANAGER_DISABLE_TESTS is not set
+CONFIG_CRYPTO_SELFTESTS=y
 CONFIG_CRYPTO_PCRYPT=m
 CONFIG_CRYPTO_CRYPTD=m
 CONFIG_CRYPTO_BENCHMARK=m
 
 
 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
 
 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
          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 cryptographic self-tests"
+       depends on DEBUG_KERNEL
        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.
 
        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 */
 
        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();
 
        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))
 
 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
 
 
 {
        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++) {
 
 
 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_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
 
 {
        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)",
 
 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)
 
 /*
  * 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 */
        return alg_fips_disabled(driver, alg);
 }
 
-#endif /* CONFIG_CRYPTO_MANAGER_DISABLE_TESTS */
+#endif /* CONFIG_CRYPTO_SELFTESTS */
 
 EXPORT_SYMBOL_GPL(alg_test);
 
 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
 
 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
 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
 
 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
 
 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
 
 
 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;
 
 
 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;
 
 
 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;