linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: linux-crypto@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, "Jason A . Donenfeld " <Jason@zx2c4.com>
Subject: [PATCH v2 3/3] crypto: lib - move crypto_simd_disabled_for_test into utils
Date: Fri, 15 Jul 2022 23:29:20 -0700	[thread overview]
Message-ID: <20220716062920.210381-4-ebiggers@kernel.org> (raw)
In-Reply-To: <20220716062920.210381-1-ebiggers@kernel.org>

From: Eric Biggers <ebiggers@google.com>

Move the definition of crypto_simd_disabled_for_test into
lib/crypto/utils.c so that it can be accessed by library code.

This is needed when code that is shared between a traditional crypto API
implementation and a library implementation is built-in, but
CRYPTO_ALGAPI=m.  The x86 blake2s previously was an example of this
(https://lore.kernel.org/linux-crypto/20220517033630.1182-1-gaochao49@huawei.com/T/#u).
Although that case was resolved by removing the blake2s shash support,
this problem could easily come back in the future, so let's address it.

Signed-off-by: Eric Biggers <ebiggers@google.com>
---
 crypto/algapi.c    | 6 ------
 lib/crypto/utils.c | 6 ++++++
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/crypto/algapi.c b/crypto/algapi.c
index 5c69ff8e8fa5c1..9377dae75b3def 100644
--- a/crypto/algapi.c
+++ b/crypto/algapi.c
@@ -6,7 +6,6 @@
  */
 
 #include <crypto/algapi.h>
-#include <crypto/internal/simd.h>
 #include <linux/err.h>
 #include <linux/errno.h>
 #include <linux/fips.h>
@@ -22,11 +21,6 @@
 
 static LIST_HEAD(crypto_template_list);
 
-#ifdef CONFIG_CRYPTO_MANAGER_EXTRA_TESTS
-DEFINE_PER_CPU(bool, crypto_simd_disabled_for_test);
-EXPORT_PER_CPU_SYMBOL_GPL(crypto_simd_disabled_for_test);
-#endif
-
 static inline void crypto_check_module_sig(struct module *mod)
 {
 	if (fips_enabled && mod && !module_sig_ok(mod))
diff --git a/lib/crypto/utils.c b/lib/crypto/utils.c
index f20bdb2ae88771..e7d99f150d4e61 100644
--- a/lib/crypto/utils.c
+++ b/lib/crypto/utils.c
@@ -6,8 +6,14 @@
  */
 
 #include <crypto/algapi.h>
+#include <crypto/internal/simd.h>
 #include <asm/unaligned.h>
 
+#ifdef CONFIG_CRYPTO_MANAGER_EXTRA_TESTS
+DEFINE_PER_CPU(bool, crypto_simd_disabled_for_test);
+EXPORT_PER_CPU_SYMBOL_GPL(crypto_simd_disabled_for_test);
+#endif
+
 /*
  * XOR @len bytes from @src1 and @src2 together, writing the result to @dst
  * (which may alias one of the sources).  Don't call this directly; call
-- 
2.37.0


  parent reply	other threads:[~2022-07-16  6:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-16  6:29 [PATCH v2 0/3] crypto: lib - create utils module Eric Biggers
2022-07-16  6:29 ` [PATCH v2 1/3] crypto: lib - create utils module and move __crypto_memneq into it Eric Biggers
2022-07-16  6:29 ` [PATCH v2 2/3] crypto: lib - move __crypto_xor into utils Eric Biggers
2022-07-16  6:29 ` Eric Biggers [this message]
2022-07-16 18:32   ` [PATCH v2 3/3] crypto: lib - move crypto_simd_disabled_for_test " Jason A. Donenfeld
2022-07-19  4:34     ` Eric Biggers
2022-07-21  7:01       ` Eric Biggers
2022-07-21  7:36         ` 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=20220716062920.210381-4-ebiggers@kernel.org \
    --to=ebiggers@kernel.org \
    --cc=Jason@zx2c4.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).