]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
crypto: arm - move library functions to arch/arm/lib/crypto/
authorEric Biggers <ebiggers@google.com>
Tue, 22 Apr 2025 15:27:08 +0000 (08:27 -0700)
committerHerbert Xu <herbert@gondor.apana.org.au>
Mon, 28 Apr 2025 11:40:53 +0000 (19:40 +0800)
Continue disentangling the crypto library functions from the generic
crypto infrastructure by moving the arm BLAKE2s, ChaCha, and Poly1305
library functions into a new directory arch/arm/lib/crypto/ that does
not depend on CRYPTO.  This mirrors the distinction between crypto/ and
lib/crypto/.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
15 files changed:
MAINTAINERS
arch/arm/crypto/Kconfig
arch/arm/crypto/Makefile
arch/arm/lib/Makefile
arch/arm/lib/crypto/.gitignore [new file with mode: 0644]
arch/arm/lib/crypto/Kconfig [new file with mode: 0644]
arch/arm/lib/crypto/Makefile [new file with mode: 0644]
arch/arm/lib/crypto/blake2s-core.S [moved from arch/arm/crypto/blake2s-core.S with 100% similarity]
arch/arm/lib/crypto/blake2s-glue.c [moved from arch/arm/crypto/blake2s-glue.c with 100% similarity]
arch/arm/lib/crypto/chacha-glue.c [moved from arch/arm/crypto/chacha-glue.c with 100% similarity]
arch/arm/lib/crypto/chacha-neon-core.S [moved from arch/arm/crypto/chacha-neon-core.S with 100% similarity]
arch/arm/lib/crypto/chacha-scalar-core.S [moved from arch/arm/crypto/chacha-scalar-core.S with 100% similarity]
arch/arm/lib/crypto/poly1305-armv4.pl [moved from arch/arm/crypto/poly1305-armv4.pl with 100% similarity]
arch/arm/lib/crypto/poly1305-glue.c [moved from arch/arm/crypto/poly1305-glue.c with 100% similarity]
lib/crypto/Kconfig

index a2604c13f11b4d85f80732837bd03bbefb71f49e..d0d1968e323aa8042299658baa3cb4083b338600 100644 (file)
@@ -6288,6 +6288,7 @@ T:        git git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6.git
 F:     Documentation/crypto/
 F:     Documentation/devicetree/bindings/crypto/
 F:     arch/*/crypto/
+F:     arch/*/lib/crypto/
 F:     crypto/
 F:     drivers/crypto/
 F:     include/crypto/
index 3530e7c80793a1e75ae668601758182d00240824..1f889d6bab77debc386cb6023157437b4247a8b4 100644 (file)
@@ -46,24 +46,6 @@ config CRYPTO_NHPOLY1305_NEON
          Architecture: arm using:
          - NEON (Advanced SIMD) extensions
 
-config CRYPTO_POLY1305_ARM
-       tristate
-       select CRYPTO_ARCH_HAVE_LIB_POLY1305
-       default CRYPTO_LIB_POLY1305_INTERNAL
-
-config CRYPTO_BLAKE2S_ARM
-       bool "Hash functions: BLAKE2s"
-       select CRYPTO_ARCH_HAVE_LIB_BLAKE2S
-       help
-         BLAKE2s cryptographic hash function (RFC 7693)
-
-         Architecture: arm
-
-         This is faster than the generic implementations of BLAKE2s and
-         BLAKE2b, but slower than the NEON implementation of BLAKE2b.
-         There is no NEON implementation of BLAKE2s, since NEON doesn't
-         really help with it.
-
 config CRYPTO_BLAKE2B_NEON
        tristate "Hash functions: BLAKE2b (NEON)"
        depends on KERNEL_MODE_NEON
@@ -206,10 +188,5 @@ config CRYPTO_AES_ARM_CE
          Architecture: arm using:
          - ARMv8 Crypto Extensions
 
-config CRYPTO_CHACHA20_NEON
-       tristate
-       select CRYPTO_ARCH_HAVE_LIB_CHACHA
-       default CRYPTO_LIB_CHACHA_INTERNAL
-
 endmenu
 
