Commit 7033b937 authored by Eric Biggers's avatar Eric Biggers Committed by Herbert Xu

crypto: lib - create utils module and move __crypto_memneq into it

As requested at
https://lore.kernel.org/r/YtEgzHuuMts0YBCz@gondor.apana.org.au, move
__crypto_memneq into lib/crypto/ and put it under a new tristate.  The
tristate is CRYPTO_LIB_UTILS, and it builds a module libcryptoutils.  As
more crypto library utilities are being added, this creates a single
place for them to go without cluttering up the main lib directory.

The module's main file will be lib/crypto/utils.c.  However, leave
memneq.c as its own file because of its nonstandard license.
Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
Reviewed-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 908f2427
...@@ -15,7 +15,7 @@ source "crypto/async_tx/Kconfig" ...@@ -15,7 +15,7 @@ source "crypto/async_tx/Kconfig"
# #
menuconfig CRYPTO menuconfig CRYPTO
tristate "Cryptographic API" tristate "Cryptographic API"
select LIB_MEMNEQ select CRYPTO_LIB_UTILS
help help
This option provides the core Cryptographic API. This option provides the core Cryptographic API.
......
...@@ -127,9 +127,6 @@ config TRACE_MMIO_ACCESS ...@@ -127,9 +127,6 @@ config TRACE_MMIO_ACCESS
source "lib/crypto/Kconfig" source "lib/crypto/Kconfig"
config LIB_MEMNEQ
bool
config CRC_CCITT config CRC_CCITT
tristate "CRC-CCITT functions" tristate "CRC-CCITT functions"
help help
......
...@@ -253,7 +253,6 @@ obj-$(CONFIG_DIMLIB) += dim/ ...@@ -253,7 +253,6 @@ obj-$(CONFIG_DIMLIB) += dim/
obj-$(CONFIG_SIGNATURE) += digsig.o obj-$(CONFIG_SIGNATURE) += digsig.o
lib-$(CONFIG_CLZ_TAB) += clz_tab.o lib-$(CONFIG_CLZ_TAB) += clz_tab.o
lib-$(CONFIG_LIB_MEMNEQ) += memneq.o
obj-$(CONFIG_GENERIC_STRNCPY_FROM_USER) += strncpy_from_user.o obj-$(CONFIG_GENERIC_STRNCPY_FROM_USER) += strncpy_from_user.o
obj-$(CONFIG_GENERIC_STRNLEN_USER) += strnlen_user.o obj-$(CONFIG_GENERIC_STRNLEN_USER) += strnlen_user.o
......
...@@ -2,6 +2,9 @@ ...@@ -2,6 +2,9 @@
menu "Crypto library routines" menu "Crypto library routines"
config CRYPTO_LIB_UTILS
tristate
config CRYPTO_LIB_AES config CRYPTO_LIB_AES
tristate tristate
...@@ -71,7 +74,7 @@ config CRYPTO_LIB_CURVE25519 ...@@ -71,7 +74,7 @@ config CRYPTO_LIB_CURVE25519
tristate "Curve25519 scalar multiplication library" tristate "Curve25519 scalar multiplication library"
depends on CRYPTO_ARCH_HAVE_LIB_CURVE25519 || !CRYPTO_ARCH_HAVE_LIB_CURVE25519 depends on CRYPTO_ARCH_HAVE_LIB_CURVE25519 || !CRYPTO_ARCH_HAVE_LIB_CURVE25519
select CRYPTO_LIB_CURVE25519_GENERIC if CRYPTO_ARCH_HAVE_LIB_CURVE25519=n select CRYPTO_LIB_CURVE25519_GENERIC if CRYPTO_ARCH_HAVE_LIB_CURVE25519=n
select LIB_MEMNEQ select CRYPTO_LIB_UTILS
help help
Enable the Curve25519 library interface. This interface may be Enable the Curve25519 library interface. This interface may be
fulfilled by either the generic implementation or an arch-specific fulfilled by either the generic implementation or an arch-specific
......
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
obj-$(CONFIG_CRYPTO_LIB_UTILS) += libcryptoutils.o
libcryptoutils-y := memneq.o
# chacha is used by the /dev/random driver which is always builtin # chacha is used by the /dev/random driver which is always builtin
obj-y += chacha.o obj-y += chacha.o
obj-$(CONFIG_CRYPTO_LIB_CHACHA_GENERIC) += libchacha.o obj-$(CONFIG_CRYPTO_LIB_CHACHA_GENERIC) += libchacha.o
......
...@@ -59,8 +59,9 @@ ...@@ -59,8 +59,9 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <crypto/algapi.h>
#include <asm/unaligned.h> #include <asm/unaligned.h>
#include <crypto/algapi.h>
#include <linux/module.h>
#ifndef __HAVE_ARCH_CRYPTO_MEMNEQ #ifndef __HAVE_ARCH_CRYPTO_MEMNEQ
...@@ -174,3 +175,5 @@ noinline unsigned long __crypto_memneq(const void *a, const void *b, ...@@ -174,3 +175,5 @@ noinline unsigned long __crypto_memneq(const void *a, const void *b,
EXPORT_SYMBOL(__crypto_memneq); EXPORT_SYMBOL(__crypto_memneq);
#endif /* __HAVE_ARCH_CRYPTO_MEMNEQ */ #endif /* __HAVE_ARCH_CRYPTO_MEMNEQ */
MODULE_LICENSE("GPL");
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment