Skip to contentSkip to conversation

lib/crypto: move arch/$(ARCH)/lib/crypto/ to lib/crypto/$(ARCH)/

PATCH In review Eric Biggers 5 participants 16 messages Jun 19, 2025 – Jun 24, 2025

Subsystems (10)
Arm (32-bit) x86 PowerPC MIPS +6 more subsystems
lore
Share & tools
lore

Eric Biggers

author maintainer
#0 lore raw

v2 cover lib/crypto: move arch/$(ARCH)/lib/crypto/ to lib/crypto/$(ARCH)/

This series applies on top of
https://lore.kernel.org/r/[email protected]/
and is also available in git at:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux.git arch-to-lib-crypto-v2

This series moves the contents of arch/$(ARCH)/lib/crypto/ into lib/crypto/$(ARCH)/.

The new code organization makes a lot more sense for how this code actually works and is developed. In particular, it makes it possible to build each algorithm as a single module, with better inlining and dead code elimination. For a more detailed explanation, see the patchset which did this for the CRC library code:
https://lore.kernel.org/r/[email protected]/.
Also see the patchset which did this for SHA-512:
https://lore.kernel.org/linux-crypto/[email protected]/

This is just a preparatory series, which does the move to get the files into their new location but keeps them building the same way as before. Later patch series will make the actual improvements to the way the arch-optimized code is integrated for each algorithm.

Changed in v2:
- Instead of keeping arch/*/lib/crypto/.gitignore, instead add entry for now-removed crypto directory to arch/*/lib/.gitignore.
- Adjusted commit messages and titles.
- Added Reviewed-by.