index 3d0e23ff9e7465391dc9a0065645f16833541f62..ecabe6603e08046071facffb7e887fb27623d67c 100644 (file)
@@ -9,10 +9,7 @@ obj-$(CONFIG_CRYPTO_SHA1_ARM) += sha1-arm.o
 obj-$(CONFIG_CRYPTO_SHA1_ARM_NEON) += sha1-arm-neon.o
 obj-$(CONFIG_CRYPTO_SHA256_ARM) += sha256-arm.o
 obj-$(CONFIG_CRYPTO_SHA512_ARM) += sha512-arm.o
-obj-$(CONFIG_CRYPTO_BLAKE2S_ARM) += libblake2s-arm.o
 obj-$(CONFIG_CRYPTO_BLAKE2B_NEON) += blake2b-neon.o
-obj-$(CONFIG_CRYPTO_CHACHA20_NEON) += chacha-neon.o
-obj-$(CONFIG_CRYPTO_POLY1305_ARM) += poly1305-arm.o
 obj-$(CONFIG_CRYPTO_NHPOLY1305_NEON) += nhpoly1305-neon.o
 obj-$(CONFIG_CRYPTO_CURVE25519_NEON) += curve25519-neon.o
 
@@ -29,15 +26,11 @@ sha256-arm-neon-$(CONFIG_KERNEL_MODE_NEON) := sha256_neon_glue.o
 sha256-arm-y   := sha256-core.o sha256_glue.o $(sha256-arm-neon-y)
 sha512-arm-neon-$(CONFIG_KERNEL_MODE_NEON) := sha512-neon-glue.o
 sha512-arm-y   := sha512-core.o sha512-glue.o $(sha512-arm-neon-y)
-libblake2s-arm-y:= blake2s-core.o blake2s-glue.o
 blake2b-neon-y  := blake2b-neon-core.o blake2b-neon-glue.o
 sha1-arm-ce-y  := sha1-ce-core.o sha1-ce-glue.o
 sha2-arm-ce-y  := sha2-ce-core.o sha2-ce-glue.o
 aes-arm-ce-y   := aes-ce-core.o aes-ce-glue.o
 ghash-arm-ce-y := ghash-ce-core.o ghash-ce-glue.o
-chacha-neon-y := chacha-scalar-core.o chacha-glue.o
-chacha-neon-$(CONFIG_KERNEL_MODE_NEON) += chacha-neon-core.o
-poly1305-arm-y := poly1305-core.o poly1305-glue.o
 nhpoly1305-neon-y := nh-neon-core.o nhpoly1305-neon-glue.o
 curve25519-neon-y := curve25519-core.o curve25519-glue.o
 
@@ -47,14 +40,9 @@ quiet_cmd_perl = PERL    $@
 $(obj)/%-core.S: $(src)/%-armv4.pl
        $(call cmd,perl)
 
-clean-files += poly1305-core.S sha256-core.S sha512-core.S
+clean-files += sha256-core.S sha512-core.S
 
 aflags-thumb2-$(CONFIG_THUMB2_KERNEL)  := -U__thumb2__ -D__thumb2__=1
 
 AFLAGS_sha256-core.o += $(aflags-thumb2-y)
 AFLAGS_sha512-core.o += $(aflags-thumb2-y)
-
-# massage the perlasm code a bit so we only get the NEON routine if we need it
-poly1305-aflags-$(CONFIG_CPU_V7) := -U__LINUX_ARM_ARCH__ -D__LINUX_ARM_ARCH__=5
-poly1305-aflags-$(CONFIG_KERNEL_MODE_NEON) := -U__LINUX_ARM_ARCH__ -D__LINUX_ARM_ARCH__=7
-AFLAGS_poly1305-core.o += $(poly1305-aflags-y) $(aflags-thumb2-y)
index 007874320937d840e0552a0f1e4184b7afece07b..39ffabd3cf2a25713159ea5331fa1b8cce01307c 100644 (file)
@@ -5,6 +5,8 @@
 # Copyright (C) 1995-2000 Russell King
 #
 
