Skip to content

Commit 4964a1d

Browse files
ebiggersherbertx
authored andcommitted
crypto: api - move crypto_simd_disabled_for_test to lib
Move crypto_simd_disabled_for_test to lib/ so that crypto_simd_usable() can be used by library code. This was discussed previously (https://lore.kernel.org/linux-crypto/[email protected]/) but was not done because there was no use case yet. However, this is now needed for the arm64 CRC32 library code. Tested with: export ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- echo CONFIG_CRC32=y > .config echo CONFIG_MODULES=y >> .config echo CONFIG_CRYPTO=m >> .config echo CONFIG_DEBUG_KERNEL=y >> .config echo CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=n >> .config echo CONFIG_CRYPTO_MANAGER_EXTRA_TESTS=y >> .config make olddefconfig make -j$(nproc) Signed-off-by: Eric Biggers <[email protected]> Acked-by: Ard Biesheuvel <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent 53d91ca commit 4964a1d

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

crypto/algapi.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
*/
77

88
#include <crypto/algapi.h>
9-
#include <crypto/internal/simd.h>
109
#include <linux/err.h>
1110
#include <linux/errno.h>
1211
#include <linux/fips.h>
@@ -23,11 +22,6 @@
2322

2423
static LIST_HEAD(crypto_template_list);
2524

26-
#ifdef CONFIG_CRYPTO_MANAGER_EXTRA_TESTS
27-
DEFINE_PER_CPU(bool, crypto_simd_disabled_for_test);
28-
EXPORT_PER_CPU_SYMBOL_GPL(crypto_simd_disabled_for_test);
29-
#endif
30-
3125
static inline void crypto_check_module_sig(struct module *mod)
3226
{
3327
if (fips_enabled && mod && !module_sig_ok(mod))

lib/crypto/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,5 @@ libcurve25519-y += curve25519-selftest.o
5858
endif
5959

6060
obj-$(CONFIG_MPILIB) += mpi/
61+
62+
obj-$(CONFIG_CRYPTO_MANAGER_EXTRA_TESTS) += simd.o

lib/crypto/simd.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// SPDX-License-Identifier: GPL-2.0-or-later
2+
/*
3+
* SIMD testing utility functions
4+
*
5+
* Copyright 2024 Google LLC
6+
*/
7+
8+
#include <crypto/internal/simd.h>
9+
10+
DEFINE_PER_CPU(bool, crypto_simd_disabled_for_test);
11+
EXPORT_PER_CPU_SYMBOL_GPL(crypto_simd_disabled_for_test);

0 commit comments

Comments
 (0)