crypto: move gf128mul library into lib/crypto

The gf128mul library does not depend on the crypto API at all, so it can
be moved into lib/crypto. This will allow us to use it in other library
code in a subsequent patch without having to depend on CONFIG_CRYPTO.

While at it, change the Kconfig symbol name to align with other crypto
library implementations. However, the source file name is retained, as
it is reflected in the module .ko filename, and changing this might
break things for users.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
Ard Biesheuvel 2022-11-03 20:22:57 +01:00 committed by Herbert Xu
parent 329cfa42e5
commit 61c581a46a
8 changed files with 11 additions and 10 deletions

View file

@ -18,7 +18,7 @@ config CRYPTO_GHASH_ARM_CE
depends on KERNEL_MODE_NEON depends on KERNEL_MODE_NEON
select CRYPTO_HASH select CRYPTO_HASH
select CRYPTO_CRYPTD select CRYPTO_CRYPTD
select CRYPTO_GF128MUL select CRYPTO_LIB_GF128MUL
help help
GCM GHASH function (NIST SP800-38D) GCM GHASH function (NIST SP800-38D)

View file

@ -6,8 +6,8 @@ config CRYPTO_GHASH_ARM64_CE
tristate "Hash functions: GHASH (ARMv8 Crypto Extensions)" tristate "Hash functions: GHASH (ARMv8 Crypto Extensions)"
depends on KERNEL_MODE_NEON depends on KERNEL_MODE_NEON
select CRYPTO_HASH select CRYPTO_HASH
select CRYPTO_GF128MUL
select CRYPTO_LIB_AES select CRYPTO_LIB_AES
select CRYPTO_LIB_GF128MUL
select CRYPTO_AEAD select CRYPTO_AEAD
help help
GCM GHASH function (NIST SP800-38D) GCM GHASH function (NIST SP800-38D)

View file

@ -175,9 +175,6 @@ config CRYPTO_MANAGER_EXTRA_TESTS
This is intended for developer use only, as these tests take much This is intended for developer use only, as these tests take much
longer to run than the normal self tests. longer to run than the normal self tests.
config CRYPTO_GF128MUL
tristate
config CRYPTO_NULL config CRYPTO_NULL
tristate "Null algorithms" tristate "Null algorithms"
select CRYPTO_NULL2 select CRYPTO_NULL2
@ -714,9 +711,9 @@ config CRYPTO_KEYWRAP
config CRYPTO_LRW config CRYPTO_LRW
tristate "LRW (Liskov Rivest Wagner)" tristate "LRW (Liskov Rivest Wagner)"
select CRYPTO_LIB_GF128MUL
select CRYPTO_SKCIPHER select CRYPTO_SKCIPHER
select CRYPTO_MANAGER select CRYPTO_MANAGER
select CRYPTO_GF128MUL
select CRYPTO_ECB select CRYPTO_ECB
help help
LRW (Liskov Rivest Wagner) mode LRW (Liskov Rivest Wagner) mode
@ -926,8 +923,8 @@ config CRYPTO_CMAC
config CRYPTO_GHASH config CRYPTO_GHASH
tristate "GHASH" tristate "GHASH"
select CRYPTO_GF128MUL
select CRYPTO_HASH select CRYPTO_HASH
select CRYPTO_LIB_GF128MUL
help help
GCM GHASH function (NIST SP800-38D) GCM GHASH function (NIST SP800-38D)
@ -967,8 +964,8 @@ config CRYPTO_MICHAEL_MIC
config CRYPTO_POLYVAL config CRYPTO_POLYVAL
tristate tristate
select CRYPTO_GF128MUL
select CRYPTO_HASH select CRYPTO_HASH
select CRYPTO_LIB_GF128MUL
help help
POLYVAL hash function for HCTR2 POLYVAL hash function for HCTR2

View file

@ -85,7 +85,6 @@ obj-$(CONFIG_CRYPTO_WP512) += wp512.o
CFLAGS_wp512.o := $(call cc-option,-fno-schedule-insns) # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79149 CFLAGS_wp512.o := $(call cc-option,-fno-schedule-insns) # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79149
obj-$(CONFIG_CRYPTO_BLAKE2B) += blake2b_generic.o obj-$(CONFIG_CRYPTO_BLAKE2B) += blake2b_generic.o
CFLAGS_blake2b_generic.o := -Wframe-larger-than=4096 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105930 CFLAGS_blake2b_generic.o := -Wframe-larger-than=4096 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105930
obj-$(CONFIG_CRYPTO_GF128MUL) += gf128mul.o
obj-$(CONFIG_CRYPTO_ECB) += ecb.o obj-$(CONFIG_CRYPTO_ECB) += ecb.o
obj-$(CONFIG_CRYPTO_CBC) += cbc.o obj-$(CONFIG_CRYPTO_CBC) += cbc.o
obj-$(CONFIG_CRYPTO_CFB) += cfb.o obj-$(CONFIG_CRYPTO_CFB) += cfb.o

View file

@ -3,11 +3,11 @@ config CRYPTO_DEV_CHELSIO
tristate "Chelsio Crypto Co-processor Driver" tristate "Chelsio Crypto Co-processor Driver"
depends on CHELSIO_T4 depends on CHELSIO_T4
select CRYPTO_LIB_AES select CRYPTO_LIB_AES
select CRYPTO_LIB_GF128MUL
select CRYPTO_SHA1 select CRYPTO_SHA1
select CRYPTO_SHA256 select CRYPTO_SHA256
select CRYPTO_SHA512 select CRYPTO_SHA512
select CRYPTO_AUTHENC select CRYPTO_AUTHENC
select CRYPTO_GF128MUL
help help
The Chelsio Crypto Co-processor driver for T6 adapters. The Chelsio Crypto Co-processor driver for T6 adapters.

View file

@ -11,6 +11,9 @@ config CRYPTO_LIB_AES
config CRYPTO_LIB_ARC4 config CRYPTO_LIB_ARC4
tristate tristate
config CRYPTO_LIB_GF128MUL
tristate
config CRYPTO_ARCH_HAVE_LIB_BLAKE2S config CRYPTO_ARCH_HAVE_LIB_BLAKE2S
bool bool
help help

View file

@ -13,6 +13,8 @@ libaes-y := aes.o
obj-$(CONFIG_CRYPTO_LIB_ARC4) += libarc4.o obj-$(CONFIG_CRYPTO_LIB_ARC4) += libarc4.o
libarc4-y := arc4.o libarc4-y := arc4.o
obj-$(CONFIG_CRYPTO_LIB_GF128MUL) += gf128mul.o
# blake2s is used by the /dev/random driver which is always builtin # blake2s is used by the /dev/random driver which is always builtin
obj-y += libblake2s.o obj-y += libblake2s.o
libblake2s-y := blake2s.o libblake2s-y := blake2s.o