]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
crypto: x86 - move library functions to arch/x86/lib/crypto/
authorEric Biggers <ebiggers@google.com>
Tue, 22 Apr 2025 15:27:14 +0000 (08:27 -0700)
committerHerbert Xu <herbert@gondor.apana.org.au>
Mon, 28 Apr 2025 11:40:54 +0000 (19:40 +0800)
Continue disentangling the crypto library functions from the generic
crypto infrastructure by moving the x86 BLAKE2s, ChaCha, and Poly1305
library functions into a new directory arch/x86/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:
arch/x86/crypto/Kconfig
arch/x86/crypto/Makefile
arch/x86/lib/Makefile
arch/x86/lib/crypto/.gitignore [new file with mode: 0644]
arch/x86/lib/crypto/Kconfig [new file with mode: 0644]
arch/x86/lib/crypto/Makefile [new file with mode: 0644]
arch/x86/lib/crypto/blake2s-core.S [moved from arch/x86/crypto/blake2s-core.S with 100% similarity]
arch/x86/lib/crypto/blake2s-glue.c [moved from arch/x86/crypto/blake2s-glue.c with 100% similarity]
arch/x86/lib/crypto/chacha-avx2-x86_64.S [moved from arch/x86/crypto/chacha-avx2-x86_64.S with 100% similarity]
arch/x86/lib/crypto/chacha-avx512vl-x86_64.S [moved from arch/x86/crypto/chacha-avx512vl-x86_64.S with 100% similarity]
arch/x86/lib/crypto/chacha-ssse3-x86_64.S [moved from arch/x86/crypto/chacha-ssse3-x86_64.S with 100% similarity]
arch/x86/lib/crypto/chacha_glue.c [moved from arch/x86/crypto/chacha_glue.c with 100% similarity]
arch/x86/lib/crypto/poly1305-x86_64-cryptogams.pl [moved from arch/x86/crypto/poly1305-x86_64-cryptogams.pl with 100% similarity]
arch/x86/lib/crypto/poly1305_glue.c [moved from arch/x86/crypto/poly1305_glue.c with 100% similarity]
lib/crypto/Kconfig

index b4df6cf37e0ea1f83c6b160caaad2ac732e23cec..9e941362e4cd5121a4ad66eca6867b728facefbf 100644 (file)
@@ -335,13 +335,6 @@ config CRYPTO_ARIA_GFNI_AVX512_X86_64
 
          Processes 64 blocks in parallel.
 
-config CRYPTO_CHACHA20_X86_64
-       tristate
-       depends on 64BIT
-       select CRYPTO_LIB_CHACHA_GENERIC
-       select CRYPTO_ARCH_HAVE_LIB_CHACHA
-       default CRYPTO_LIB_CHACHA_INTERNAL
-
 config CRYPTO_AEGIS128_AESNI_SSE2
        tristate "AEAD ciphers: AEGIS-128 (AES-NI/SSE4.1)"
        depends on 64BIT
@@ -373,18 +366,6 @@ config CRYPTO_NHPOLY1305_AVX2
          Architecture: x86_64 using:
          - AVX2 (Advanced Vector Extensions 2)
 
-config CRYPTO_BLAKE2S_X86
-       bool "Hash functions: BLAKE2s (SSSE3/AVX-512)"
-       depends on 64BIT
-       select CRYPTO_LIB_BLAKE2S_GENERIC
-       select CRYPTO_ARCH_HAVE_LIB_BLAKE2S
-       help
-         BLAKE2s cryptographic hash function (RFC 7693)
-
-         Architecture: x86_64 using:
-         - SSSE3 (Supplemental SSE3)
-         - AVX-512 (Advanced Vector Extensions-512)
-
 config CRYPTO_POLYVAL_CLMUL_NI
        tristate "Hash functions: POLYVAL (CLMUL-NI)"
        depends on 64BIT