+obj-y += crypto/
+
 lib-y          := changebit.o csumipv6.o csumpartial.o               \
                   csumpartialcopy.o csumpartialcopyuser.o clearbit.o \
                   delay.o delay-loop.o findbit.o memchr.o memcpy.o   \
diff --git a/arch/arm/lib/crypto/.gitignore b/arch/arm/lib/crypto/.gitignore
new file mode 100644 (file)
index 0000000..0d47d4f
--- /dev/null
@@ -0,0 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
+poly1305-core.S
diff --git a/arch/arm/lib/crypto/Kconfig b/arch/arm/lib/crypto/Kconfig
new file mode 100644 (file)
index 0000000..181f138
--- /dev/null
@@ -0,0 +1,24 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
+config CRYPTO_BLAKE2S_ARM
+       bool "Hash functions: BLAKE2s"
+       select CRYPTO_ARCH_HAVE_LIB_BLAKE2S
+       help
+         BLAKE2s cryptographic hash function (RFC 7693)
+
+         Architecture: arm
+
+         This is faster than the generic implementations of BLAKE2s and
+         BLAKE2b, but slower than the NEON implementation of BLAKE2b.
+         There is no NEON implementation of BLAKE2s, since NEON doesn't
+         really help with it.
+
+config CRYPTO_CHACHA20_NEON
+       tristate
+       default CRYPTO_LIB_CHACHA_INTERNAL
+       select CRYPTO_ARCH_HAVE_LIB_CHACHA
+
+config CRYPTO_POLY1305_ARM
+       tristate
+       default CRYPTO_LIB_POLY1305_INTERNAL
+       select CRYPTO_ARCH_HAVE_LIB_POLY1305
diff --git a/arch/arm/lib/crypto/Makefile b/arch/arm/lib/crypto/Makefile
new file mode 100644 (file)
index 0000000..4c042a4
--- /dev/null
@@ -0,0 +1,26 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
+obj-$(CONFIG_CRYPTO_BLAKE2S_ARM) += libblake2s-arm.o
+libblake2s-arm-y := blake2s-core.o blake2s-glue.o
+
+obj-$(CONFIG_CRYPTO_CHACHA20_NEON) += chacha-neon.o
+chacha-neon-y := chacha-scalar-core.o chacha-glue.o
+chacha-neon-$(CONFIG_KERNEL_MODE_NEON) += chacha-neon-core.o
+
+obj-$(CONFIG_CRYPTO_POLY1305_ARM) += poly1305-arm.o
+poly1305-arm-y := poly1305-core.o poly1305-glue.o
+
+quiet_cmd_perl = PERL    $@
+      cmd_perl = $(PERL) $(<) > $(@)
+
+$(obj)/%-core.S: $(src)/%-armv4.pl
+       $(call cmd,perl)
+
+clean-files += poly1305-core.S
+
+aflags-thumb2-$(CONFIG_THUMB2_KERNEL)  := -U__thumb2__ -D__thumb2__=1
+
+# massage the perlasm code a bit so we only get the NEON routine if we need it
+poly1305-aflags-$(CONFIG_CPU_V7) := -U__LINUX_ARM_ARCH__ -D__LINUX_ARM_ARCH__=5
+poly1305-aflags-$(CONFIG_KERNEL_MODE_NEON) := -U__LINUX_ARM_ARCH__ -D__LINUX_ARM_ARCH__=7
+AFLAGS_poly1305-core.o += $(poly1305-aflags-y) $(aflags-thumb2-y)
index 2c6ab80e0cdc4e22b0c11bd27240393377211f16..59135009e4f02c49f385b391966d581d56d0a4a5 100644 (file)
@@ -155,4 +155,10 @@ config CRYPTO_LIB_SHA256
 config CRYPTO_LIB_SM3
        tristate
 
+if !KMSAN # avoid false positives from assembly
+if ARM
+source "arch/arm/lib/crypto/Kconfig"
+endif
+endif
+
 endmenu