Eric Biggers (9):
lib/crypto: arm: move arch/arm/lib/crypto/ into lib/crypto/ lib/crypto: arm64: move arch/arm64/lib/crypto/ into lib/crypto/ lib/crypto: mips: move arch/mips/lib/crypto/ into lib/crypto/ lib/crypto: powerpc: move arch/powerpc/lib/crypto/ into lib/crypto/ lib/crypto: riscv: move arch/riscv/lib/crypto/ into lib/crypto/ lib/crypto: s390: move arch/s390/lib/crypto/ into lib/crypto/ lib/crypto: sparc: move arch/sparc/lib/crypto/ into lib/crypto/ lib/crypto: x86: move arch/x86/lib/crypto/ into lib/crypto/
MAINTAINERS: drop arch/*/lib/crypto/ pattern

 MAINTAINERS                                      |  1 -
 arch/arm/lib/.gitignore                          |  4 ++++
 arch/arm/lib/Makefile                            |  2 --
 arch/arm/lib/crypto/.gitignore                   |  3 ---
 arch/arm64/lib/.gitignore                        |  4 ++++
 arch/arm64/lib/Makefile                          |  3 ---
 arch/arm64/lib/crypto/.gitignore                 |  3 ---
 arch/mips/lib/.gitignore                         |  4 ++++
 arch/mips/lib/Makefile                           |  2 --
 arch/powerpc/lib/Makefile                        |  2 --
 arch/riscv/lib/Makefile                          |  1 -
 arch/s390/lib/Makefile                           |  1 -
 arch/sparc/lib/Makefile                          |  1 -
 arch/x86/lib/.gitignore                          |  4 ++++
 arch/x86/lib/Makefile                            |  2 --
 lib/crypto/Kconfig                               | 16 ++++++++--------
 lib/crypto/Makefile                              | 11 ++++++++++-
 lib/crypto/arm/.gitignore                        |  2 ++
 {arch/arm/lib/crypto => lib/crypto/arm}/Kconfig  |  0
 {arch/arm/lib/crypto => lib/crypto/arm}/Makefile |  0
 .../lib/crypto => lib/crypto/arm}/blake2s-core.S |  0
 .../lib/crypto => lib/crypto/arm}/blake2s-glue.c |  0
 .../lib/crypto => lib/crypto/arm}/chacha-glue.c  |  0
 .../crypto => lib/crypto/arm}/chacha-neon-core.S |  0
 .../crypto/arm}/chacha-scalar-core.S             |  0
 .../crypto => lib/crypto/arm}/poly1305-armv4.pl  |  0
 .../crypto => lib/crypto/arm}/poly1305-glue.c    |  0
 .../crypto => lib/crypto/arm}/sha256-armv4.pl    |  0
 .../lib/crypto => lib/crypto/arm}/sha256-ce.S    |  0
 {arch/arm/lib/crypto => lib/crypto/arm}/sha256.c |  0
 lib/crypto/arm64/.gitignore                      |  2 ++
 .../lib/crypto => lib/crypto/arm64}/Kconfig      |  0
 .../lib/crypto => lib/crypto/arm64}/Makefile     |  0
 .../crypto/arm64}/chacha-neon-core.S             |  0
 .../crypto/arm64}/chacha-neon-glue.c             |  0
 .../crypto/arm64}/poly1305-armv8.pl              |  0
 .../crypto => lib/crypto/arm64}/poly1305-glue.c  |  0
 .../crypto => lib/crypto/arm64}/sha2-armv8.pl    |  0
 .../lib/crypto => lib/crypto/arm64}/sha256-ce.S  |  0
 .../lib/crypto => lib/crypto/arm64}/sha256.c     |  0
 .../lib/crypto => lib/crypto/mips}/.gitignore    |  0
 .../mips/lib/crypto => lib/crypto/mips}/Kconfig  |  0
 .../mips/lib/crypto => lib/crypto/mips}/Makefile |  0
 .../lib/crypto => lib/crypto/mips}/chacha-core.S |  0
 .../lib/crypto => lib/crypto/mips}/chacha-glue.c |  0
 .../crypto => lib/crypto/mips}/poly1305-glue.c   |  0
 .../crypto => lib/crypto/mips}/poly1305-mips.pl  |  0
 .../lib/crypto => lib/crypto/powerpc}/Kconfig    |  0
 .../lib/crypto => lib/crypto/powerpc}/Makefile   |  0
 .../crypto/powerpc}/chacha-p10-glue.c            |  0
 .../crypto/powerpc}/chacha-p10le-8x.S            |  0
 .../crypto/powerpc}/poly1305-p10-glue.c          |  0
 .../crypto/powerpc}/poly1305-p10le_64.S          |  0
 .../crypto/powerpc}/sha256-spe-asm.S             |  0
 .../lib/crypto => lib/crypto/powerpc}/sha256.c   |  0
 .../lib/crypto => lib/crypto/riscv}/Kconfig      |  0
 .../lib/crypto => lib/crypto/riscv}/Makefile     |  0
 .../crypto/riscv}/chacha-riscv64-glue.c          |  0
 .../crypto/riscv}/chacha-riscv64-zvkb.S          |  0
 .../sha256-riscv64-zvknha_or_zvknhb-zvkb.S       |  0
 .../lib/crypto => lib/crypto/riscv}/sha256.c     |  0
 .../s390/lib/crypto => lib/crypto/s390}/Kconfig  |  0
 .../s390/lib/crypto => lib/crypto/s390}/Makefile |  0
 .../lib/crypto => lib/crypto/s390}/chacha-glue.c |  0
 .../lib/crypto => lib/crypto/s390}/chacha-s390.S |  0
 .../lib/crypto => lib/crypto/s390}/chacha-s390.h |  0
 .../s390/lib/crypto => lib/crypto/s390}/sha256.c |  0
 .../lib/crypto => lib/crypto/sparc}/Kconfig      |  0
 .../lib/crypto => lib/crypto/sparc}/Makefile     |  0
 .../lib/crypto => lib/crypto/sparc}/sha256.c     |  0
 .../lib/crypto => lib/crypto/sparc}/sha256_asm.S |  0
 .../x86/lib/crypto => lib/crypto/x86}/.gitignore |  0
 {arch/x86/lib/crypto => lib/crypto/x86}/Kconfig  |  0
 {arch/x86/lib/crypto => lib/crypto/x86}/Makefile |  0
 .../lib/crypto => lib/crypto/x86}/blake2s-core.S |  0
 .../lib/crypto => lib/crypto/x86}/blake2s-glue.c |  0
 .../crypto/x86}/chacha-avx2-x86_64.S             |  0
 .../crypto/x86}/chacha-avx512vl-x86_64.S         |  0
 .../crypto/x86}/chacha-ssse3-x86_64.S            |  0
 .../lib/crypto => lib/crypto/x86}/chacha_glue.c  |  0
 .../crypto/x86}/poly1305-x86_64-cryptogams.pl    |  0
 .../crypto => lib/crypto/x86}/poly1305_glue.c    |  0
 .../crypto => lib/crypto/x86}/sha256-avx-asm.S   |  0
 .../crypto => lib/crypto/x86}/sha256-avx2-asm.S  |  0
 .../crypto => lib/crypto/x86}/sha256-ni-asm.S    |  0
 .../crypto => lib/crypto/x86}/sha256-ssse3-asm.S |  0
 {arch/x86/lib/crypto => lib/crypto/x86}/sha256.c |  0
 87 files changed, 38 insertions(+), 30 deletions(-)
 create mode 100644 arch/arm/lib/.gitignore
 delete mode 100644 arch/arm/lib/crypto/.gitignore
 create mode 100644 arch/arm64/lib/.gitignore
 delete mode 100644 arch/arm64/lib/crypto/.gitignore
 create mode 100644 arch/mips/lib/.gitignore
 rename {arch/arm/lib/crypto => lib/crypto/arm}/Kconfig (100%)
 rename {arch/arm/lib/crypto => lib/crypto/arm}/Makefile (100%)
 rename {arch/arm/lib/crypto => lib/crypto/arm}/blake2s-core.S (100%)
 rename {arch/arm/lib/crypto => lib/crypto/arm}/blake2s-glue.c (100%)
 rename {arch/arm/lib/crypto => lib/crypto/arm}/chacha-glue.c (100%)
 rename {arch/arm/lib/crypto => lib/crypto/arm}/chacha-neon-core.S (100%)
 rename {arch/arm/lib/crypto => lib/crypto/arm}/chacha-scalar-core.S (100%)
 rename {arch/arm/lib/crypto => lib/crypto/arm}/poly1305-armv4.pl (100%)
 rename {arch/arm/lib/crypto => lib/crypto/arm}/poly1305-glue.c (100%)
 rename {arch/arm/lib/crypto => lib/crypto/arm}/sha256-armv4.pl (100%)
 rename {arch/arm/lib/crypto => lib/crypto/arm}/sha256-ce.S (100%)
 rename {arch/arm/lib/crypto => lib/crypto/arm}/sha256.c (100%)
 rename {arch/arm64/lib/crypto => lib/crypto/arm64}/Kconfig (100%)
 rename {arch/arm64/lib/crypto => lib/crypto/arm64}/Makefile (100%)
 rename {arch/arm64/lib/crypto => lib/crypto/arm64}/chacha-neon-core.S (100%)
 rename {arch/arm64/lib/crypto => lib/crypto/arm64}/chacha-neon-glue.c (100%)
 rename {arch/arm64/lib/crypto => lib/crypto/arm64}/poly1305-armv8.pl (100%)
 rename {arch/arm64/lib/crypto => lib/crypto/arm64}/poly1305-glue.c (100%)
 rename {arch/arm64/lib/crypto => lib/crypto/arm64}/sha2-armv8.pl (100%)
 rename {arch/arm64/lib/crypto => lib/crypto/arm64}/sha256-ce.S (100%)
 rename {arch/arm64/lib/crypto => lib/crypto/arm64}/sha256.c (100%)
 rename {arch/mips/lib/crypto => lib/crypto/mips}/.gitignore (100%)
 rename {arch/mips/lib/crypto => lib/crypto/mips}/Kconfig (100%)
 rename {arch/mips/lib/crypto => lib/crypto/mips}/Makefile (100%)
 rename {arch/mips/lib/crypto => lib/crypto/mips}/chacha-core.S (100%)
 rename {arch/mips/lib/crypto => lib/crypto/mips}/chacha-glue.c (100%)
 rename {arch/mips/lib/crypto => lib/crypto/mips}/poly1305-glue.c (100%)
 rename {arch/mips/lib/crypto => lib/crypto/mips}/poly1305-mips.pl (100%)
 rename {arch/powerpc/lib/crypto => lib/crypto/powerpc}/Kconfig (100%)
 rename {arch/powerpc/lib/crypto => lib/crypto/powerpc}/Makefile (100%)
 rename {arch/powerpc/lib/crypto => lib/crypto/powerpc}/chacha-p10-glue.c (100%)
 rename {arch/powerpc/lib/crypto => lib/crypto/powerpc}/chacha-p10le-8x.S (100%)
 rename {arch/powerpc/lib/crypto => lib/crypto/powerpc}/poly1305-p10-glue.c (100%)
 rename {arch/powerpc/lib/crypto => lib/crypto/powerpc}/poly1305-p10le_64.S (100%)
 rename {arch/powerpc/lib/crypto => lib/crypto/powerpc}/sha256-spe-asm.S (100%)
 rename {arch/powerpc/lib/crypto => lib/crypto/powerpc}/sha256.c (100%)
 rename {arch/riscv/lib/crypto => lib/crypto/riscv}/Kconfig (100%)
 rename {arch/riscv/lib/crypto => lib/crypto/riscv}/Makefile (100%)
 rename {arch/riscv/lib/crypto => lib/crypto/riscv}/chacha-riscv64-glue.c (100%)
 rename {arch/riscv/lib/crypto => lib/crypto/riscv}/chacha-riscv64-zvkb.S (100%)
 rename {arch/riscv/lib/crypto => lib/crypto/riscv}/sha256-riscv64-zvknha_or_zvknhb-zvkb.S (100%)
 rename {arch/riscv/lib/crypto => lib/crypto/riscv}/sha256.c (100%)
 rename {arch/s390/lib/crypto => lib/crypto/s390}/Kconfig (100%)
 rename {arch/s390/lib/crypto => lib/crypto/s390}/Makefile (100%)
 rename {arch/s390/lib/crypto => lib/crypto/s390}/chacha-glue.c (100%)
 rename {arch/s390/lib/crypto => lib/crypto/s390}/chacha-s390.S (100%)
 rename {arch/s390/lib/crypto => lib/crypto/s390}/chacha-s390.h (100%)
 rename {arch/s390/lib/crypto => lib/crypto/s390}/sha256.c (100%)
 rename {arch/sparc/lib/crypto => lib/crypto/sparc}/Kconfig (100%)
 rename {arch/sparc/lib/crypto => lib/crypto/sparc}/Makefile (100%)
 rename {arch/sparc/lib/crypto => lib/crypto/sparc}/sha256.c (100%)
 rename {arch/sparc/lib/crypto => lib/crypto/sparc}/sha256_asm.S (100%)
 rename {arch/x86/lib/crypto => lib/crypto/x86}/.gitignore (100%)
 rename {arch/x86/lib/crypto => lib/crypto/x86}/Kconfig (100%)
 rename {arch/x86/lib/crypto => lib/crypto/x86}/Makefile (100%)
 rename {arch/x86/lib/crypto => lib/crypto/x86}/blake2s-core.S (100%)
 rename {arch/x86/lib/crypto => lib/crypto/x86}/blake2s-glue.c (100%)
 rename {arch/x86/lib/crypto => lib/crypto/x86}/chacha-avx2-x86_64.S (100%)
 rename {arch/x86/lib/crypto => lib/crypto/x86}/chacha-avx512vl-x86_64.S (100%)
 rename {arch/x86/lib/crypto => lib/crypto/x86}/chacha-ssse3-x86_64.S (100%)
 rename {arch/x86/lib/crypto => lib/crypto/x86}/chacha_glue.c (100%)
 rename {arch/x86/lib/crypto => lib/crypto/x86}/poly1305-x86_64-cryptogams.pl (100%)
 rename {arch/x86/lib/crypto => lib/crypto/x86}/poly1305_glue.c (100%)
 rename {arch/x86/lib/crypto => lib/crypto/x86}/sha256-avx-asm.S (100%)
 rename {arch/x86/lib/crypto => lib/crypto/x86}/sha256-avx2-asm.S (100%)
 rename {arch/x86/lib/crypto => lib/crypto/x86}/sha256-ni-asm.S (100%)
 rename {arch/x86/lib/crypto => lib/crypto/x86}/sha256-ssse3-asm.S (100%)
 rename {arch/x86/lib/crypto => lib/crypto/x86}/sha256.c (100%)
Signature · 1 line
2.50.0
author maintainer
#1 lore raw

PATCH v2 1/9 lib/crypto: arm: move arch/arm/lib/crypto/ into lib/crypto/

From: Eric Biggers <[email protected]>

Move the contents of arch/arm/lib/crypto/ into lib/crypto/arm/.

The new code organization makes a lot more sense for how this code actually works and is developed. In particular, it makes it possible to build each algorithm as a single module, with better inlining and dead code elimination. For a more detailed explanation, see the patchset which did this for the CRC library code:
https://lore.kernel.org/r/[email protected]/.
Also see the patchset which did this for SHA-512:
https://lore.kernel.org/linux-crypto/[email protected]/

This is just a preparatory commit, which does the move to get the files into their new location but keeps them building the same way as before. Later commits will make the actual improvements to the way the arch-optimized code is integrated for each algorithm.

Add a gitignore entry for the removed directory arch/arm/lib/crypto/ so that people don't accidentally commit leftover generated files.

---
 arch/arm/lib/.gitignore                                      | 4 ++++
 arch/arm/lib/Makefile                                        | 2 --
 arch/arm/lib/crypto/.gitignore                               | 3 ---
 lib/crypto/Kconfig                                           | 2 +-
 lib/crypto/Makefile                                          | 2 ++
 lib/crypto/arm/.gitignore                                    | 2 ++
 {arch/arm/lib/crypto => lib/crypto/arm}/Kconfig              | 0
 {arch/arm/lib/crypto => lib/crypto/arm}/Makefile             | 0
 {arch/arm/lib/crypto => lib/crypto/arm}/blake2s-core.S       | 0
 {arch/arm/lib/crypto => lib/crypto/arm}/blake2s-glue.c       | 0
 {arch/arm/lib/crypto => lib/crypto/arm}/chacha-glue.c        | 0
 {arch/arm/lib/crypto => lib/crypto/arm}/chacha-neon-core.S   | 0
 {arch/arm/lib/crypto => lib/crypto/arm}/chacha-scalar-core.S | 0
 {arch/arm/lib/crypto => lib/crypto/arm}/poly1305-armv4.pl    | 0
 {arch/arm/lib/crypto => lib/crypto/arm}/poly1305-glue.c      | 0
 {arch/arm/lib/crypto => lib/crypto/arm}/sha256-armv4.pl      | 0
 {arch/arm/lib/crypto => lib/crypto/arm}/sha256-ce.S          | 0
 {arch/arm/lib/crypto => lib/crypto/arm}/sha256.c             | 0
 18 files changed, 9 insertions(+), 6 deletions(-)
 create mode 100644 arch/arm/lib/.gitignore
 delete mode 100644 arch/arm/lib/crypto/.gitignore
 rename {arch/arm/lib/crypto => lib/crypto/arm}/Kconfig (100%)
 rename {arch/arm/lib/crypto => lib/crypto/arm}/Makefile (100%)
 rename {arch/arm/lib/crypto => lib/crypto/arm}/blake2s-core.S (100%)
 rename {arch/arm/lib/crypto => lib/crypto/arm}/blake2s-glue.c (100%)
 rename {arch/arm/lib/crypto => lib/crypto/arm}/chacha-glue.c (100%)
 rename {arch/arm/lib/crypto => lib/crypto/arm}/chacha-neon-core.S (100%)
 rename {arch/arm/lib/crypto => lib/crypto/arm}/chacha-scalar-core.S (100%)
 rename {arch/arm/lib/crypto => lib/crypto/arm}/poly1305-armv4.pl (100%)
 rename {arch/arm/lib/crypto => lib/crypto/arm}/poly1305-glue.c (100%)
 rename {arch/arm/lib/crypto => lib/crypto/arm}/sha256-armv4.pl (100%)
 rename {arch/arm/lib/crypto => lib/crypto/arm}/sha256-ce.S (100%)
 rename {arch/arm/lib/crypto => lib/crypto/arm}/sha256.c (100%)
arch/arm/lib/.gitignore new file +4 -0
new file mode 100644
index 0000000000000..647d7a922e680
@@ -0,0 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
+# This now-removed directory used to contain generated files.
+/crypto/
arch/arm/lib/Makefile +0 -2
index 91ea0e29107af..d05dd672bcd9c 100644
@@ -3,12 +3,10 @@
 # linux/arch/arm/lib/Makefile
 #
 # 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   \
 		   memmove.o memset.o setbit.o                        \
 		   strchr.o strrchr.o                                 \
arch/arm/lib/crypto/.gitignore deleted +0 -3
deleted file mode 100644
index 12d74d8b03d0a..0000000000000
@@ -1,3 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-only
-poly1305-core.S
-sha256-core.S
lib/crypto/Kconfig +1 -1
index dce127a69f131..e14bef8e87af2 100644
@@ -188,11 +188,11 @@ config CRYPTO_LIB_SHA512_ARCH
 config CRYPTO_LIB_SM3
 	tristate
 
 if !KMSAN # avoid false positives from assembly
 if ARM
-source "arch/arm/lib/crypto/Kconfig"
+source "lib/crypto/arm/Kconfig"
 endif
 if ARM64
 source "arch/arm64/lib/crypto/Kconfig"
 endif
 if MIPS
lib/crypto/Makefile +2 -0
index 4a76169de251b..ddf04e2270f1e 100644
@@ -100,5 +100,7 @@ obj-$(CONFIG_MPILIB) += mpi/
 
 obj-$(CONFIG_CRYPTO_SELFTESTS)			+= simd.o
 
 obj-$(CONFIG_CRYPTO_LIB_SM3)			+= libsm3.o
 libsm3-y					:= sm3.o
+
+obj-$(CONFIG_ARM) += arm/
lib/crypto/arm/.gitignore +2 -0
index 670a4d97b5684..f6c4e8ef80dae 100644
@@ -1,2 +1,4 @@
 # SPDX-License-Identifier: GPL-2.0-only
+poly1305-core.S
+sha256-core.S
 sha512-core.S
lib/crypto/arm/Kconfig renamed from arch/arm/lib/crypto/Kconfig +0 -0
similarity index 100%
rename from arch/arm/lib/crypto/Kconfig
rename to lib/crypto/arm/Kconfig
lib/crypto/arm/Makefile renamed from arch/arm/lib/crypto/Makefile +0 -0
similarity index 100%
rename from arch/arm/lib/crypto/Makefile
rename to lib/crypto/arm/Makefile
lib/crypto/arm/blake2s-core.S renamed from arch/arm/lib/crypto/blake2s-core.S +0 -0
similarity index 100%
rename from arch/arm/lib/crypto/blake2s-core.S
rename to lib/crypto/arm/blake2s-core.S
lib/crypto/arm/blake2s-glue.c renamed from arch/arm/lib/crypto/blake2s-glue.c +0 -0
similarity index 100%
rename from arch/arm/lib/crypto/blake2s-glue.c
rename to lib/crypto/arm/blake2s-glue.c
lib/crypto/arm/chacha-glue.c renamed from arch/arm/lib/crypto/chacha-glue.c +0 -0
similarity index 100%
rename from arch/arm/lib/crypto/chacha-glue.c
rename to lib/crypto/arm/chacha-glue.c
lib/crypto/arm/chacha-neon-core.S renamed from arch/arm/lib/crypto/chacha-neon-core.S +0 -0
similarity index 100%
rename from arch/arm/lib/crypto/chacha-neon-core.S
rename to lib/crypto/arm/chacha-neon-core.S
lib/crypto/arm/chacha-scalar-core.S renamed from arch/arm/lib/crypto/chacha-scalar-core.S +0 -0
similarity index 100%
rename from arch/arm/lib/crypto/chacha-scalar-core.S
rename to lib/crypto/arm/chacha-scalar-core.S
lib/crypto/arm/poly1305-armv4.pl renamed from arch/arm/lib/crypto/poly1305-armv4.pl +0 -0
similarity index 100%
rename from arch/arm/lib/crypto/poly1305-armv4.pl
rename to lib/crypto/arm/poly1305-armv4.pl
lib/crypto/arm/poly1305-glue.c renamed from arch/arm/lib/crypto/poly1305-glue.c +0 -0
similarity index 100%
rename from arch/arm/lib/crypto/poly1305-glue.c
rename to lib/crypto/arm/poly1305-glue.c
lib/crypto/arm/sha256-armv4.pl renamed from arch/arm/lib/crypto/sha256-armv4.pl +0 -0
similarity index 100%
rename from arch/arm/lib/crypto/sha256-armv4.pl
rename to lib/crypto/arm/sha256-armv4.pl
lib/crypto/arm/sha256-ce.S renamed from arch/arm/lib/crypto/sha256-ce.S +0 -0
similarity index 100%
rename from arch/arm/lib/crypto/sha256-ce.S
rename to lib/crypto/arm/sha256-ce.S
lib/crypto/arm/sha256.c renamed from arch/arm/lib/crypto/sha256.c +0 -0
similarity index 100%
rename from arch/arm/lib/crypto/sha256.c
rename to lib/crypto/arm/sha256.c
Signature · 1 line
2.50.0
author maintainer
#2 lore raw

PATCH v2 2/9 lib/crypto: arm64: move arch/arm64/lib/crypto/ into lib/crypto/

In reply to Eric Biggers

From: Eric Biggers <[email protected]>

Move the contents of arch/arm64/lib/crypto/ into lib/crypto/arm64/.

The new code organization makes a lot more sense for how this code actually works and is developed. In particular, it makes it possible to build each algorithm as a single module, with better inlining and dead code elimination. For a more detailed explanation, see the patchset which did this for the CRC library code:
https://lore.kernel.org/r/[email protected]/.
Also see the patchset which did this for SHA-512:
https://lore.kernel.org/linux-crypto/[email protected]/

This is just a preparatory commit, which does the move to get the files into their new location but keeps them building the same way as before. Later commits will make the actual improvements to the way the arch-optimized code is integrated for each algorithm.

Add a gitignore entry for the removed directory arch/arm64/lib/crypto/ so that people don't accidentally commit leftover generated files.

---
 arch/arm64/lib/.gitignore                                     | 4 ++++
 arch/arm64/lib/Makefile                                       | 3 ---
 arch/arm64/lib/crypto/.gitignore                              | 3 ---
 lib/crypto/Kconfig                                            | 2 +-
 lib/crypto/Makefile                                           | 3 ++-
 lib/crypto/arm64/.gitignore                                   | 2 ++
 {arch/arm64/lib/crypto => lib/crypto/arm64}/Kconfig           | 0
 {arch/arm64/lib/crypto => lib/crypto/arm64}/Makefile          | 0
 .../arm64/lib/crypto => lib/crypto/arm64}/chacha-neon-core.S  | 0
 .../arm64/lib/crypto => lib/crypto/arm64}/chacha-neon-glue.c  | 0
 {arch/arm64/lib/crypto => lib/crypto/arm64}/poly1305-armv8.pl | 0
 {arch/arm64/lib/crypto => lib/crypto/arm64}/poly1305-glue.c   | 0
 {arch/arm64/lib/crypto => lib/crypto/arm64}/sha2-armv8.pl     | 0
 {arch/arm64/lib/crypto => lib/crypto/arm64}/sha256-ce.S       | 0
 {arch/arm64/lib/crypto => lib/crypto/arm64}/sha256.c          | 0
 15 files changed, 9 insertions(+), 8 deletions(-)
 create mode 100644 arch/arm64/lib/.gitignore
 delete mode 100644 arch/arm64/lib/crypto/.gitignore
 rename {arch/arm64/lib/crypto => lib/crypto/arm64}/Kconfig (100%)
 rename {arch/arm64/lib/crypto => lib/crypto/arm64}/Makefile (100%)
 rename {arch/arm64/lib/crypto => lib/crypto/arm64}/chacha-neon-core.S (100%)
 rename {arch/arm64/lib/crypto => lib/crypto/arm64}/chacha-neon-glue.c (100%)
 rename {arch/arm64/lib/crypto => lib/crypto/arm64}/poly1305-armv8.pl (100%)
 rename {arch/arm64/lib/crypto => lib/crypto/arm64}/poly1305-glue.c (100%)
 rename {arch/arm64/lib/crypto => lib/crypto/arm64}/sha2-armv8.pl (100%)
 rename {arch/arm64/lib/crypto => lib/crypto/arm64}/sha256-ce.S (100%)
 rename {arch/arm64/lib/crypto => lib/crypto/arm64}/sha256.c (100%)
arch/arm64/lib/.gitignore new file +4 -0
new file mode 100644
index 0000000000000..647d7a922e680
@@ -0,0 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
+# This now-removed directory used to contain generated files.
+/crypto/
arch/arm64/lib/Makefile +0 -3
index 027bfa9689c6a..d97e290619bc5 100644
@@ -1,9 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0
-
-obj-y += crypto/
-
 lib-y		:= clear_user.o delay.o copy_from_user.o		\
 		   copy_to_user.o copy_page.o				\
 		   clear_page.o csum.o insn.o memchr.o memcpy.o		\
 		   memset.o memcmp.o strcmp.o strncmp.o strlen.o	\
 		   strnlen.o strchr.o strrchr.o tishift.o
arch/arm64/lib/crypto/.gitignore deleted +0 -3
deleted file mode 100644
index 12d74d8b03d0a..0000000000000
@@ -1,3 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-only
-poly1305-core.S
-sha256-core.S
lib/crypto/Kconfig +1 -1
index e14bef8e87af2..fdeb91bf00328 100644
@@ -191,11 +191,11 @@ config CRYPTO_LIB_SM3
 if !KMSAN # avoid false positives from assembly
 if ARM
 source "lib/crypto/arm/Kconfig"
 endif
 if ARM64
-source "arch/arm64/lib/crypto/Kconfig"
+source "lib/crypto/arm64/Kconfig"
 endif
 if MIPS
 source "arch/mips/lib/crypto/Kconfig"
 endif
 if PPC
lib/crypto/Makefile +2 -1
index ddf04e2270f1e..63ab907e8f53b 100644
@@ -81,11 +81,11 @@ clean-files += arm/sha512-core.S
 AFLAGS_arm/sha512-core.o += $(aflags-thumb2-y)
 endif
 
 ifeq ($(CONFIG_ARM64),y)
 libsha512-y += arm64/sha512-core.o
-$(obj)/arm64/sha512-core.S: $(src)/../../arch/arm64/lib/crypto/sha2-armv8.pl
+$(obj)/arm64/sha512-core.S: $(src)/arm64/sha2-armv8.pl
 	$(call cmd,perlasm_with_args)
 clean-files += arm64/sha512-core.S
 libsha512-$(CONFIG_KERNEL_MODE_NEON) += arm64/sha512-ce-core.o
 endif
 
@@ -102,5 +102,6 @@ obj-$(CONFIG_CRYPTO_SELFTESTS)			+= simd.o
 
 obj-$(CONFIG_CRYPTO_LIB_SM3)			+= libsm3.o
 libsm3-y					:= sm3.o
 
 obj-$(CONFIG_ARM) += arm/
+obj-$(CONFIG_ARM64) += arm64/
lib/crypto/arm64/.gitignore +2 -0
index 670a4d97b5684..f6c4e8ef80dae 100644
@@ -1,2 +1,4 @@
 # SPDX-License-Identifier: GPL-2.0-only
+poly1305-core.S
+sha256-core.S
 sha512-core.S
lib/crypto/arm64/Kconfig renamed from arch/arm64/lib/crypto/Kconfig +0 -0
similarity index 100%
rename from arch/arm64/lib/crypto/Kconfig
rename to lib/crypto/arm64/Kconfig
lib/crypto/arm64/Makefile renamed from arch/arm64/lib/crypto/Makefile +0 -0
similarity index 100%
rename from arch/arm64/lib/crypto/Makefile
rename to lib/crypto/arm64/Makefile
lib/crypto/arm64/chacha-neon-core.S renamed from arch/arm64/lib/crypto/chacha-neon-core.S +0 -0
similarity index 100%
rename from arch/arm64/lib/crypto/chacha-neon-core.S
rename to lib/crypto/arm64/chacha-neon-core.S
lib/crypto/arm64/chacha-neon-glue.c renamed from arch/arm64/lib/crypto/chacha-neon-glue.c +0 -0
similarity index 100%
rename from arch/arm64/lib/crypto/chacha-neon-glue.c
rename to lib/crypto/arm64/chacha-neon-glue.c
lib/crypto/arm64/poly1305-armv8.pl renamed from arch/arm64/lib/crypto/poly1305-armv8.pl +0 -0
similarity index 100%
rename from arch/arm64/lib/crypto/poly1305-armv8.pl
rename to lib/crypto/arm64/poly1305-armv8.pl
lib/crypto/arm64/poly1305-glue.c renamed from arch/arm64/lib/crypto/poly1305-glue.c +0 -0
similarity index 100%
rename from arch/arm64/lib/crypto/poly1305-glue.c
rename to lib/crypto/arm64/poly1305-glue.c
lib/crypto/arm64/sha2-armv8.pl renamed from arch/arm64/lib/crypto/sha2-armv8.pl +0 -0
similarity index 100%
rename from arch/arm64/lib/crypto/sha2-armv8.pl
rename to lib/crypto/arm64/sha2-armv8.pl
lib/crypto/arm64/sha256-ce.S renamed from arch/arm64/lib/crypto/sha256-ce.S +0 -0
similarity index 100%
rename from arch/arm64/lib/crypto/sha256-ce.S
rename to lib/crypto/arm64/sha256-ce.S
lib/crypto/arm64/sha256.c renamed from arch/arm64/lib/crypto/sha256.c +0 -0
similarity index 100%
rename from arch/arm64/lib/crypto/sha256.c
rename to lib/crypto/arm64/sha256.c
Signature · 1 line
2.50.0
author maintainer
#3 lore raw

PATCH v2 3/9 lib/crypto: mips: move arch/mips/lib/crypto/ into lib/crypto/

In reply to Eric Biggers

From: Eric Biggers <[email protected]>

Move the contents of arch/mips/lib/crypto/ into lib/crypto/mips/.

The new code organization makes a lot more sense for how this code actually works and is developed. In particular, it makes it possible to build each algorithm as a single module, with better inlining and dead code elimination. For a more detailed explanation, see the patchset which did this for the CRC library code:
https://lore.kernel.org/r/[email protected]/.
Also see the patchset which did this for SHA-512:
https://lore.kernel.org/linux-crypto/[email protected]/

This is just a preparatory commit, which does the move to get the files into their new location but keeps them building the same way as before. Later commits will make the actual improvements to the way the arch-optimized code is integrated for each algorithm.

Add a gitignore entry for the removed directory arch/mips/lib/crypto/ so that people don't accidentally commit leftover generated files.

---
 arch/mips/lib/.gitignore                                   | 4 ++++
 arch/mips/lib/Makefile                                     | 2 --
 lib/crypto/Kconfig                                         | 2 +-
 lib/crypto/Makefile                                        | 1 +
 {arch/mips/lib/crypto => lib/crypto/mips}/.gitignore       | 0
 {arch/mips/lib/crypto => lib/crypto/mips}/Kconfig          | 0
 {arch/mips/lib/crypto => lib/crypto/mips}/Makefile         | 0
 {arch/mips/lib/crypto => lib/crypto/mips}/chacha-core.S    | 0
 {arch/mips/lib/crypto => lib/crypto/mips}/chacha-glue.c    | 0
 {arch/mips/lib/crypto => lib/crypto/mips}/poly1305-glue.c  | 0
 {arch/mips/lib/crypto => lib/crypto/mips}/poly1305-mips.pl | 0
 11 files changed, 6 insertions(+), 3 deletions(-)
 create mode 100644 arch/mips/lib/.gitignore
 rename {arch/mips/lib/crypto => lib/crypto/mips}/.gitignore (100%)
 rename {arch/mips/lib/crypto => lib/crypto/mips}/Kconfig (100%)
 rename {arch/mips/lib/crypto => lib/crypto/mips}/Makefile (100%)
 rename {arch/mips/lib/crypto => lib/crypto/mips}/chacha-core.S (100%)
 rename {arch/mips/lib/crypto => lib/crypto/mips}/chacha-glue.c (100%)
 rename {arch/mips/lib/crypto => lib/crypto/mips}/poly1305-glue.c (100%)
 rename {arch/mips/lib/crypto => lib/crypto/mips}/poly1305-mips.pl (100%)
arch/mips/lib/.gitignore new file +4 -0
new file mode 100644
index 0000000000000..647d7a922e680
@@ -0,0 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
+# This now-removed directory used to contain generated files.
+/crypto/
arch/mips/lib/Makefile +0 -2
index 9d75845ef78e1..9c024e6d5e54c 100644
@@ -1,12 +1,10 @@
 # SPDX-License-Identifier: GPL-2.0
 #
 # Makefile for MIPS-specific library files..
 #
 
-obj-y	+= crypto/
-
 lib-y	+= bitops.o csum_partial.o delay.o memcpy.o memset.o \
 	   mips-atomic.o strncpy_user.o \
 	   strnlen_user.o uncached.o
 
 obj-y			+= iomap_copy.o
lib/crypto/Kconfig +1 -1
index fdeb91bf00328..43c44316fbbdc 100644
@@ -194,11 +194,11 @@ source "lib/crypto/arm/Kconfig"
 endif
 if ARM64
 source "lib/crypto/arm64/Kconfig"
 endif
 if MIPS
-source "arch/mips/lib/crypto/Kconfig"
+source "lib/crypto/mips/Kconfig"
 endif
 if PPC
 source "arch/powerpc/lib/crypto/Kconfig"
 endif
 if RISCV
lib/crypto/Makefile +1 -0
index 63ab907e8f53b..74331243b8c44 100644
@@ -103,5 +103,6 @@ obj-$(CONFIG_CRYPTO_SELFTESTS)			+= simd.o
 obj-$(CONFIG_CRYPTO_LIB_SM3)			+= libsm3.o
 libsm3-y					:= sm3.o
 
 obj-$(CONFIG_ARM) += arm/
 obj-$(CONFIG_ARM64) += arm64/
+obj-$(CONFIG_MIPS) += mips/
lib/crypto/mips/.gitignore renamed from arch/mips/lib/crypto/.gitignore +0 -0
similarity index 100%
rename from arch/mips/lib/crypto/.gitignore
rename to lib/crypto/mips/.gitignore
lib/crypto/mips/Kconfig renamed from arch/mips/lib/crypto/Kconfig +0 -0
similarity index 100%
rename from arch/mips/lib/crypto/Kconfig
rename to lib/crypto/mips/Kconfig
lib/crypto/mips/Makefile renamed from arch/mips/lib/crypto/Makefile +0 -0
similarity index 100%
rename from arch/mips/lib/crypto/Makefile
rename to lib/crypto/mips/Makefile
lib/crypto/mips/chacha-core.S renamed from arch/mips/lib/crypto/chacha-core.S +0 -0
similarity index 100%
rename from arch/mips/lib/crypto/chacha-core.S
rename to lib/crypto/mips/chacha-core.S
lib/crypto/mips/chacha-glue.c renamed from arch/mips/lib/crypto/chacha-glue.c +0 -0
similarity index 100%
rename from arch/mips/lib/crypto/chacha-glue.c
rename to lib/crypto/mips/chacha-glue.c
lib/crypto/mips/poly1305-glue.c renamed from arch/mips/lib/crypto/poly1305-glue.c +0 -0
similarity index 100%
rename from arch/mips/lib/crypto/poly1305-glue.c
rename to lib/crypto/mips/poly1305-glue.c
lib/crypto/mips/poly1305-mips.pl renamed from arch/mips/lib/crypto/poly1305-mips.pl +0 -0
similarity index 100%
rename from arch/mips/lib/crypto/poly1305-mips.pl
rename to lib/crypto/mips/poly1305-mips.pl
Signature · 1 line
2.50.0
author maintainer
#4 lore raw

PATCH v2 4/9 lib/crypto: powerpc: move arch/powerpc/lib/crypto/ into lib/crypto/

In reply to Eric Biggers

From: Eric Biggers <[email protected]>

Move the contents of arch/powerpc/lib/crypto/ into lib/crypto/powerpc/.

The new code organization makes a lot more sense for how this code actually works and is developed. In particular, it makes it possible to build each algorithm as a single module, with better inlining and dead code elimination. For a more detailed explanation, see the patchset which did this for the CRC library code:
https://lore.kernel.org/r/[email protected]/.
Also see the patchset which did this for SHA-512:
https://lore.kernel.org/linux-crypto/[email protected]/

This is just a preparatory commit, which does the move to get the files into their new location but keeps them building the same way as before. Later commits will make the actual improvements to the way the arch-optimized code is integrated for each algorithm.

---
 arch/powerpc/lib/Makefile                                       | 2 --
 lib/crypto/Kconfig                                              | 2 +-
 lib/crypto/Makefile                                             | 1 +
 {arch/powerpc/lib/crypto => lib/crypto/powerpc}/Kconfig         | 0
 {arch/powerpc/lib/crypto => lib/crypto/powerpc}/Makefile        | 0
 .../powerpc/lib/crypto => lib/crypto/powerpc}/chacha-p10-glue.c | 0
 .../powerpc/lib/crypto => lib/crypto/powerpc}/chacha-p10le-8x.S | 0
 .../lib/crypto => lib/crypto/powerpc}/poly1305-p10-glue.c       | 0
 .../lib/crypto => lib/crypto/powerpc}/poly1305-p10le_64.S       | 0
 .../powerpc/lib/crypto => lib/crypto/powerpc}/sha256-spe-asm.S  | 0
 {arch/powerpc/lib/crypto => lib/crypto/powerpc}/sha256.c        | 0
 11 files changed, 2 insertions(+), 3 deletions(-)
 rename {arch/powerpc/lib/crypto => lib/crypto/powerpc}/Kconfig (100%)
 rename {arch/powerpc/lib/crypto => lib/crypto/powerpc}/Makefile (100%)
 rename {arch/powerpc/lib/crypto => lib/crypto/powerpc}/chacha-p10-glue.c (100%)
 rename {arch/powerpc/lib/crypto => lib/crypto/powerpc}/chacha-p10le-8x.S (100%)
 rename {arch/powerpc/lib/crypto => lib/crypto/powerpc}/poly1305-p10-glue.c (100%)
 rename {arch/powerpc/lib/crypto => lib/crypto/powerpc}/poly1305-p10le_64.S (100%)
 rename {arch/powerpc/lib/crypto => lib/crypto/powerpc}/sha256-spe-asm.S (100%)
 rename {arch/powerpc/lib/crypto => lib/crypto/powerpc}/sha256.c (100%)
arch/powerpc/lib/Makefile +0 -2
index 481f968e42c7b..27f8a01438603 100644
@@ -1,12 +1,10 @@
 # SPDX-License-Identifier: GPL-2.0
 #
 # Makefile for ppc-specific library files..
 #
 
-obj-y += crypto/
-
 CFLAGS_code-patching.o += -fno-stack-protector
 CFLAGS_feature-fixups.o += -fno-stack-protector
 
 CFLAGS_REMOVE_code-patching.o = $(CC_FLAGS_FTRACE)
 CFLAGS_REMOVE_feature-fixups.o = $(CC_FLAGS_FTRACE)
lib/crypto/Kconfig +1 -1
index 43c44316fbbdc..f4f9a70dd0891 100644
@@ -197,11 +197,11 @@ source "lib/crypto/arm64/Kconfig"
 endif
 if MIPS
 source "lib/crypto/mips/Kconfig"
 endif
 if PPC
-source "arch/powerpc/lib/crypto/Kconfig"
+source "lib/crypto/powerpc/Kconfig"
 endif
 if RISCV
 source "arch/riscv/lib/crypto/Kconfig"
 endif
 if S390
lib/crypto/Makefile +1 -0
index 74331243b8c44..47c889b881b2a 100644
@@ -104,5 +104,6 @@ obj-$(CONFIG_CRYPTO_LIB_SM3)			+= libsm3.o
 libsm3-y					:= sm3.o
 
 obj-$(CONFIG_ARM) += arm/
 obj-$(CONFIG_ARM64) += arm64/
 obj-$(CONFIG_MIPS) += mips/
+obj-$(CONFIG_PPC) += powerpc/
lib/crypto/powerpc/Kconfig renamed from arch/powerpc/lib/crypto/Kconfig +0 -0
similarity index 100%
rename from arch/powerpc/lib/crypto/Kconfig
rename to lib/crypto/powerpc/Kconfig
lib/crypto/powerpc/Makefile renamed from arch/powerpc/lib/crypto/Makefile +0 -0
similarity index 100%
rename from arch/powerpc/lib/crypto/Makefile
rename to lib/crypto/powerpc/Makefile
lib/crypto/powerpc/chacha-p10-glue.c renamed from arch/powerpc/lib/crypto/chacha-p10-glue.c +0 -0
similarity index 100%
rename from arch/powerpc/lib/crypto/chacha-p10-glue.c
rename to lib/crypto/powerpc/chacha-p10-glue.c
lib/crypto/powerpc/chacha-p10le-8x.S renamed from arch/powerpc/lib/crypto/chacha-p10le-8x.S +0 -0
similarity index 100%
rename from arch/powerpc/lib/crypto/chacha-p10le-8x.S
rename to lib/crypto/powerpc/chacha-p10le-8x.S
lib/crypto/powerpc/poly1305-p10-glue.c renamed from arch/powerpc/lib/crypto/poly1305-p10-glue.c +0 -0
similarity index 100%
rename from arch/powerpc/lib/crypto/poly1305-p10-glue.c
rename to lib/crypto/powerpc/poly1305-p10-glue.c
lib/crypto/powerpc/poly1305-p10le_64.S renamed from arch/powerpc/lib/crypto/poly1305-p10le_64.S +0 -0
similarity index 100%
rename from arch/powerpc/lib/crypto/poly1305-p10le_64.S
rename to lib/crypto/powerpc/poly1305-p10le_64.S
lib/crypto/powerpc/sha256-spe-asm.S renamed from arch/powerpc/lib/crypto/sha256-spe-asm.S +0 -0
similarity index 100%
rename from arch/powerpc/lib/crypto/sha256-spe-asm.S
rename to lib/crypto/powerpc/sha256-spe-asm.S
lib/crypto/powerpc/sha256.c renamed from arch/powerpc/lib/crypto/sha256.c +0 -0
similarity index 100%
rename from arch/powerpc/lib/crypto/sha256.c
rename to lib/crypto/powerpc/sha256.c
Signature · 1 line
2.50.0
author maintainer
#5 lore raw

PATCH v2 5/9 lib/crypto: riscv: move arch/riscv/lib/crypto/ into lib/crypto/

In reply to Eric Biggers

From: Eric Biggers <[email protected]>

Move the contents of arch/riscv/lib/crypto/ into lib/crypto/riscv/.

The new code organization makes a lot more sense for how this code actually works and is developed. In particular, it makes it possible to build each algorithm as a single module, with better inlining and dead code elimination. For a more detailed explanation, see the patchset which did this for the CRC library code:
https://lore.kernel.org/r/[email protected]/.
Also see the patchset which did this for SHA-512:
https://lore.kernel.org/linux-crypto/[email protected]/

This is just a preparatory commit, which does the move to get the files into their new location but keeps them building the same way as before. Later commits will make the actual improvements to the way the arch-optimized code is integrated for each algorithm.

---
 arch/riscv/lib/Makefile                                         | 1 -
 lib/crypto/Kconfig                                              | 2 +-
 lib/crypto/Makefile                                             | 1 +
 {arch/riscv/lib/crypto => lib/crypto/riscv}/Kconfig             | 0
 {arch/riscv/lib/crypto => lib/crypto/riscv}/Makefile            | 0
 .../riscv/lib/crypto => lib/crypto/riscv}/chacha-riscv64-glue.c | 0
 .../riscv/lib/crypto => lib/crypto/riscv}/chacha-riscv64-zvkb.S | 0
 .../crypto/riscv}/sha256-riscv64-zvknha_or_zvknhb-zvkb.S        | 0
 {arch/riscv/lib/crypto => lib/crypto/riscv}/sha256.c            | 0
 9 files changed, 2 insertions(+), 2 deletions(-)
 rename {arch/riscv/lib/crypto => lib/crypto/riscv}/Kconfig (100%)
 rename {arch/riscv/lib/crypto => lib/crypto/riscv}/Makefile (100%)
 rename {arch/riscv/lib/crypto => lib/crypto/riscv}/chacha-riscv64-glue.c (100%)
 rename {arch/riscv/lib/crypto => lib/crypto/riscv}/chacha-riscv64-zvkb.S (100%)
 rename {arch/riscv/lib/crypto => lib/crypto/riscv}/sha256-riscv64-zvknha_or_zvknhb-zvkb.S (100%)
 rename {arch/riscv/lib/crypto => lib/crypto/riscv}/sha256.c (100%)
arch/riscv/lib/Makefile +0 -1
index 0baec92d2f55b..b1c46153606a6 100644
@@ -1,7 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0-only
-obj-y			+= crypto/
 lib-y			+= delay.o
 lib-y			+= memcpy.o
 lib-y			+= memset.o
 lib-y			+= memmove.o
 ifeq ($(CONFIG_KASAN_GENERIC)$(CONFIG_KASAN_SW_TAGS),)
lib/crypto/Kconfig +1 -1
index f4f9a70dd0891..a2b58ca2df0cc 100644
@@ -200,11 +200,11 @@ source "lib/crypto/mips/Kconfig"
 endif
 if PPC
 source "lib/crypto/powerpc/Kconfig"
 endif
 if RISCV
-source "arch/riscv/lib/crypto/Kconfig"
+source "lib/crypto/riscv/Kconfig"
 endif
 if S390
 source "arch/s390/lib/crypto/Kconfig"
 endif
 if SPARC
lib/crypto/Makefile +1 -0
index 47c889b881b2a..0fe9200a031d6 100644
@@ -105,5 +105,6 @@ libsm3-y					:= sm3.o
 
 obj-$(CONFIG_ARM) += arm/
 obj-$(CONFIG_ARM64) += arm64/
 obj-$(CONFIG_MIPS) += mips/
 obj-$(CONFIG_PPC) += powerpc/
+obj-$(CONFIG_RISCV) += riscv/
lib/crypto/riscv/Kconfig renamed from arch/riscv/lib/crypto/Kconfig +0 -0
similarity index 100%
rename from arch/riscv/lib/crypto/Kconfig
rename to lib/crypto/riscv/Kconfig
lib/crypto/riscv/Makefile renamed from arch/riscv/lib/crypto/Makefile +0 -0
similarity index 100%
rename from arch/riscv/lib/crypto/Makefile
rename to lib/crypto/riscv/Makefile
lib/crypto/riscv/chacha-riscv64-glue.c renamed from arch/riscv/lib/crypto/chacha-riscv64-glue.c +0 -0
similarity index 100%
rename from arch/riscv/lib/crypto/chacha-riscv64-glue.c
rename to lib/crypto/riscv/chacha-riscv64-glue.c
lib/crypto/riscv/chacha-riscv64-zvkb.S renamed from arch/riscv/lib/crypto/chacha-riscv64-zvkb.S +0 -0
similarity index 100%
rename from arch/riscv/lib/crypto/chacha-riscv64-zvkb.S
rename to lib/crypto/riscv/chacha-riscv64-zvkb.S
lib/crypto/riscv/sha256-riscv64-zvknha_or_zvknhb-zvkb.S renamed from arch/riscv/lib/crypto/sha256-riscv64-zvknha_or_zvknhb-zvkb.S +0 -0
similarity index 100%
rename from arch/riscv/lib/crypto/sha256-riscv64-zvknha_or_zvknhb-zvkb.S
rename to lib/crypto/riscv/sha256-riscv64-zvknha_or_zvknhb-zvkb.S
lib/crypto/riscv/sha256.c renamed from arch/riscv/lib/crypto/sha256.c +0 -0
similarity index 100%
rename from arch/riscv/lib/crypto/sha256.c
rename to lib/crypto/riscv/sha256.c
Signature · 1 line
2.50.0
maintainer Acked-by on v2 5/9
#6 lore raw

Re: [PATCH v2 5/9] lib/crypto: riscv: move arch/riscv/lib/crypto/ into lib/crypto/

Quoted 28 lines · On Thu, 19 Jun 2025 12:19:04 PDT (-0700), [email protected] wrote:

From: Eric Biggers <[email protected]>

Move the contents of arch/riscv/lib/crypto/ into lib/crypto/riscv/.

The new code organization makes a lot more sense for how this code actually works and is developed. In particular, it makes it possible to build each algorithm as a single module, with better inlining and dead code elimination. For a more detailed explanation, see the patchset which did this for the CRC library code:
https://lore.kernel.org/r/[email protected]/.
Also see the patchset which did this for SHA-512:
https://lore.kernel.org/linux-crypto/[email protected]/

This is just a preparatory commit, which does the move to get the files into their new location but keeps them building the same way as before. Later commits will make the actual improvements to the way the arch-optimized code is integrated for each algorithm.

---
 arch/riscv/lib/Makefile                                         | 1 -
 lib/crypto/Kconfig                                              | 2 +-
 lib/crypto/Makefile                                             | 1 +
 {arch/riscv/lib/crypto => lib/crypto/riscv}/Kconfig             | 0
 {arch/riscv/lib/crypto => lib/crypto/riscv}/Makefile            | 0
 .../riscv/lib/crypto => lib/crypto/riscv}/chacha-riscv64-glue.c | 0
 .../riscv/lib/crypto => lib/crypto/riscv}/chacha-riscv64-zvkb.S | 0
 .../crypto/riscv}/sha256-riscv64-zvknha_or_zvknhb-zvkb.S        | 0
Quoted 8 lines
 {arch/riscv/lib/crypto => lib/crypto/riscv}/sha256.c            | 0
 9 files changed, 2 insertions(+), 2 deletions(-)
 rename {arch/riscv/lib/crypto => lib/crypto/riscv}/Kconfig (100%)
 rename {arch/riscv/lib/crypto => lib/crypto/riscv}/Makefile (100%)
 rename {arch/riscv/lib/crypto => lib/crypto/riscv}/chacha-riscv64-glue.c (100%)
 rename {arch/riscv/lib/crypto => lib/crypto/riscv}/chacha-riscv64-zvkb.S (100%)
 rename {arch/riscv/lib/crypto => lib/crypto/riscv}/sha256-riscv64-zvknha_or_zvknhb-zvkb.S (100%)
 rename {arch/riscv/lib/crypto => lib/crypto/riscv}/sha256.c (100%)

I'm assuming you want to keep these all together.

Thanks!

author maintainer
#7 lore raw

Re: [PATCH v2 5/9] lib/crypto: riscv: move arch/riscv/lib/crypto/ into lib/crypto/

Quoted 38 lines · Palmer Dabbelt
Quoted 28 lines · On Thu, 19 Jun 2025 12:19:04 PDT (-0700), [email protected] wrote:

From: Eric Biggers <[email protected]>

Move the contents of arch/riscv/lib/crypto/ into lib/crypto/riscv/.

The new code organization makes a lot more sense for how this code actually works and is developed. In particular, it makes it possible to build each algorithm as a single module, with better inlining and dead code elimination. For a more detailed explanation, see the patchset which did this for the CRC library code:
https://lore.kernel.org/r/[email protected]/.
Also see the patchset which did this for SHA-512:
https://lore.kernel.org/linux-crypto/[email protected]/

This is just a preparatory commit, which does the move to get the files into their new location but keeps them building the same way as before. Later commits will make the actual improvements to the way the arch-optimized code is integrated for each algorithm.

---
 arch/riscv/lib/Makefile                                         | 1 -
 lib/crypto/Kconfig                                              | 2 +-
 lib/crypto/Makefile                                             | 1 +
 {arch/riscv/lib/crypto => lib/crypto/riscv}/Kconfig             | 0
 {arch/riscv/lib/crypto => lib/crypto/riscv}/Makefile            | 0
 .../riscv/lib/crypto => lib/crypto/riscv}/chacha-riscv64-glue.c | 0
 .../riscv/lib/crypto => lib/crypto/riscv}/chacha-riscv64-zvkb.S | 0
 .../crypto/riscv}/sha256-riscv64-zvknha_or_zvknhb-zvkb.S        | 0
Quoted 8 lines
 {arch/riscv/lib/crypto => lib/crypto/riscv}/sha256.c            | 0
 9 files changed, 2 insertions(+), 2 deletions(-)
 rename {arch/riscv/lib/crypto => lib/crypto/riscv}/Kconfig (100%)
 rename {arch/riscv/lib/crypto => lib/crypto/riscv}/Makefile (100%)
 rename {arch/riscv/lib/crypto => lib/crypto/riscv}/chacha-riscv64-glue.c (100%)
 rename {arch/riscv/lib/crypto => lib/crypto/riscv}/chacha-riscv64-zvkb.S (100%)
 rename {arch/riscv/lib/crypto => lib/crypto/riscv}/sha256-riscv64-zvknha_or_zvknhb-zvkb.S (100%)
 rename {arch/riscv/lib/crypto => lib/crypto/riscv}/sha256.c (100%)
Quoted 4 lines

I'm assuming you want to keep these all together.

Yes, I'm taking this series through libcrypto-next. Thanks!

- Eric

author maintainer
#8 lore raw

PATCH v2 6/9 lib/crypto: s390: move arch/s390/lib/crypto/ into lib/crypto/

In reply to Eric Biggers

From: Eric Biggers <[email protected]>

Move the contents of arch/s390/lib/crypto/ into lib/crypto/s390/.

The new code organization makes a lot more sense for how this code actually works and is developed. In particular, it makes it possible to build each algorithm as a single module, with better inlining and dead code elimination. For a more detailed explanation, see the patchset which did this for the CRC library code:
https://lore.kernel.org/r/[email protected]/.
Also see the patchset which did this for SHA-512:
https://lore.kernel.org/linux-crypto/[email protected]/

This is just a preparatory commit, which does the move to get the files into their new location but keeps them building the same way as before. Later commits will make the actual improvements to the way the arch-optimized code is integrated for each algorithm.

---
 arch/s390/lib/Makefile                                  | 1 -
 lib/crypto/Kconfig                                      | 2 +-
 lib/crypto/Makefile                                     | 1 +
 {arch/s390/lib/crypto => lib/crypto/s390}/Kconfig       | 0
 {arch/s390/lib/crypto => lib/crypto/s390}/Makefile      | 0
 {arch/s390/lib/crypto => lib/crypto/s390}/chacha-glue.c | 0
 {arch/s390/lib/crypto => lib/crypto/s390}/chacha-s390.S | 0
 {arch/s390/lib/crypto => lib/crypto/s390}/chacha-s390.h | 0
 {arch/s390/lib/crypto => lib/crypto/s390}/sha256.c      | 0
 9 files changed, 2 insertions(+), 2 deletions(-)
 rename {arch/s390/lib/crypto => lib/crypto/s390}/Kconfig (100%)
 rename {arch/s390/lib/crypto => lib/crypto/s390}/Makefile (100%)
 rename {arch/s390/lib/crypto => lib/crypto/s390}/chacha-glue.c (100%)
 rename {arch/s390/lib/crypto => lib/crypto/s390}/chacha-s390.S (100%)
 rename {arch/s390/lib/crypto => lib/crypto/s390}/chacha-s390.h (100%)
 rename {arch/s390/lib/crypto => lib/crypto/s390}/sha256.c (100%)
arch/s390/lib/Makefile +0 -1
index cd35cdbfa8713..271a1c407121c 100644
@@ -1,11 +1,10 @@
 # SPDX-License-Identifier: GPL-2.0
 #
 # Makefile for s390-specific library files..
 #
 
-obj-y += crypto/
 lib-y += delay.o string.o uaccess.o find.o spinlock.o tishift.o
 lib-y += csum-partial.o
 obj-y += mem.o xor.o
 lib-$(CONFIG_KPROBES) += probes.o
 lib-$(CONFIG_UPROBES) += probes.o
lib/crypto/Kconfig +1 -1
index a2b58ca2df0cc..278b7ef5ec4f9 100644
@@ -203,11 +203,11 @@ source "lib/crypto/powerpc/Kconfig"
 endif
 if RISCV
 source "lib/crypto/riscv/Kconfig"
 endif
 if S390
-source "arch/s390/lib/crypto/Kconfig"
+source "lib/crypto/s390/Kconfig"
 endif
 if SPARC
 source "arch/sparc/lib/crypto/Kconfig"
 endif
 if X86
lib/crypto/Makefile +1 -0
index 0fe9200a031d6..4cda1f5cd21d4 100644
@@ -106,5 +106,6 @@ libsm3-y					:= sm3.o
 obj-$(CONFIG_ARM) += arm/
 obj-$(CONFIG_ARM64) += arm64/
 obj-$(CONFIG_MIPS) += mips/
 obj-$(CONFIG_PPC) += powerpc/
 obj-$(CONFIG_RISCV) += riscv/
+obj-$(CONFIG_S390) += s390/
lib/crypto/s390/Kconfig renamed from arch/s390/lib/crypto/Kconfig +0 -0
similarity index 100%
rename from arch/s390/lib/crypto/Kconfig
rename to lib/crypto/s390/Kconfig
lib/crypto/s390/Makefile renamed from arch/s390/lib/crypto/Makefile +0 -0
similarity index 100%
rename from arch/s390/lib/crypto/Makefile
rename to lib/crypto/s390/Makefile
lib/crypto/s390/chacha-glue.c renamed from arch/s390/lib/crypto/chacha-glue.c +0 -0
similarity index 100%
rename from arch/s390/lib/crypto/chacha-glue.c
rename to lib/crypto/s390/chacha-glue.c
lib/crypto/s390/chacha-s390.S renamed from arch/s390/lib/crypto/chacha-s390.S +0 -0
similarity index 100%
rename from arch/s390/lib/crypto/chacha-s390.S
rename to lib/crypto/s390/chacha-s390.S
lib/crypto/s390/chacha-s390.h renamed from arch/s390/lib/crypto/chacha-s390.h +0 -0
similarity index 100%
rename from arch/s390/lib/crypto/chacha-s390.h
rename to lib/crypto/s390/chacha-s390.h
lib/crypto/s390/sha256.c renamed from arch/s390/lib/crypto/sha256.c +0 -0
similarity index 100%
rename from arch/s390/lib/crypto/sha256.c
rename to lib/crypto/s390/sha256.c
Signature · 1 line
2.50.0
author maintainer
#9 lore raw

PATCH v2 7/9 lib/crypto: sparc: move arch/sparc/lib/crypto/ into lib/crypto/

In reply to Eric Biggers

From: Eric Biggers <[email protected]>

Move the contents of arch/sparc/lib/crypto/ into lib/crypto/sparc/.

The new code organization makes a lot more sense for how this code actually works and is developed. In particular, it makes it possible to build each algorithm as a single module, with better inlining and dead code elimination. For a more detailed explanation, see the patchset which did this for the CRC library code:
https://lore.kernel.org/r/[email protected]/.
Also see the patchset which did this for SHA-512:
https://lore.kernel.org/linux-crypto/[email protected]/

This is just a preparatory commit, which does the move to get the files into their new location but keeps them building the same way as before. Later commits will make the actual improvements to the way the arch-optimized code is integrated for each algorithm.

---
 arch/sparc/lib/Makefile                                  | 1 -
 lib/crypto/Kconfig                                       | 2 +-
 lib/crypto/Makefile                                      | 1 +
 {arch/sparc/lib/crypto => lib/crypto/sparc}/Kconfig      | 0
 {arch/sparc/lib/crypto => lib/crypto/sparc}/Makefile     | 0
 {arch/sparc/lib/crypto => lib/crypto/sparc}/sha256.c     | 0
 {arch/sparc/lib/crypto => lib/crypto/sparc}/sha256_asm.S | 0
 7 files changed, 2 insertions(+), 2 deletions(-)
 rename {arch/sparc/lib/crypto => lib/crypto/sparc}/Kconfig (100%)
 rename {arch/sparc/lib/crypto => lib/crypto/sparc}/Makefile (100%)
 rename {arch/sparc/lib/crypto => lib/crypto/sparc}/sha256.c (100%)
 rename {arch/sparc/lib/crypto => lib/crypto/sparc}/sha256_asm.S (100%)
arch/sparc/lib/Makefile +0 -1
index 5cf9781d68b40..ef8860eb3f3d1 100644
@@ -2,11 +2,10 @@
 # Makefile for Sparc library files..
 #
 
 asflags-y := -ansi -DST_DIV0=0x02
 
-obj-y                 += crypto/
 lib-$(CONFIG_SPARC32) += ashrdi3.o
 lib-$(CONFIG_SPARC32) += memcpy.o memset.o
 lib-y                 += strlen.o
 lib-y                 += checksum_$(BITS).o
 lib-$(CONFIG_SPARC32) += blockops.o
lib/crypto/Kconfig +1 -1
index 278b7ef5ec4f9..b98543c7ef231 100644
@@ -206,11 +206,11 @@ source "lib/crypto/riscv/Kconfig"
 endif
 if S390
 source "lib/crypto/s390/Kconfig"
 endif
 if SPARC
-source "arch/sparc/lib/crypto/Kconfig"
+source "lib/crypto/sparc/Kconfig"
 endif
 if X86
 source "arch/x86/lib/crypto/Kconfig"
 endif
 endif
lib/crypto/Makefile +1 -0
index 4cda1f5cd21d4..748d1fc6b6be2 100644
@@ -107,5 +107,6 @@ obj-$(CONFIG_ARM) += arm/
 obj-$(CONFIG_ARM64) += arm64/
 obj-$(CONFIG_MIPS) += mips/
 obj-$(CONFIG_PPC) += powerpc/
 obj-$(CONFIG_RISCV) += riscv/
 obj-$(CONFIG_S390) += s390/
+obj-$(CONFIG_SPARC) += sparc/
lib/crypto/sparc/Kconfig renamed from arch/sparc/lib/crypto/Kconfig +0 -0
similarity index 100%
rename from arch/sparc/lib/crypto/Kconfig
rename to lib/crypto/sparc/Kconfig
lib/crypto/sparc/Makefile renamed from arch/sparc/lib/crypto/Makefile +0 -0
similarity index 100%
rename from arch/sparc/lib/crypto/Makefile
rename to lib/crypto/sparc/Makefile
lib/crypto/sparc/sha256.c renamed from arch/sparc/lib/crypto/sha256.c +0 -0
similarity index 100%
rename from arch/sparc/lib/crypto/sha256.c
rename to lib/crypto/sparc/sha256.c
lib/crypto/sparc/sha256_asm.S renamed from arch/sparc/lib/crypto/sha256_asm.S +0 -0
similarity index 100%
rename from arch/sparc/lib/crypto/sha256_asm.S
rename to lib/crypto/sparc/sha256_asm.S
Signature · 1 line
2.50.0
author maintainer
#10 lore raw

PATCH v2 8/9 lib/crypto: x86: move arch/x86/lib/crypto/ into lib/crypto/

In reply to Eric Biggers

From: Eric Biggers <[email protected]>

Move the contents of arch/x86/lib/crypto/ into lib/crypto/x86/.

The new code organization makes a lot more sense for how this code actually works and is developed. In particular, it makes it possible to build each algorithm as a single module, with better inlining and dead code elimination. For a more detailed explanation, see the patchset which did this for the CRC library code:
https://lore.kernel.org/r/[email protected]/.
Also see the patchset which did this for SHA-512:
https://lore.kernel.org/linux-crypto/[email protected]/

This is just a preparatory commit, which does the move to get the files into their new location but keeps them building the same way as before. Later commits will make the actual improvements to the way the arch-optimized code is integrated for each algorithm.

Add a gitignore entry for the removed directory arch/x86/lib/crypto/ so that people don't accidentally commit leftover generated files.

---
 arch/x86/lib/.gitignore                                       | 4 ++++
 arch/x86/lib/Makefile                                         | 2 --
 lib/crypto/Kconfig                                            | 2 +-
 lib/crypto/Makefile                                           | 1 +
 {arch/x86/lib/crypto => lib/crypto/x86}/.gitignore            | 0
 {arch/x86/lib/crypto => lib/crypto/x86}/Kconfig               | 0
 {arch/x86/lib/crypto => lib/crypto/x86}/Makefile              | 0
 {arch/x86/lib/crypto => lib/crypto/x86}/blake2s-core.S        | 0
 {arch/x86/lib/crypto => lib/crypto/x86}/blake2s-glue.c        | 0
 {arch/x86/lib/crypto => lib/crypto/x86}/chacha-avx2-x86_64.S  | 0
 .../lib/crypto => lib/crypto/x86}/chacha-avx512vl-x86_64.S    | 0
 {arch/x86/lib/crypto => lib/crypto/x86}/chacha-ssse3-x86_64.S | 0
 {arch/x86/lib/crypto => lib/crypto/x86}/chacha_glue.c         | 0
 .../crypto => lib/crypto/x86}/poly1305-x86_64-cryptogams.pl   | 0
 {arch/x86/lib/crypto => lib/crypto/x86}/poly1305_glue.c       | 0
 {arch/x86/lib/crypto => lib/crypto/x86}/sha256-avx-asm.S      | 0
 {arch/x86/lib/crypto => lib/crypto/x86}/sha256-avx2-asm.S     | 0
 {arch/x86/lib/crypto => lib/crypto/x86}/sha256-ni-asm.S       | 0
 {arch/x86/lib/crypto => lib/crypto/x86}/sha256-ssse3-asm.S    | 0
 {arch/x86/lib/crypto => lib/crypto/x86}/sha256.c              | 0
 20 files changed, 6 insertions(+), 3 deletions(-)
 rename {arch/x86/lib/crypto => lib/crypto/x86}/.gitignore (100%)
 rename {arch/x86/lib/crypto => lib/crypto/x86}/Kconfig (100%)
 rename {arch/x86/lib/crypto => lib/crypto/x86}/Makefile (100%)
 rename {arch/x86/lib/crypto => lib/crypto/x86}/blake2s-core.S (100%)
 rename {arch/x86/lib/crypto => lib/crypto/x86}/blake2s-glue.c (100%)
 rename {arch/x86/lib/crypto => lib/crypto/x86}/chacha-avx2-x86_64.S (100%)
 rename {arch/x86/lib/crypto => lib/crypto/x86}/chacha-avx512vl-x86_64.S (100%)
 rename {arch/x86/lib/crypto => lib/crypto/x86}/chacha-ssse3-x86_64.S (100%)
 rename {arch/x86/lib/crypto => lib/crypto/x86}/chacha_glue.c (100%)
 rename {arch/x86/lib/crypto => lib/crypto/x86}/poly1305-x86_64-cryptogams.pl (100%)
 rename {arch/x86/lib/crypto => lib/crypto/x86}/poly1305_glue.c (100%)
 rename {arch/x86/lib/crypto => lib/crypto/x86}/sha256-avx-asm.S (100%)
 rename {arch/x86/lib/crypto => lib/crypto/x86}/sha256-avx2-asm.S (100%)
 rename {arch/x86/lib/crypto => lib/crypto/x86}/sha256-ni-asm.S (100%)
 rename {arch/x86/lib/crypto => lib/crypto/x86}/sha256-ssse3-asm.S (100%)
 rename {arch/x86/lib/crypto => lib/crypto/x86}/sha256.c (100%)
arch/x86/lib/.gitignore +4 -0
index 8ae0f93ecbfdd..ec2131c9fd206 100644
@@ -1,2 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0-only
+
+# This now-removed directory used to contain generated files.
+/crypto/
+
 inat-tables.c
arch/x86/lib/Makefile +0 -2
index 4fa5c4e1ba8a0..7cf8681cba0f2 100644
@@ -1,12 +1,10 @@
 # SPDX-License-Identifier: GPL-2.0
 #
 # Makefile for x86 specific library files.
 #
 
-obj-y += crypto/
-
 # Produces uninteresting flaky coverage.
 KCOV_INSTRUMENT_delay.o	:= n
 
 # KCSAN uses udelay for introducing watchpoint delay; avoid recursion.
 KCSAN_SANITIZE_delay.o := n
lib/crypto/Kconfig +1 -1
index b98543c7ef231..2460ddff967fc 100644
@@ -209,10 +209,10 @@ source "lib/crypto/s390/Kconfig"
 endif
 if SPARC
 source "lib/crypto/sparc/Kconfig"
 endif
 if X86
-source "arch/x86/lib/crypto/Kconfig"
+source "lib/crypto/x86/Kconfig"
 endif
 endif
 
 endmenu
lib/crypto/Makefile +1 -0
index 748d1fc6b6be2..16f5d76d92710 100644
@@ -108,5 +108,6 @@ obj-$(CONFIG_ARM64) += arm64/
 obj-$(CONFIG_MIPS) += mips/
 obj-$(CONFIG_PPC) += powerpc/
 obj-$(CONFIG_RISCV) += riscv/
 obj-$(CONFIG_S390) += s390/
 obj-$(CONFIG_SPARC) += sparc/
+obj-$(CONFIG_X86) += x86/
lib/crypto/x86/.gitignore renamed from arch/x86/lib/crypto/.gitignore +0 -0
similarity index 100%
rename from arch/x86/lib/crypto/.gitignore
rename to lib/crypto/x86/.gitignore
lib/crypto/x86/Kconfig renamed from arch/x86/lib/crypto/Kconfig +0 -0
similarity index 100%
rename from arch/x86/lib/crypto/Kconfig
rename to lib/crypto/x86/Kconfig
lib/crypto/x86/Makefile renamed from arch/x86/lib/crypto/Makefile +0 -0
similarity index 100%
rename from arch/x86/lib/crypto/Makefile
rename to lib/crypto/x86/Makefile
lib/crypto/x86/blake2s-core.S renamed from arch/x86/lib/crypto/blake2s-core.S +0 -0
similarity index 100%
rename from arch/x86/lib/crypto/blake2s-core.S
rename to lib/crypto/x86/blake2s-core.S
lib/crypto/x86/blake2s-glue.c renamed from arch/x86/lib/crypto/blake2s-glue.c +0 -0
similarity index 100%
rename from arch/x86/lib/crypto/blake2s-glue.c
rename to lib/crypto/x86/blake2s-glue.c
lib/crypto/x86/chacha-avx2-x86_64.S renamed from arch/x86/lib/crypto/chacha-avx2-x86_64.S +0 -0
similarity index 100%
rename from arch/x86/lib/crypto/chacha-avx2-x86_64.S
rename to lib/crypto/x86/chacha-avx2-x86_64.S
lib/crypto/x86/chacha-avx512vl-x86_64.S renamed from arch/x86/lib/crypto/chacha-avx512vl-x86_64.S +0 -0
similarity index 100%
rename from arch/x86/lib/crypto/chacha-avx512vl-x86_64.S
rename to lib/crypto/x86/chacha-avx512vl-x86_64.S
lib/crypto/x86/chacha-ssse3-x86_64.S renamed from arch/x86/lib/crypto/chacha-ssse3-x86_64.S +0 -0
similarity index 100%
rename from arch/x86/lib/crypto/chacha-ssse3-x86_64.S
rename to lib/crypto/x86/chacha-ssse3-x86_64.S
lib/crypto/x86/chacha_glue.c renamed from arch/x86/lib/crypto/chacha_glue.c +0 -0
similarity index 100%
rename from arch/x86/lib/crypto/chacha_glue.c
rename to lib/crypto/x86/chacha_glue.c
lib/crypto/x86/poly1305-x86_64-cryptogams.pl renamed from arch/x86/lib/crypto/poly1305-x86_64-cryptogams.pl +0 -0
similarity index 100%
rename from arch/x86/lib/crypto/poly1305-x86_64-cryptogams.pl
rename to lib/crypto/x86/poly1305-x86_64-cryptogams.pl
lib/crypto/x86/poly1305_glue.c renamed from arch/x86/lib/crypto/poly1305_glue.c +0 -0
similarity index 100%
rename from arch/x86/lib/crypto/poly1305_glue.c
rename to lib/crypto/x86/poly1305_glue.c
lib/crypto/x86/sha256-avx-asm.S renamed from arch/x86/lib/crypto/sha256-avx-asm.S +0 -0
similarity index 100%
rename from arch/x86/lib/crypto/sha256-avx-asm.S
rename to lib/crypto/x86/sha256-avx-asm.S
lib/crypto/x86/sha256-avx2-asm.S renamed from arch/x86/lib/crypto/sha256-avx2-asm.S +0 -0
similarity index 100%
rename from arch/x86/lib/crypto/sha256-avx2-asm.S
rename to lib/crypto/x86/sha256-avx2-asm.S
lib/crypto/x86/sha256-ni-asm.S renamed from arch/x86/lib/crypto/sha256-ni-asm.S +0 -0
similarity index 100%
rename from arch/x86/lib/crypto/sha256-ni-asm.S
rename to lib/crypto/x86/sha256-ni-asm.S
lib/crypto/x86/sha256-ssse3-asm.S renamed from arch/x86/lib/crypto/sha256-ssse3-asm.S +0 -0
similarity index 100%
rename from arch/x86/lib/crypto/sha256-ssse3-asm.S
rename to lib/crypto/x86/sha256-ssse3-asm.S
lib/crypto/x86/sha256.c renamed from arch/x86/lib/crypto/sha256.c +0 -0
similarity index 100%
rename from arch/x86/lib/crypto/sha256.c
rename to lib/crypto/x86/sha256.c
Signature · 1 line
2.50.0
author maintainer
#11 lore raw

PATCH v2 9/9 MAINTAINERS: drop arch/*/lib/crypto/ pattern

