From: Eric Biggers <ebiggers@kernel.org>
To: linux-crypto@vger.kernel.org
Subject: [PATCH v3 4/6] crypto: skip kdf_sp800108 self-test when tests disabled
Date: Sun, 13 Nov 2022 16:12:36 -0800 [thread overview]
Message-ID: <20221114001238.163209-5-ebiggers@kernel.org> (raw)
In-Reply-To: <20221114001238.163209-1-ebiggers@kernel.org>
From: Eric Biggers <ebiggers@google.com>
Make kdf_sp800108 honor the CONFIG_CRYPTO_MANAGER_DISABLE_TESTS kconfig
option, so that it doesn't always waste time running its self-test.
Signed-off-by: Eric Biggers <ebiggers@google.com>
---
crypto/kdf_sp800108.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/crypto/kdf_sp800108.c b/crypto/kdf_sp800108.c
index 58edf7797abfb..c6e3ad82d5f7a 100644
--- a/crypto/kdf_sp800108.c
+++ b/crypto/kdf_sp800108.c
@@ -125,9 +125,13 @@ static const struct kdf_testvec kdf_ctr_hmac_sha256_tv_template[] = {
static int __init crypto_kdf108_init(void)
{
- int ret = kdf_test(&kdf_ctr_hmac_sha256_tv_template[0], "hmac(sha256)",
- crypto_kdf108_setkey, crypto_kdf108_ctr_generate);
+ int ret;
+ if (IS_ENABLED(CONFIG_CRYPTO_MANAGER_DISABLE_TESTS))
+ return 0;
+
+ ret = kdf_test(&kdf_ctr_hmac_sha256_tv_template[0], "hmac(sha256)",
+ crypto_kdf108_setkey, crypto_kdf108_ctr_generate);
if (ret) {
if (fips_enabled)
panic("alg: self-tests for CTR-KDF (hmac(sha256)) failed (rc=%d)\n",
--
2.38.1
next prev parent reply other threads:[~2022-11-14 0:13 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-14 0:12 [PATCH v3 0/6] crypto: reduce overhead when self-tests disabled Eric Biggers
2022-11-14 0:12 ` [PATCH v3 1/6] crypto: optimize algorithm registration " Eric Biggers
2022-11-14 0:12 ` [PATCH v3 2/6] crypto: optimize registration of internal algorithms Eric Biggers
2022-11-30 19:04 ` Eric Biggers
2022-12-01 10:19 ` Herbert Xu
2022-11-14 0:12 ` [PATCH v3 3/6] crypto: compile out crypto_boot_test_finished when tests disabled Eric Biggers
2022-11-14 0:12 ` Eric Biggers [this message]
2022-11-14 0:12 ` [PATCH v3 5/6] crypto: silence noisy kdf_sp800108 self-test Eric Biggers
2022-11-14 0:12 ` [PATCH v3 6/6] crypto: compile out test-related algboss code when tests disabled Eric Biggers
2022-11-25 9:44 ` [PATCH v3 0/6] crypto: reduce overhead when self-tests disabled Herbert Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221114001238.163209-5-ebiggers@kernel.org \
--to=ebiggers@kernel.org \
--cc=linux-crypto@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.