@@ -395,12 +376,6 @@ config CRYPTO_POLYVAL_CLMUL_NI
          Architecture: x86_64 using:
          - CLMUL-NI (carry-less multiplication new instructions)
 
-config CRYPTO_POLY1305_X86_64
-       tristate
-       depends on 64BIT
-       select CRYPTO_ARCH_HAVE_LIB_POLY1305
-       default CRYPTO_LIB_POLY1305_INTERNAL
-
 config CRYPTO_SHA1_SSSE3
        tristate "Hash functions: SHA-1 (SSSE3/AVX/AVX2/SHA-NI)"
        depends on 64BIT
index 2f22b381f24452a1ba2d7ac62378be69aa5ff1e7..fad59a6c6c26f475d560dbfadec0ed53c05abe22 100644 (file)
@@ -42,9 +42,6 @@ cast6-avx-x86_64-y := cast6-avx-x86_64-asm_64.o cast6_avx_glue.o
 obj-$(CONFIG_CRYPTO_AEGIS128_AESNI_SSE2) += aegis128-aesni.o
 aegis128-aesni-y := aegis128-aesni-asm.o aegis128-aesni-glue.o
 
-obj-$(CONFIG_CRYPTO_CHACHA20_X86_64) += chacha-x86_64.o
-chacha-x86_64-y := chacha-avx2-x86_64.o chacha-ssse3-x86_64.o chacha-avx512vl-x86_64.o chacha_glue.o
-
 obj-$(CONFIG_CRYPTO_AES_NI_INTEL) += aesni-intel.o
 aesni-intel-y := aesni-intel_asm.o aesni-intel_glue.o
 aesni-intel-$(CONFIG_64BIT) += aes-ctr-avx-x86_64.o \
@@ -63,19 +60,12 @@ sha256-ssse3-y := sha256-ssse3-asm.o sha256-avx-asm.o sha256-avx2-asm.o sha256_n
 obj-$(CONFIG_CRYPTO_SHA512_SSSE3) += sha512-ssse3.o
 sha512-ssse3-y := sha512-ssse3-asm.o sha512-avx-asm.o sha512-avx2-asm.o sha512_ssse3_glue.o
 
-obj-$(CONFIG_CRYPTO_BLAKE2S_X86) += libblake2s-x86_64.o
-libblake2s-x86_64-y := blake2s-core.o blake2s-glue.o
-
 obj-$(CONFIG_CRYPTO_GHASH_CLMUL_NI_INTEL) += ghash-clmulni-intel.o
 ghash-clmulni-intel-y := ghash-clmulni-intel_asm.o ghash-clmulni-intel_glue.o
 
 obj-$(CONFIG_CRYPTO_POLYVAL_CLMUL_NI) += polyval-clmulni.o
 polyval-clmulni-y := polyval-clmulni_asm.o polyval-clmulni_glue.o
 
-obj-$(CONFIG_CRYPTO_POLY1305_X86_64) += poly1305-x86_64.o
-poly1305-x86_64-y := poly1305-x86_64-cryptogams.o poly1305_glue.o
-targets += poly1305-x86_64-cryptogams.S
-
 obj-$(CONFIG_CRYPTO_NHPOLY1305_SSE2) += nhpoly1305-sse2.o
 nhpoly1305-sse2-y := nh-sse2-x86_64.o nhpoly1305-sse2-glue.o
 obj-$(CONFIG_CRYPTO_NHPOLY1305_AVX2) += nhpoly1305-avx2.o
@@ -101,10 +91,5 @@ aria-aesni-avx2-x86_64-y := aria-aesni-avx2-asm_64.o aria_aesni_avx2_glue.o
 obj-$(CONFIG_CRYPTO_ARIA_GFNI_AVX512_X86_64) += aria-gfni-avx512-x86_64.o
 aria-gfni-avx512-x86_64-y := aria-gfni-avx512-asm_64.o aria_gfni_avx512_glue.o
 
-quiet_cmd_perlasm = PERLASM $@
-      cmd_perlasm = $(PERL) $< > $@
-$(obj)/%.S: $(src)/%.pl FORCE
-       $(call if_changed,perlasm)
-
 # Disable GCOV in odd or sensitive code
 GCOV_PROFILE_curve25519-x86_64.o := n
index 1c50352eb49f9ca3d4aaa89f15aa5f7c2fe0080a..4f0d57a35426748b1705d0a108e66fa05ecec405 100644 (file)
@@ -3,6 +3,8 @@
 # Makefile for x86 specific library files.
 #
 
+obj-y += crypto/
+
 # Produces uninteresting flaky coverage.
 KCOV_INSTRUMENT_delay.o        := n
 
diff --git a/arch/x86/lib/crypto/.gitignore b/arch/x86/lib/crypto/.gitignore
new file mode 100644 (file)
index 0000000..580c839
--- /dev/null
@@ -0,0 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
+poly1305-x86_64-cryptogams.S
diff --git a/arch/x86/lib/crypto/Kconfig b/arch/x86/lib/crypto/Kconfig
new file mode 100644 (file)
index 0000000..f83aa51
--- /dev/null
@@ -0,0 +1,26 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
+config CRYPTO_BLAKE2S_X86
+       bool "Hash functions: BLAKE2s (SSSE3/AVX-512)"
+       depends on 64BIT
+       select CRYPTO_LIB_BLAKE2S_GENERIC
+       select CRYPTO_ARCH_HAVE_LIB_BLAKE2S
+       help
+         BLAKE2s cryptographic hash function (RFC 7693)
+
+         Architecture: x86_64 using:
+         - SSSE3 (Supplemental SSE3)
+         - AVX-512 (Advanced Vector Extensions-512)
+
+config CRYPTO_CHACHA20_X86_64
+       tristate
+       depends on 64BIT
+       default CRYPTO_LIB_CHACHA_INTERNAL
+       select CRYPTO_LIB_CHACHA_GENERIC
+       select CRYPTO_ARCH_HAVE_LIB_CHACHA
+
+config CRYPTO_POLY1305_X86_64
+       tristate
+       depends on 64BIT
+       default CRYPTO_LIB_POLY1305_INTERNAL
+       select CRYPTO_ARCH_HAVE_LIB_POLY1305
diff --git a/arch/x86/lib/crypto/Makefile b/arch/x86/lib/crypto/Makefile
new file mode 100644 (file)
index 0000000..c2ff8c5
--- /dev/null
@@ -0,0 +1,17 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
+obj-$(CONFIG_CRYPTO_BLAKE2S_X86) += libblake2s-x86_64.o
+libblake2s-x86_64-y := blake2s-core.o blake2s-glue.o
+
+obj-$(CONFIG_CRYPTO_CHACHA20_X86_64) += chacha-x86_64.o
+chacha-x86_64-y := chacha-avx2-x86_64.o chacha-ssse3-x86_64.o chacha-avx512vl-x86_64.o chacha_glue.o
+
+obj-$(CONFIG_CRYPTO_POLY1305_X86_64) += poly1305-x86_64.o
+poly1305-x86_64-y := poly1305-x86_64-cryptogams.o poly1305_glue.o
+targets += poly1305-x86_64-cryptogams.S
+
+quiet_cmd_perlasm = PERLASM $@
+      cmd_perlasm = $(PERL) $< > $@
+
+$(obj)/%.S: $(src)/%.pl FORCE
+       $(call if_changed,perlasm)
index db19a7acc2fbfc2a08fabd852ce98af0a0657e03..f321fe1a8681be144392e24d99a0bd9668626108 100644 (file)
@@ -174,6 +174,9 @@ endif
 if S390
 source "arch/s390/lib/crypto/Kconfig"
 endif
+if X86
+source "arch/x86/lib/crypto/Kconfig"
+endif
 endif
 
 endmenu