summaryrefslogtreecommitdiffstats
path: root/crypto/algapi.c
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2022-11-14 01:12:35 +0100
committerHerbert Xu <herbert@gondor.apana.org.au>2022-11-25 10:39:18 +0100
commit06bd9c967eaac5484c31c3dc6dfbef6183819508 (patch)
tree69ac4ce973d29a0f6720b3cad1f6eb8cad82ce0c /crypto/algapi.c
parentcrypto: algboss - optimize registration of internal algorithms (diff)
downloadlinux-06bd9c967eaac5484c31c3dc6dfbef6183819508.tar.xz
linux-06bd9c967eaac5484c31c3dc6dfbef6183819508.zip
crypto: api - compile out crypto_boot_test_finished when tests disabled
The crypto_boot_test_finished static key is unnecessary when self-tests are disabled in the kconfig, so optimize it out accordingly, along with the entirety of crypto_start_tests(). This mainly avoids the overhead of an unnecessary static_branch_enable() on every boot. Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/algapi.c')
-rw-r--r--crypto/algapi.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/crypto/algapi.c b/crypto/algapi.c
index 851b247f043d..d08f864f08be 100644
--- a/crypto/algapi.c
+++ b/crypto/algapi.c
@@ -454,7 +454,7 @@ int crypto_register_alg(struct crypto_alg *alg)
down_write(&crypto_alg_sem);
larval = __crypto_register_alg(alg, &algs_to_put);
if (!IS_ERR_OR_NULL(larval)) {
- test_started = static_key_enabled(&crypto_boot_test_finished);
+ test_started = crypto_boot_test_finished();
larval->test_started = test_started;
}
up_write(&crypto_alg_sem);
@@ -1253,6 +1253,9 @@ EXPORT_SYMBOL_GPL(crypto_stats_skcipher_decrypt);
static void __init crypto_start_tests(void)
{
+ if (IS_ENABLED(CONFIG_CRYPTO_MANAGER_DISABLE_TESTS))
+ return;
+
for (;;) {
struct crypto_larval *larval = NULL;
struct crypto_alg *q;
@@ -1286,7 +1289,7 @@ static void __init crypto_start_tests(void)
crypto_wait_for_test(larval);
}
- static_branch_enable(&crypto_boot_test_finished);
+ set_crypto_boot_test_finished();
}
static int __init crypto_algapi_init(void)