In reply to Eric Biggers

From: Eric Biggers <[email protected]>

Since all files arch/*/lib/crypto/* have been moved into lib/crypto/, remove the arch/*/lib/crypto/ file pattern from MAINTAINERS.

---
 MAINTAINERS | 1 -
 1 file changed, 1 deletion(-)
MAINTAINERS +0 -1
index a92290fffa163..8ca374b24a806 100644
@@ -6408,11 +6408,10 @@ M:	Jason A. Donenfeld <[email protected]>
 M:	Ard Biesheuvel <[email protected]>
 L:	[email protected]
 S:	Maintained
 T:	git https://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux.git libcrypto-next
 T:	git https://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux.git libcrypto-fixes
-F:	arch/*/lib/crypto/
 F:	lib/crypto/
 
 CRYPTO SPEED TEST COMPARE
 M:	Wang Jinchao <[email protected]>
 L:	[email protected]
Signature · 1 line
2.50.0
maintainer Acked-by on the v2 series
#13 lore raw
In reply to Eric Biggers
Quoted 30 lines · Eric Biggers

This series applies on top of
https://lore.kernel.org/r/[email protected]/
and is also available in git at:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux.git arch-to-lib-crypto-v2

This series moves the contents of arch/$(ARCH)/lib/crypto/ into lib/crypto/$(ARCH)/.

The new code organization makes a lot more sense for how this code actually works and is developed. In particular, it makes it possible to build each algorithm as a single module, with better inlining and dead code elimination. For a more detailed explanation, see the patchset which did this for the CRC library code:
https://lore.kernel.org/r/[email protected]/.
Also see the patchset which did this for SHA-512:
https://lore.kernel.org/linux-crypto/[email protected]/

This is just a preparatory series, which does the move to get the files into their new location but keeps them building the same way as before. Later patch series will make the actual improvements to the way the arch-optimized code is integrated for each algorithm.

Changed in v2:
- Instead of keeping arch/*/lib/crypto/.gitignore, instead add entry for now-removed crypto directory to arch/*/lib/.gitignore.
- Adjusted commit messages and titles.
- Added Reviewed-by.

Quoted 11 lines

Eric Biggers (9):
lib/crypto: arm: move arch/arm/lib/crypto/ into lib/crypto/ lib/crypto: arm64: move arch/arm64/lib/crypto/ into lib/crypto/ lib/crypto: mips: move arch/mips/lib/crypto/ into lib/crypto/ lib/crypto: powerpc: move arch/powerpc/lib/crypto/ into lib/crypto/ lib/crypto: riscv: move arch/riscv/lib/crypto/ into lib/crypto/ lib/crypto: s390: move arch/s390/lib/crypto/ into lib/crypto/ lib/crypto: sparc: move arch/sparc/lib/crypto/ into lib/crypto/ lib/crypto: x86: move arch/x86/lib/crypto/ into lib/crypto/
MAINTAINERS: drop arch/*/lib/crypto/ pattern

For the series,

Reviewed-by on the v2 series
#14 lore raw
In reply to Eric Biggers
Quoted 11 lines · Eric Biggers

Eric Biggers (9):
lib/crypto: arm: move arch/arm/lib/crypto/ into lib/crypto/ lib/crypto: arm64: move arch/arm64/lib/crypto/ into lib/crypto/ lib/crypto: mips: move arch/mips/lib/crypto/ into lib/crypto/ lib/crypto: powerpc: move arch/powerpc/lib/crypto/ into lib/crypto/ lib/crypto: riscv: move arch/riscv/lib/crypto/ into lib/crypto/ lib/crypto: s390: move arch/s390/lib/crypto/ into lib/crypto/ lib/crypto: sparc: move arch/sparc/lib/crypto/ into lib/crypto/ lib/crypto: x86: move arch/x86/lib/crypto/ into lib/crypto/
MAINTAINERS: drop arch/*/lib/crypto/ pattern

The updated version looks good to me.