From: Eric Biggers <ebiggers@kernel.org>
To: linux-crypto@vger.kernel.org
Subject: [PATCH v3 2/6] crypto: optimize registration of internal algorithms
Date: Sun, 13 Nov 2022 16:12:34 -0800 [thread overview]
Message-ID: <20221114001238.163209-3-ebiggers@kernel.org> (raw)
In-Reply-To: <20221114001238.163209-1-ebiggers@kernel.org>
From: Eric Biggers <ebiggers@google.com>
Since algboss always skips testing of algorithms with the
CRYPTO_ALG_INTERNAL flag, there is no need to go through the dance of
creating the test kthread, which creates a lot of overhead. Instead, we
can just directly finish the algorithm registration, like is now done
when self-tests are disabled entirely.
Signed-off-by: Eric Biggers <ebiggers@google.com>
---
crypto/algapi.c | 3 ++-
crypto/algboss.c | 13 +------------
2 files changed, 3 insertions(+), 13 deletions(-)
diff --git a/crypto/algapi.c b/crypto/algapi.c
index 950195e90bfc9..851b247f043d3 100644
--- a/crypto/algapi.c
+++ b/crypto/algapi.c
@@ -278,7 +278,8 @@ 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_MANAGER_DISABLE_TESTS) ||
+ (alg->cra_flags & CRYPTO_ALG_INTERNAL))
return NULL; /* No self-test needed */
larval = crypto_larval_alloc(alg->cra_name,
diff --git a/crypto/algboss.c b/crypto/algboss.c
index eb5fe84efb83e..13d37320a66eb 100644
--- a/crypto/algboss.c
+++ b/crypto/algboss.c
@@ -181,12 +181,8 @@ static int cryptomgr_test(void *data)
goto skiptest;
#endif
- if (type & CRYPTO_ALG_TESTED)
- goto skiptest;
-
err = alg_test(param->driver, param->alg, type, CRYPTO_ALG_TESTED);
-skiptest:
crypto_alg_tested(param->driver, err);
kfree(param);
@@ -197,7 +193,6 @@ static int cryptomgr_schedule_test(struct crypto_alg *alg)
{
struct task_struct *thread;
struct crypto_test_param *param;
- u32 type;
if (!try_module_get(THIS_MODULE))
goto err;
@@ -208,13 +203,7 @@ static int cryptomgr_schedule_test(struct crypto_alg *alg)
memcpy(param->driver, alg->cra_driver_name, sizeof(param->driver));
memcpy(param->alg, alg->cra_name, sizeof(param->alg));
- type = alg->cra_flags;
-
- /* Do not test internal algorithms. */
- if (type & CRYPTO_ALG_INTERNAL)
- type |= CRYPTO_ALG_TESTED;
-
- param->type = type;
+ param->type = alg->cra_flags;
thread = kthread_run(cryptomgr_test, param, "cryptomgr_test");
if (IS_ERR(thread))
--
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 ` Eric Biggers [this message]
2022-11-30 19:04 ` [PATCH v3 2/6] crypto: optimize registration of internal algorithms 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 ` [PATCH v3 4/6] crypto: skip kdf_sp800108 self-test " Eric Biggers
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-3-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.