From patchwork Tue Jun 17 22:27:18 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 897428 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 64B0D293C5B; Tue, 17 Jun 2025 22:29:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750199398; cv=none; b=dMuEpLK7UnlZ4Ty7vEG++dBk6t0+atHqkifNehukGApK2FlV5qN4tNJeLuu9MUUL8y177HqhIU1iFyWzJsDUGbhyPe6PbbZd/TGnjqFtYxDTbqHhywh5RkJkv7wEFSq2kj3QQuiBILXlJr4wuJFUGXrQ7RcBwMcNcho4HDQOq1E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750199398; c=relaxed/simple; bh=E1R8tZTC4zFm0PByz0jO522hOoQZFenFe04oUA8okGU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=k9UrapZvQLFp+cTjHLWwjRa7uwPBCG5FzPfHkYWOGLTSGiou+Oy7/tVpjbtgCiDLaguByyiHgl1Tc7bCAlSa4d62/n7EvmKmiA+cW2L+DCzUFwATUv00FjJHMu1Lf/J1peFUw5MfG2JQ4FHK7XACzg3Q+lCec0AqAKy8ZyqoH4Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=r876Iish; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="r876Iish" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E8544C4CEF1; Tue, 17 Jun 2025 22:29:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1750199398; bh=E1R8tZTC4zFm0PByz0jO522hOoQZFenFe04oUA8okGU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r876IishAxc+pn2+pvqnZzqka17ASUqbTJbVRTqL20VRsiOnlfPiaMkAv817AJJGh sGqJN5H8LVXpj+EKPjnSUI4g4bTGgDzjvYDTevWAqxOIJW7cZMQnFRL/rKd5FUWHBK HgheC4z3wqYI5pUZgOIWex2e4xR9XOKNKtQEdUGLG6fC7ioQP9legtxFA6s9JQn8ZL aiRtEdfX93s7BmvRkX5toKuNEtqtwx//Ifm3dTZ/U1mv5DGcLJ7IT8KeNXQLRl14vx w11r8GkTWnZDuj78P/14I5ydg6GH7U5Wsl5SF6OjemIAnpyTIQxf4bVkYOTIlsAjQd KaO82TpsNYkCA== From: Eric Biggers To: linux-crypto@vger.kernel.org Cc: linux-kernel@vger.kernel.org, "Jason A . Donenfeld " , Ard Biesheuvel , linux-arm-kernel@lists.infradead.org, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, sparclinux@vger.kernel.org, x86@kernel.org Subject: [PATCH 1/9] lib/crypto/arm: move arch/arm/lib/crypto/ to lib/crypto/arm/ Date: Tue, 17 Jun 2025 15:27:18 -0700 Message-ID: <20250617222726.365148-2-ebiggers@kernel.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250617222726.365148-1-ebiggers@kernel.org> References: <20250617222726.365148-1-ebiggers@kernel.org> Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Eric Biggers 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/20250607200454.73587-1-ebiggers@kernel.org/. Also see the patchset which did this for SHA-512: https://lore.kernel.org/linux-crypto/20250616014019.415791-1-ebiggers@kernel.org/ 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/arm/lib/crypto/.gitignore is intentionally kept for now. See https://lore.kernel.org/r/CAHk-=whu2fb22rEy6+oKx1-+NCHuWucZepvD0H2MD38DrJVKtg@mail.gmail.com/ I'll remove it later after some time has passed. Signed-off-by: Eric Biggers --- arch/arm/lib/Makefile | 2 -- 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 16 files changed, 5 insertions(+), 3 deletions(-) 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%) diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile index 91ea0e29107af..d05dd672bcd9c 100644 --- a/arch/arm/lib/Makefile +++ b/arch/arm/lib/Makefile @@ -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 \ diff --git a/lib/crypto/Kconfig b/lib/crypto/Kconfig index dce127a69f131..e14bef8e87af2 100644 --- a/lib/crypto/Kconfig +++ b/lib/crypto/Kconfig @@ -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 diff --git a/lib/crypto/Makefile b/lib/crypto/Makefile index 4a76169de251b..ddf04e2270f1e 100644 --- a/lib/crypto/Makefile +++ b/lib/crypto/Makefile @@ -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/ diff --git a/lib/crypto/arm/.gitignore b/lib/crypto/arm/.gitignore index 670a4d97b5684..f6c4e8ef80dae 100644 --- a/lib/crypto/arm/.gitignore +++ b/lib/crypto/arm/.gitignore @@ -1,2 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-only +poly1305-core.S +sha256-core.S sha512-core.S diff --git a/arch/arm/lib/crypto/Kconfig b/lib/crypto/arm/Kconfig similarity index 100% rename from arch/arm/lib/crypto/Kconfig rename to lib/crypto/arm/Kconfig diff --git a/arch/arm/lib/crypto/Makefile b/lib/crypto/arm/Makefile similarity index 100% rename from arch/arm/lib/crypto/Makefile rename to lib/crypto/arm/Makefile diff --git a/arch/arm/lib/crypto/blake2s-core.S b/lib/crypto/arm/blake2s-core.S similarity index 100% rename from arch/arm/lib/crypto/blake2s-core.S rename to lib/crypto/arm/blake2s-core.S diff --git a/arch/arm/lib/crypto/blake2s-glue.c b/lib/crypto/arm/blake2s-glue.c similarity index 100% rename from arch/arm/lib/crypto/blake2s-glue.c rename to lib/crypto/arm/blake2s-glue.c diff --git a/arch/arm/lib/crypto/chacha-glue.c b/lib/crypto/arm/chacha-glue.c similarity index 100% rename from arch/arm/lib/crypto/chacha-glue.c rename to lib/crypto/arm/chacha-glue.c diff --git a/arch/arm/lib/crypto/chacha-neon-core.S b/lib/crypto/arm/chacha-neon-core.S similarity index 100% rename from arch/arm/lib/crypto/chacha-neon-core.S rename to lib/crypto/arm/chacha-neon-core.S diff --git a/arch/arm/lib/crypto/chacha-scalar-core.S b/lib/crypto/arm/chacha-scalar-core.S similarity index 100% rename from arch/arm/lib/crypto/chacha-scalar-core.S rename to lib/crypto/arm/chacha-scalar-core.S diff --git a/arch/arm/lib/crypto/poly1305-armv4.pl b/lib/crypto/arm/poly1305-armv4.pl similarity index 100% rename from arch/arm/lib/crypto/poly1305-armv4.pl rename to lib/crypto/arm/poly1305-armv4.pl diff --git a/arch/arm/lib/crypto/poly1305-glue.c b/lib/crypto/arm/poly1305-glue.c similarity index 100% rename from arch/arm/lib/crypto/poly1305-glue.c rename to lib/crypto/arm/poly1305-glue.c diff --git a/arch/arm/lib/crypto/sha256-armv4.pl b/lib/crypto/arm/sha256-armv4.pl similarity index 100% rename from arch/arm/lib/crypto/sha256-armv4.pl rename to lib/crypto/arm/sha256-armv4.pl diff --git a/arch/arm/lib/crypto/sha256-ce.S b/lib/crypto/arm/sha256-ce.S similarity index 100% rename from arch/arm/lib/crypto/sha256-ce.S rename to lib/crypto/arm/sha256-ce.S diff --git a/arch/arm/lib/crypto/sha256.c b/lib/crypto/arm/sha256.c similarity index 100% rename from arch/arm/lib/crypto/sha256.c rename to lib/crypto/arm/sha256.c From patchwork Tue Jun 17 22:27:19 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 897664 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 355B1295DB2; Tue, 17 Jun 2025 22:29:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750199399; cv=none; b=QH/rA14MECBzlZXZCHKcz0sE0reGuUAE4eKxA20htFKUaa+Dmj/5ToWoa4YvaAE14uBxyqhNPUwKvk3Oe6L45PSnu0Ip+rAoCwlnpix2ad2Mcn5bS25aIFeqMgxopFTCdmh7CR5rQWPMJ0Dl//PZFy2Nd0lGil55R7NnD4hQRio= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750199399; c=relaxed/simple; bh=C+iLWRA20P3X1lC1oFCgQmxMpv2O73JWlAx7pptA2cY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VAJrBSc/uYmV5mjJeZePUQNslwIr+7px/lU+VEuYiSc+SXTwHYJ+wI6ZCmnHxigJKbiutBYhtSFMGDe0oti4ncS0saAGcKMlSoCfxRBxZpMrQITej0Im7xKpZdnYqRHqqN1ukMWaZgycXakjKHTcF7KnY365hkRXMlKp0B5OwBk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ZsitZocB; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ZsitZocB" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67248C4CEF3; Tue, 17 Jun 2025 22:29:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1750199398; bh=C+iLWRA20P3X1lC1oFCgQmxMpv2O73JWlAx7pptA2cY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZsitZocB41oAkkPQyvyXhXqiDNBnwaQ4sEvYshVLiXH0oyCVKXGvTAevOMFGVIEXZ kY1+mTaemqobfKe0sOeuuj68Zz7appHM4k1I/jZo0BU74IUNttSmxDTT4QYvsKuDRy Ps8+5uHMzGuXGa43J+UoxBdxpSZPHyX2qdljDE8scEg6gpN6e5g2AAWzADmurzXi7m PZjqnql0C+Rx2OST5bGfXe01e9aFZHwdZeHEs8LkvKLvDqNOLh4w2PgjfltJAPenrh jHKU5sXenFTuzL1pN5dCSIqwv0sAHMk+qgmIrOtUv7vnxE5wEfqvNn2t71+RbVOFFb FMPN33q43wcZQ== From: Eric Biggers To: linux-crypto@vger.kernel.org Cc: linux-kernel@vger.kernel.org, "Jason A . Donenfeld " , Ard Biesheuvel , linux-arm-kernel@lists.infradead.org, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, sparclinux@vger.kernel.org, x86@kernel.org Subject: [PATCH 2/9] lib/crypto/arm64: move arch/arm64/lib/crypto/ to lib/crypto/arm64/ Date: Tue, 17 Jun 2025 15:27:19 -0700 Message-ID: <20250617222726.365148-3-ebiggers@kernel.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250617222726.365148-1-ebiggers@kernel.org> References: <20250617222726.365148-1-ebiggers@kernel.org> Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Eric Biggers 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/20250607200454.73587-1-ebiggers@kernel.org/. Also see the patchset which did this for SHA-512: https://lore.kernel.org/linux-crypto/20250616014019.415791-1-ebiggers@kernel.org/ 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/arm64/lib/crypto/.gitignore is intentionally kept for now. See https://lore.kernel.org/r/CAHk-=whu2fb22rEy6+oKx1-+NCHuWucZepvD0H2MD38DrJVKtg@mail.gmail.com/ I'll remove it later after some time has passed. Signed-off-by: Eric Biggers --- arch/arm64/lib/Makefile | 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 {arch/arm64/lib/crypto => lib/crypto/arm64}/chacha-neon-core.S | 0 {arch/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 13 files changed, 5 insertions(+), 5 deletions(-) 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%) diff --git a/arch/arm64/lib/Makefile b/arch/arm64/lib/Makefile index 027bfa9689c6a..d97e290619bc5 100644 --- a/arch/arm64/lib/Makefile +++ b/arch/arm64/lib/Makefile @@ -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 diff --git a/lib/crypto/Kconfig b/lib/crypto/Kconfig index e14bef8e87af2..fdeb91bf00328 100644 --- a/lib/crypto/Kconfig +++ b/lib/crypto/Kconfig @@ -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 diff --git a/lib/crypto/Makefile b/lib/crypto/Makefile index ddf04e2270f1e..63ab907e8f53b 100644 --- a/lib/crypto/Makefile +++ b/lib/crypto/Makefile @@ -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/ diff --git a/lib/crypto/arm64/.gitignore b/lib/crypto/arm64/.gitignore index 670a4d97b5684..f6c4e8ef80dae 100644 --- a/lib/crypto/arm64/.gitignore +++ b/lib/crypto/arm64/.gitignore @@ -1,2 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-only +poly1305-core.S +sha256-core.S sha512-core.S diff --git a/arch/arm64/lib/crypto/Kconfig b/lib/crypto/arm64/Kconfig similarity index 100% rename from arch/arm64/lib/crypto/Kconfig rename to lib/crypto/arm64/Kconfig diff --git a/arch/arm64/lib/crypto/Makefile b/lib/crypto/arm64/Makefile similarity index 100% rename from arch/arm64/lib/crypto/Makefile rename to lib/crypto/arm64/Makefile diff --git a/arch/arm64/lib/crypto/chacha-neon-core.S b/lib/crypto/arm64/chacha-neon-core.S similarity index 100% rename from arch/arm64/lib/crypto/chacha-neon-core.S rename to lib/crypto/arm64/chacha-neon-core.S diff --git a/arch/arm64/lib/crypto/chacha-neon-glue.c b/lib/crypto/arm64/chacha-neon-glue.c similarity index 100% rename from arch/arm64/lib/crypto/chacha-neon-glue.c rename to lib/crypto/arm64/chacha-neon-glue.c diff --git a/arch/arm64/lib/crypto/poly1305-armv8.pl b/lib/crypto/arm64/poly1305-armv8.pl similarity index 100% rename from arch/arm64/lib/crypto/poly1305-armv8.pl rename to lib/crypto/arm64/poly1305-armv8.pl diff --git a/arch/arm64/lib/crypto/poly1305-glue.c b/lib/crypto/arm64/poly1305-glue.c similarity index 100% rename from arch/arm64/lib/crypto/poly1305-glue.c rename to lib/crypto/arm64/poly1305-glue.c diff --git a/arch/arm64/lib/crypto/sha2-armv8.pl b/lib/crypto/arm64/sha2-armv8.pl similarity index 100% rename from arch/arm64/lib/crypto/sha2-armv8.pl rename to lib/crypto/arm64/sha2-armv8.pl diff --git a/arch/arm64/lib/crypto/sha256-ce.S b/lib/crypto/arm64/sha256-ce.S similarity index 100% rename from arch/arm64/lib/crypto/sha256-ce.S rename to lib/crypto/arm64/sha256-ce.S diff --git a/arch/arm64/lib/crypto/sha256.c b/lib/crypto/arm64/sha256.c similarity index 100% rename from arch/arm64/lib/crypto/sha256.c rename to lib/crypto/arm64/sha256.c From patchwork Tue Jun 17 22:27:20 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 897427 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 92158296163; Tue, 17 Jun 2025 22:29:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750199399; cv=none; b=erFKGhJNM0cTZeE2Iim40NBtGZbKRx/TblsvQcQ5X/ZuKIhZ9BEZGxbdmfNU1L0BNB1boyE5W0kjIClMjon5LWAtrljpPizzZthRVMw+M+ZqLjvt3UUiItutfuEhG/7mM9yDJzhgi9jhZ4J07b5kPKZ5rWAGHc9PfOZM4CvKbgU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750199399; c=relaxed/simple; bh=oCGOvLpHCL5W2ZkDZ9iwmUr1h9xflh/WVFokVkwiIvM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dfDlB7W2G7owvZL7kVnc+BvghGXnh49r9fQjTXqGDlztG1rmzatPZAm+S6XyI5e/EOKDfcLB1sgcoivydT+uEYdOHMBlMYZwuSpZjd4nYePQ1AZHyb864ICfB7i/ZlYnopSEPVkoGreYLq4ce3KMdzVRu8KgqcyWfUEUyk13atA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=n1fuKE+T; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="n1fuKE+T" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9FA9C4CEF4; Tue, 17 Jun 2025 22:29:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1750199399; bh=oCGOvLpHCL5W2ZkDZ9iwmUr1h9xflh/WVFokVkwiIvM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n1fuKE+TjvzwwIHuJptm/lhdma0jKIIADvDgWHzfPYyYFio+dkbFs7FIv9V1NUhzw eiB4FeGixs00EnV5P6vBG1ZeOH76sq/OJstlcRiC81xjcSu+QyeTS5HtsNpTbhD1at mEyLi4ZMek6U6bMjEcoNG+lkO/t5FqtznVB9HbCzmIXMT6+FqNqbsGpLx14LdkqHT4 tw2DrPFc29LKD0L1H/UcE6TL5RIwAPuUyPQ+Z0E1MDEOM2gslkZUQbmNiPu8rm3LtW ykrREDXGIrMAvbjOjlF+Zbi2cIkZ1KBG6TsLvUm8eQdW6gYkspQHMrsewp9fC8QV0r hSkxiDSJr1Flg== From: Eric Biggers To: linux-crypto@vger.kernel.org Cc: linux-kernel@vger.kernel.org, "Jason A . Donenfeld " , Ard Biesheuvel , linux-arm-kernel@lists.infradead.org, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, sparclinux@vger.kernel.org, x86@kernel.org Subject: [PATCH 3/9] lib/crypto/mips: move arch/mips/lib/crypto/ to lib/crypto/mips/ Date: Tue, 17 Jun 2025 15:27:20 -0700 Message-ID: <20250617222726.365148-4-ebiggers@kernel.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250617222726.365148-1-ebiggers@kernel.org> References: <20250617222726.365148-1-ebiggers@kernel.org> Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Eric Biggers 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/20250607200454.73587-1-ebiggers@kernel.org/. Also see the patchset which did this for SHA-512: https://lore.kernel.org/linux-crypto/20250616014019.415791-1-ebiggers@kernel.org/ 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/mips/lib/crypto/.gitignore is intentionally kept for now. See https://lore.kernel.org/r/CAHk-=whu2fb22rEy6+oKx1-+NCHuWucZepvD0H2MD38DrJVKtg@mail.gmail.com/ I'll remove it later after some time has passed. Signed-off-by: Eric Biggers --- arch/mips/lib/Makefile | 2 -- lib/crypto/Kconfig | 2 +- lib/crypto/Makefile | 1 + lib/crypto/mips/.gitignore | 2 ++ {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 10 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 lib/crypto/mips/.gitignore 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%) diff --git a/arch/mips/lib/Makefile b/arch/mips/lib/Makefile index 9d75845ef78e1..9c024e6d5e54c 100644 --- a/arch/mips/lib/Makefile +++ b/arch/mips/lib/Makefile @@ -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 diff --git a/lib/crypto/Kconfig b/lib/crypto/Kconfig index fdeb91bf00328..43c44316fbbdc 100644 --- a/lib/crypto/Kconfig +++ b/lib/crypto/Kconfig @@ -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 diff --git a/lib/crypto/Makefile b/lib/crypto/Makefile index 63ab907e8f53b..74331243b8c44 100644 --- a/lib/crypto/Makefile +++ b/lib/crypto/Makefile @@ -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/ diff --git a/lib/crypto/mips/.gitignore b/lib/crypto/mips/.gitignore new file mode 100644 index 0000000000000..0d47d4f21c6de --- /dev/null +++ b/lib/crypto/mips/.gitignore @@ -0,0 +1,2 @@ +# SPDX-License-Identifier: GPL-2.0-only +poly1305-core.S diff --git a/arch/mips/lib/crypto/Kconfig b/lib/crypto/mips/Kconfig similarity index 100% rename from arch/mips/lib/crypto/Kconfig rename to lib/crypto/mips/Kconfig diff --git a/arch/mips/lib/crypto/Makefile b/lib/crypto/mips/Makefile similarity index 100% rename from arch/mips/lib/crypto/Makefile rename to lib/crypto/mips/Makefile diff --git a/arch/mips/lib/crypto/chacha-core.S b/lib/crypto/mips/chacha-core.S similarity index 100% rename from arch/mips/lib/crypto/chacha-core.S rename to lib/crypto/mips/chacha-core.S diff --git a/arch/mips/lib/crypto/chacha-glue.c b/lib/crypto/mips/chacha-glue.c similarity index 100% rename from arch/mips/lib/crypto/chacha-glue.c rename to lib/crypto/mips/chacha-glue.c diff --git a/arch/mips/lib/crypto/poly1305-glue.c b/lib/crypto/mips/poly1305-glue.c similarity index 100% rename from arch/mips/lib/crypto/poly1305-glue.c rename to lib/crypto/mips/poly1305-glue.c diff --git a/arch/mips/lib/crypto/poly1305-mips.pl b/lib/crypto/mips/poly1305-mips.pl similarity index 100% rename from arch/mips/lib/crypto/poly1305-mips.pl rename to lib/crypto/mips/poly1305-mips.pl From patchwork Tue Jun 17 22:27:21 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 897663 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EA689298261; Tue, 17 Jun 2025 22:29:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750199400; cv=none; b=lKzjVg66o1vsYN6yiveyLx3GCau+VWuXuCh3iRV+occditjuYZAR1ytgPxV/RtFYaXVU2sCrGBNIyoQyYxmtldUI0OMbQ9NTom6eTFq+Vjy1GKXgTCtUEWUxv1Cq0jiUhRXgHFE1uKgUg6PcIFTjeoLI7zBJOFb+qFl+9P01c5I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750199400; c=relaxed/simple; bh=Rnk2PwpW8Gu3iv/lRjgrxSUfjbCe7cqo5Kg5mCp+tec=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=U6t7U/pg1fUq4Oe9ZdqJQQeeizC7z/mqdNmcWin7KT04ZgbOV0wG10jgXu0GibXXgSaagj7iQsIjdiZADuV3LRBx0BIi65OYsD7SycaIPlxMH8mKu4XLFvUT5yZjQcrZhl0+0oiGcfCtnAJBTKLHR5TkU9Y/sCf/tBDfubm+NHs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=n/EdaD8Z; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="n/EdaD8Z" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 57EE0C4CEE3; Tue, 17 Jun 2025 22:29:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1750199399; bh=Rnk2PwpW8Gu3iv/lRjgrxSUfjbCe7cqo5Kg5mCp+tec=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n/EdaD8Zyxy5dyg5bAmDEr6kkTLTwsspZ77aZlKeN6R2pbgomC606am8X+Ea7qgoq wfCxnVevVxbeN47HYmiSa7TebnsmsjlRcgR9BvQMMkeerD8+0V9escUwehU91SldVr Lca/VLgV4DTAmEx+PRc5EtEdTRpWy4Eeiiv38uYr9TPoNt9G9ZFPOR+FGRD7JPY8qO 0uFe+DtlIYq3vTf8pcTNyyZ+8KVGBRAYoIYRU6bV8HU2zFEp5bcrWVDSqknZfyjJGn pcYAGbC7srBvU4mNdXrndtYTL5zhosqb2AaphueSD989/jFzD6EUiYP82nhKMKudWC /FNOfCxOanE6w== From: Eric Biggers To: linux-crypto@vger.kernel.org Cc: linux-kernel@vger.kernel.org, "Jason A . Donenfeld " , Ard Biesheuvel , linux-arm-kernel@lists.infradead.org, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, sparclinux@vger.kernel.org, x86@kernel.org Subject: [PATCH 4/9] lib/crypto/powerpc: move arch/powerpc/lib/crypto/ to lib/crypto/powerpc/ Date: Tue, 17 Jun 2025 15:27:21 -0700 Message-ID: <20250617222726.365148-5-ebiggers@kernel.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250617222726.365148-1-ebiggers@kernel.org> References: <20250617222726.365148-1-ebiggers@kernel.org> Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Eric Biggers 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/20250607200454.73587-1-ebiggers@kernel.org/. Also see the patchset which did this for SHA-512: https://lore.kernel.org/linux-crypto/20250616014019.415791-1-ebiggers@kernel.org/ 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. Signed-off-by: Eric Biggers --- 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%) diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile index 481f968e42c7b..27f8a01438603 100644 --- a/arch/powerpc/lib/Makefile +++ b/arch/powerpc/lib/Makefile @@ -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) diff --git a/lib/crypto/Kconfig b/lib/crypto/Kconfig index 43c44316fbbdc..f4f9a70dd0891 100644 --- a/lib/crypto/Kconfig +++ b/lib/crypto/Kconfig @@ -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 diff --git a/lib/crypto/Makefile b/lib/crypto/Makefile index 74331243b8c44..47c889b881b2a 100644 --- a/lib/crypto/Makefile +++ b/lib/crypto/Makefile @@ -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/ diff --git a/arch/powerpc/lib/crypto/Kconfig b/lib/crypto/powerpc/Kconfig similarity index 100% rename from arch/powerpc/lib/crypto/Kconfig rename to lib/crypto/powerpc/Kconfig diff --git a/arch/powerpc/lib/crypto/Makefile b/lib/crypto/powerpc/Makefile similarity index 100% rename from arch/powerpc/lib/crypto/Makefile rename to lib/crypto/powerpc/Makefile diff --git a/arch/powerpc/lib/crypto/chacha-p10-glue.c b/lib/crypto/powerpc/chacha-p10-glue.c similarity index 100% rename from arch/powerpc/lib/crypto/chacha-p10-glue.c rename to lib/crypto/powerpc/chacha-p10-glue.c diff --git a/arch/powerpc/lib/crypto/chacha-p10le-8x.S b/lib/crypto/powerpc/chacha-p10le-8x.S similarity index 100% rename from arch/powerpc/lib/crypto/chacha-p10le-8x.S rename to lib/crypto/powerpc/chacha-p10le-8x.S diff --git a/arch/powerpc/lib/crypto/poly1305-p10-glue.c b/lib/crypto/powerpc/poly1305-p10-glue.c similarity index 100% rename from arch/powerpc/lib/crypto/poly1305-p10-glue.c rename to lib/crypto/powerpc/poly1305-p10-glue.c diff --git a/arch/powerpc/lib/crypto/poly1305-p10le_64.S b/lib/crypto/powerpc/poly1305-p10le_64.S similarity index 100% rename from arch/powerpc/lib/crypto/poly1305-p10le_64.S rename to lib/crypto/powerpc/poly1305-p10le_64.S diff --git a/arch/powerpc/lib/crypto/sha256-spe-asm.S b/lib/crypto/powerpc/sha256-spe-asm.S similarity index 100% rename from arch/powerpc/lib/crypto/sha256-spe-asm.S rename to lib/crypto/powerpc/sha256-spe-asm.S diff --git a/arch/powerpc/lib/crypto/sha256.c b/lib/crypto/powerpc/sha256.c similarity index 100% rename from arch/powerpc/lib/crypto/sha256.c rename to lib/crypto/powerpc/sha256.c From patchwork Tue Jun 17 22:27:22 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 897426 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 908A629B221; Tue, 17 Jun 2025 22:30:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750199400; cv=none; b=Cp+zBP/tTNFVlceBc4Ox0ikBMdy5ttbhnImGriouTD794XFOzsyqHnCnsJt5+PA7dq4dPR1QvAxpgyNV3vbrVWBS2lvA3qNQtbh3xwW6/roZQkPLl7aYDyZhyBs2iTBGEh5vyh51F9o1qSZSMtr0DgeD2gMWsU9cOpDj0XkFBXg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750199400; c=relaxed/simple; bh=VbE9czpaU9jNxtjMDcOio0GOQz7YJt+xzskruq3kFzs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=D2Va0nJm9VgVPHdwhvizW7kyAOFaMCmtloYCAKMx57jO7Y9se6TsYC5Zk9OS7StwGy5Uxbr7VsV31DMyQskDZirwZGkC7kkjE7VGVJ6O58A8rJmAvTewyFaxPyZRY9DI73yWwjJkq9OiK72QP787XkMEJURoxaDnTJbjgtH+clc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PTaZtDOX; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="PTaZtDOX" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CA6A8C4CEF1; Tue, 17 Jun 2025 22:29:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1750199400; bh=VbE9czpaU9jNxtjMDcOio0GOQz7YJt+xzskruq3kFzs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PTaZtDOXV75LW7zhlMetRWriUCGRO9uBwPIiM9o0/jEGpdN+igUnmxQnEp4plB8z2 45lRWfeggFJliDHOVY2MKce3WTRRndV5f2cx8yM9CqnvMAaGpPnoCiBrWww0aTm1Vw mb/ykxw5+1+sj3X/ZWy1+swIdw1jIQK1T2UVoQzR0k5DDwYg9Um4xB5KgtupYEyyrY xGTrU+hBphtguYh6B2FokcvxM265qfbLomsSN+rM0M8skgWVKadi9zOf4tpHUhOr3H lnujVLmhVQ+4tf7rjpOMO0cB1eYfI9J3Y63Gi9APd8owp+0RFif64XVknd3zuXeD5x tr1mB08xo0mnw== From: Eric Biggers To: linux-crypto@vger.kernel.org Cc: linux-kernel@vger.kernel.org, "Jason A . Donenfeld " , Ard Biesheuvel , linux-arm-kernel@lists.infradead.org, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, sparclinux@vger.kernel.org, x86@kernel.org Subject: [PATCH 5/9] lib/crypto/riscv: move arch/riscv/lib/crypto/ to lib/crypto/riscv/ Date: Tue, 17 Jun 2025 15:27:22 -0700 Message-ID: <20250617222726.365148-6-ebiggers@kernel.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250617222726.365148-1-ebiggers@kernel.org> References: <20250617222726.365148-1-ebiggers@kernel.org> Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Eric Biggers 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/20250607200454.73587-1-ebiggers@kernel.org/. Also see the patchset which did this for SHA-512: https://lore.kernel.org/linux-crypto/20250616014019.415791-1-ebiggers@kernel.org/ 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. Signed-off-by: Eric Biggers --- 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%) diff --git a/arch/riscv/lib/Makefile b/arch/riscv/lib/Makefile index 0baec92d2f55b..b1c46153606a6 100644 --- a/arch/riscv/lib/Makefile +++ b/arch/riscv/lib/Makefile @@ -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),) diff --git a/lib/crypto/Kconfig b/lib/crypto/Kconfig index f4f9a70dd0891..a2b58ca2df0cc 100644 --- a/lib/crypto/Kconfig +++ b/lib/crypto/Kconfig @@ -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 diff --git a/lib/crypto/Makefile b/lib/crypto/Makefile index 47c889b881b2a..0fe9200a031d6 100644 --- a/lib/crypto/Makefile +++ b/lib/crypto/Makefile @@ -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/ diff --git a/arch/riscv/lib/crypto/Kconfig b/lib/crypto/riscv/Kconfig similarity index 100% rename from arch/riscv/lib/crypto/Kconfig rename to lib/crypto/riscv/Kconfig diff --git a/arch/riscv/lib/crypto/Makefile b/lib/crypto/riscv/Makefile similarity index 100% rename from arch/riscv/lib/crypto/Makefile rename to lib/crypto/riscv/Makefile diff --git a/arch/riscv/lib/crypto/chacha-riscv64-glue.c b/lib/crypto/riscv/chacha-riscv64-glue.c similarity index 100% rename from arch/riscv/lib/crypto/chacha-riscv64-glue.c rename to lib/crypto/riscv/chacha-riscv64-glue.c diff --git a/arch/riscv/lib/crypto/chacha-riscv64-zvkb.S b/lib/crypto/riscv/chacha-riscv64-zvkb.S similarity index 100% rename from arch/riscv/lib/crypto/chacha-riscv64-zvkb.S rename to lib/crypto/riscv/chacha-riscv64-zvkb.S diff --git a/arch/riscv/lib/crypto/sha256-riscv64-zvknha_or_zvknhb-zvkb.S b/lib/crypto/riscv/sha256-riscv64-zvknha_or_zvknhb-zvkb.S 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 diff --git a/arch/riscv/lib/crypto/sha256.c b/lib/crypto/riscv/sha256.c similarity index 100% rename from arch/riscv/lib/crypto/sha256.c rename to lib/crypto/riscv/sha256.c From patchwork Tue Jun 17 22:27:23 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 897662 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B958229B8F7; Tue, 17 Jun 2025 22:30:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750199400; cv=none; b=KTKjc4TbiwYOOtjG8nUl6/rKdhKY26EvPEdy/TjAL0P5ie0nJ58aRkKy7EqcU2wHOq5kKkR9CELNeulZPXCxn5VY0uC4yHHLgovFKom5qAh30nKe1Hh+DVR9fj6US/1S3S5S4wLgCgOathQ1i4IS42ToT2u7CBAOaWR/Z6OaPJU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750199400; c=relaxed/simple; bh=DB9DhLYVRPJOFC4JEDOQxgYzL630xncYTvwWN0gUiiM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=h7cCRltedOneO9HMe46CCZysste9B37wfQq9GWMRurKp2Gu7VnZWyaOiNveAWoWPByOqVgvL80WVcjfGxwedxmq+a1TRm8UU1wgAh6yM4AWy+Un3wsNCc57aMfReMnmoqNYHUhkp5IEwymPwCRVdxfJMVcyhzQObiLIjGlhV38g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=GIYerzvn; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="GIYerzvn" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 49D9CC4CEED; Tue, 17 Jun 2025 22:30:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1750199400; bh=DB9DhLYVRPJOFC4JEDOQxgYzL630xncYTvwWN0gUiiM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GIYerzvn7TkQv8UhdzsGR2rqziJPgfgOG4h6rMYjV8i2fmyJZx/y5nf8WTbs/GG8Y a0X7Aw26Sj1eUD4YljIGP3krHppMca79SDg/cuVSv/C24zdNrwXqys4sFBrqKx5Ll5 jQ7gPM5IBYyanhR7gaWs9tUP8/eVTid9ipCEr50gEhwbMbGfxY3/PAhYc7lhYYM8mW iOEzkysYJZNdPW+5uNlmUz5sgbCLC2R+oRoDR2XpiV9v0SJehI6MYubs3zbFM4hn7K 7bAbHLTtuG2cBs/Way1kxZ5fJh7a5QYUAqIYo6PU1t57pY0T0mmdVJ/DRgt5wf+s1Q YGJcjLKKLAAsQ== From: Eric Biggers To: linux-crypto@vger.kernel.org Cc: linux-kernel@vger.kernel.org, "Jason A . Donenfeld " , Ard Biesheuvel , linux-arm-kernel@lists.infradead.org, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, sparclinux@vger.kernel.org, x86@kernel.org Subject: [PATCH 6/9] lib/crypto/s390: move arch/s390/lib/crypto/ to lib/crypto/s390/ Date: Tue, 17 Jun 2025 15:27:23 -0700 Message-ID: <20250617222726.365148-7-ebiggers@kernel.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250617222726.365148-1-ebiggers@kernel.org> References: <20250617222726.365148-1-ebiggers@kernel.org> Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Eric Biggers 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/20250607200454.73587-1-ebiggers@kernel.org/. Also see the patchset which did this for SHA-512: https://lore.kernel.org/linux-crypto/20250616014019.415791-1-ebiggers@kernel.org/ 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. Signed-off-by: Eric Biggers --- 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%) diff --git a/arch/s390/lib/Makefile b/arch/s390/lib/Makefile index cd35cdbfa8713..271a1c407121c 100644 --- a/arch/s390/lib/Makefile +++ b/arch/s390/lib/Makefile @@ -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 diff --git a/lib/crypto/Kconfig b/lib/crypto/Kconfig index a2b58ca2df0cc..278b7ef5ec4f9 100644 --- a/lib/crypto/Kconfig +++ b/lib/crypto/Kconfig @@ -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 diff --git a/lib/crypto/Makefile b/lib/crypto/Makefile index 0fe9200a031d6..4cda1f5cd21d4 100644 --- a/lib/crypto/Makefile +++ b/lib/crypto/Makefile @@ -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/ diff --git a/arch/s390/lib/crypto/Kconfig b/lib/crypto/s390/Kconfig similarity index 100% rename from arch/s390/lib/crypto/Kconfig rename to lib/crypto/s390/Kconfig diff --git a/arch/s390/lib/crypto/Makefile b/lib/crypto/s390/Makefile similarity index 100% rename from arch/s390/lib/crypto/Makefile rename to lib/crypto/s390/Makefile diff --git a/arch/s390/lib/crypto/chacha-glue.c b/lib/crypto/s390/chacha-glue.c similarity index 100% rename from arch/s390/lib/crypto/chacha-glue.c rename to lib/crypto/s390/chacha-glue.c diff --git a/arch/s390/lib/crypto/chacha-s390.S b/lib/crypto/s390/chacha-s390.S similarity index 100% rename from arch/s390/lib/crypto/chacha-s390.S rename to lib/crypto/s390/chacha-s390.S diff --git a/arch/s390/lib/crypto/chacha-s390.h b/lib/crypto/s390/chacha-s390.h similarity index 100% rename from arch/s390/lib/crypto/chacha-s390.h rename to lib/crypto/s390/chacha-s390.h diff --git a/arch/s390/lib/crypto/sha256.c b/lib/crypto/s390/sha256.c similarity index 100% rename from arch/s390/lib/crypto/sha256.c rename to lib/crypto/s390/sha256.c From patchwork Tue Jun 17 22:27:24 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 897425 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 848BE2BDC28; Tue, 17 Jun 2025 22:30:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750199401; cv=none; b=BgCCOCkPbzR1L9D8Ecpx5aa93WQFwkTv+hpFyHcyRbB+/q5U/2j2CYSHllVFoXHJJV3OA2pCSOtB+3XM2kJc0awRk8U9IVLPZYZRfO9hU0HHG71kPgW2HW/pV4EuOiTswe8mA8IQSvwBwv25ItC8HZGvQAkOozcFXlmX390qPvo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750199401; c=relaxed/simple; bh=hkPIvoqxShZhMTTDhLVtDi8Yqmn39FL66nVo8qVRu1Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XNjtubKqPUZ3qCEMKpSvblnHExajfaCawLTN+k4lXIS7JJ7hJJQUPIMMJk/2PhERzXngzwaD3gUanLcais3siwoY7Hp8SdSrtvaV0JA83hlNzvlF6LcxwuO5/o0LNW7rrER3sWLZ2iHgJG9Qb09L2XqZAgrVCsS1GJhrHz2l78o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=CKc8qPKa; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="CKc8qPKa" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BC62AC4CEF6; Tue, 17 Jun 2025 22:30:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1750199401; bh=hkPIvoqxShZhMTTDhLVtDi8Yqmn39FL66nVo8qVRu1Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CKc8qPKacvgviafDJA8lSI2yrliEIiRaHqww9PSNVArp3EkmSThFIj0ix9/MqJPwg 3t0MqZLXdwckLnEcpIcbnuhL8zrVWrFYzDDuEke7tXOvMfDa3J7RRrKLmU+uetbjZ4 bG1iU16tXN1rrqNMaQxv+54OWdd/MEWLvXU9V0sacQR86Pehnf0mSBErESrSvBLLqb ntGC/IsNfd2afRrg89OWW2gQnIbUZFr5ADvscwB9ZsXqG8WMWm0JAyG4OPxWA5H3Q7 T9Uy/6lgMcgbVxTl3aSfMvp3Nmeamfxr1OxiYp1oJMF4LdCD3rAm7+Q0WUupeSaq0t O5Ni41xVr1NEw== From: Eric Biggers To: linux-crypto@vger.kernel.org Cc: linux-kernel@vger.kernel.org, "Jason A . Donenfeld " , Ard Biesheuvel , linux-arm-kernel@lists.infradead.org, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, sparclinux@vger.kernel.org, x86@kernel.org Subject: [PATCH 7/9] lib/crypto/sparc: move arch/sparc/lib/crypto/ to lib/crypto/sparc/ Date: Tue, 17 Jun 2025 15:27:24 -0700 Message-ID: <20250617222726.365148-8-ebiggers@kernel.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250617222726.365148-1-ebiggers@kernel.org> References: <20250617222726.365148-1-ebiggers@kernel.org> Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Eric Biggers 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/20250607200454.73587-1-ebiggers@kernel.org/. Also see the patchset which did this for SHA-512: https://lore.kernel.org/linux-crypto/20250616014019.415791-1-ebiggers@kernel.org/ 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. Signed-off-by: Eric Biggers --- 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%) diff --git a/arch/sparc/lib/Makefile b/arch/sparc/lib/Makefile index 5cf9781d68b40..ef8860eb3f3d1 100644 --- a/arch/sparc/lib/Makefile +++ b/arch/sparc/lib/Makefile @@ -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 diff --git a/lib/crypto/Kconfig b/lib/crypto/Kconfig index 278b7ef5ec4f9..b98543c7ef231 100644 --- a/lib/crypto/Kconfig +++ b/lib/crypto/Kconfig @@ -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 diff --git a/lib/crypto/Makefile b/lib/crypto/Makefile index 4cda1f5cd21d4..748d1fc6b6be2 100644 --- a/lib/crypto/Makefile +++ b/lib/crypto/Makefile @@ -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/ diff --git a/arch/sparc/lib/crypto/Kconfig b/lib/crypto/sparc/Kconfig similarity index 100% rename from arch/sparc/lib/crypto/Kconfig rename to lib/crypto/sparc/Kconfig diff --git a/arch/sparc/lib/crypto/Makefile b/lib/crypto/sparc/Makefile similarity index 100% rename from arch/sparc/lib/crypto/Makefile rename to lib/crypto/sparc/Makefile diff --git a/arch/sparc/lib/crypto/sha256.c b/lib/crypto/sparc/sha256.c similarity index 100% rename from arch/sparc/lib/crypto/sha256.c rename to lib/crypto/sparc/sha256.c diff --git a/arch/sparc/lib/crypto/sha256_asm.S b/lib/crypto/sparc/sha256_asm.S similarity index 100% rename from arch/sparc/lib/crypto/sha256_asm.S rename to lib/crypto/sparc/sha256_asm.S From patchwork Tue Jun 17 22:27:25 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 897661 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F3AE62C0327; Tue, 17 Jun 2025 22:30:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750199402; cv=none; b=FvnA9/mJ0ymYTTeRvk9uFHLQh3+0dITuGPpCgRctFP6jwlQ0qVwYU5Ms/1y+gnIspFp386u7E24Gn3yaxMbsHQ1lLGM3FdQSo61KDFiaZGxpIUyIiLjJ+twBC4JSf9VtqMT+xbSUz0FSVUHs2MsKG54LcvNoSPgOHG1qtY6DCh8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750199402; c=relaxed/simple; bh=8jdu9LHzVRz1BNvZSq3ZYEM4B1Z0nZLxiOO9k8V1IZ4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qj2nH6G7TAeiPsd9hwhh8XlIoGKfA5W/DNLAoRTCvt2yJJ+OwIbvMP3bnkIWgjbvO6T2blsEjbQBhYTgwlVyscuAA1HStB+uPeOdwO7X2ENrKdcIGWu2pLEpe9ucrpvNdnQj1jPiP9wQMCY4n7JlHNm0auMenuDzWTLn+dwvy50= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=rxMqdTMQ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="rxMqdTMQ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3C3B4C4AF0D; Tue, 17 Jun 2025 22:30:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1750199401; bh=8jdu9LHzVRz1BNvZSq3ZYEM4B1Z0nZLxiOO9k8V1IZ4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rxMqdTMQBGpK7NKz+2Cv8yBMwsWxMBeJd9bTUuyDkYX7YYU+jrxrDq8PPMf7vBwnn zHsuDv8GvDnH1VrOvFRDMxP2s0jrflOWxlc5FjbqcxIGJz81BNGH8vVOdp9FYbKNdq 4u38I0tsjDRhq4WCGyAY4HgmHpEwewKxTMFKHauMorBUtmLTbxHKTV90nIH6v1c3Az 26jdJsahBxuTEPhh5xCsx/sz5oa8BFGWnMGGIQfpoHPvDflcrEbxMjPMEZ2WgZMiqM K2gyO9xDZuBgzO9nBJN9rKXK+5amrA1VSGV0uijZxomlNdlv/cflza6afeghUr4ytV NUyzdpVJYvxCg== From: Eric Biggers To: linux-crypto@vger.kernel.org Cc: linux-kernel@vger.kernel.org, "Jason A . Donenfeld " , Ard Biesheuvel , linux-arm-kernel@lists.infradead.org, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, sparclinux@vger.kernel.org, x86@kernel.org Subject: [PATCH 8/9] lib/crypto/x86: move arch/x86/lib/crypto/ to lib/crypto/x86/ Date: Tue, 17 Jun 2025 15:27:25 -0700 Message-ID: <20250617222726.365148-9-ebiggers@kernel.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250617222726.365148-1-ebiggers@kernel.org> References: <20250617222726.365148-1-ebiggers@kernel.org> Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Eric Biggers 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/20250607200454.73587-1-ebiggers@kernel.org/. Also see the patchset which did this for SHA-512: https://lore.kernel.org/linux-crypto/20250616014019.415791-1-ebiggers@kernel.org/ 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/x86/lib/crypto/.gitignore is intentionally kept for now. See https://lore.kernel.org/r/CAHk-=whu2fb22rEy6+oKx1-+NCHuWucZepvD0H2MD38DrJVKtg@mail.gmail.com/ I'll remove it later after some time has passed. Signed-off-by: Eric Biggers --- arch/x86/lib/Makefile | 2 -- lib/crypto/Kconfig | 2 +- lib/crypto/Makefile | 1 + lib/crypto/x86/.gitignore | 2 ++ {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 .../x86/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 .../lib/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 19 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 lib/crypto/x86/.gitignore 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%) diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile index 4fa5c4e1ba8a0..7cf8681cba0f2 100644 --- a/arch/x86/lib/Makefile +++ b/arch/x86/lib/Makefile @@ -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 diff --git a/lib/crypto/Kconfig b/lib/crypto/Kconfig index b98543c7ef231..2460ddff967fc 100644 --- a/lib/crypto/Kconfig +++ b/lib/crypto/Kconfig @@ -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 diff --git a/lib/crypto/Makefile b/lib/crypto/Makefile index 748d1fc6b6be2..16f5d76d92710 100644 --- a/lib/crypto/Makefile +++ b/lib/crypto/Makefile @@ -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/ diff --git a/lib/crypto/x86/.gitignore b/lib/crypto/x86/.gitignore new file mode 100644 index 0000000000000..580c839bb1776 --- /dev/null +++ b/lib/crypto/x86/.gitignore @@ -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/lib/crypto/x86/Kconfig similarity index 100% rename from arch/x86/lib/crypto/Kconfig rename to lib/crypto/x86/Kconfig diff --git a/arch/x86/lib/crypto/Makefile b/lib/crypto/x86/Makefile similarity index 100% rename from arch/x86/lib/crypto/Makefile rename to lib/crypto/x86/Makefile diff --git a/arch/x86/lib/crypto/blake2s-core.S b/lib/crypto/x86/blake2s-core.S similarity index 100% rename from arch/x86/lib/crypto/blake2s-core.S rename to lib/crypto/x86/blake2s-core.S diff --git a/arch/x86/lib/crypto/blake2s-glue.c b/lib/crypto/x86/blake2s-glue.c similarity index 100% rename from arch/x86/lib/crypto/blake2s-glue.c rename to lib/crypto/x86/blake2s-glue.c diff --git a/arch/x86/lib/crypto/chacha-avx2-x86_64.S b/lib/crypto/x86/chacha-avx2-x86_64.S similarity index 100% rename from arch/x86/lib/crypto/chacha-avx2-x86_64.S rename to lib/crypto/x86/chacha-avx2-x86_64.S diff --git a/arch/x86/lib/crypto/chacha-avx512vl-x86_64.S b/lib/crypto/x86/chacha-avx512vl-x86_64.S similarity index 100% rename from arch/x86/lib/crypto/chacha-avx512vl-x86_64.S rename to lib/crypto/x86/chacha-avx512vl-x86_64.S diff --git a/arch/x86/lib/crypto/chacha-ssse3-x86_64.S b/lib/crypto/x86/chacha-ssse3-x86_64.S similarity index 100% rename from arch/x86/lib/crypto/chacha-ssse3-x86_64.S rename to lib/crypto/x86/chacha-ssse3-x86_64.S diff --git a/arch/x86/lib/crypto/chacha_glue.c b/lib/crypto/x86/chacha_glue.c similarity index 100% rename from arch/x86/lib/crypto/chacha_glue.c rename to lib/crypto/x86/chacha_glue.c diff --git a/arch/x86/lib/crypto/poly1305-x86_64-cryptogams.pl b/lib/crypto/x86/poly1305-x86_64-cryptogams.pl similarity index 100% rename from arch/x86/lib/crypto/poly1305-x86_64-cryptogams.pl rename to lib/crypto/x86/poly1305-x86_64-cryptogams.pl diff --git a/arch/x86/lib/crypto/poly1305_glue.c b/lib/crypto/x86/poly1305_glue.c similarity index 100% rename from arch/x86/lib/crypto/poly1305_glue.c rename to lib/crypto/x86/poly1305_glue.c diff --git a/arch/x86/lib/crypto/sha256-avx-asm.S b/lib/crypto/x86/sha256-avx-asm.S similarity index 100% rename from arch/x86/lib/crypto/sha256-avx-asm.S rename to lib/crypto/x86/sha256-avx-asm.S diff --git a/arch/x86/lib/crypto/sha256-avx2-asm.S b/lib/crypto/x86/sha256-avx2-asm.S similarity index 100% rename from arch/x86/lib/crypto/sha256-avx2-asm.S rename to lib/crypto/x86/sha256-avx2-asm.S diff --git a/arch/x86/lib/crypto/sha256-ni-asm.S b/lib/crypto/x86/sha256-ni-asm.S similarity index 100% rename from arch/x86/lib/crypto/sha256-ni-asm.S rename to lib/crypto/x86/sha256-ni-asm.S diff --git a/arch/x86/lib/crypto/sha256-ssse3-asm.S b/lib/crypto/x86/sha256-ssse3-asm.S similarity index 100% rename from arch/x86/lib/crypto/sha256-ssse3-asm.S rename to lib/crypto/x86/sha256-ssse3-asm.S diff --git a/arch/x86/lib/crypto/sha256.c b/lib/crypto/x86/sha256.c similarity index 100% rename from arch/x86/lib/crypto/sha256.c rename to lib/crypto/x86/sha256.c From patchwork Tue Jun 17 22:27:26 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 897424 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2932C2E54A0; Tue, 17 Jun 2025 22:30:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750199402; cv=none; b=ng3x6muhAeYYTVLWS3z8Ud13KJAuYskhM1VPzNrVXlc+7ZmStpiYDjQ8E7P/JlBI1deEq0xZIDEfksi0WN9kV4jTqhndKMThQzHcglN4ZVmcHqLYJZ5gTekV7Fd7PXxt/PIpDInyUzfr1XlcAJJbljOoVwIM24DY0lvC+Q1C/wI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750199402; c=relaxed/simple; bh=oGJq6YZzLbO82TcEMZLZBS9E98OIIOd5KDDOCIIYowQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jPMIFCZiIVVcsYln0yh0IW0fz5qKqGQFwS1wsXKbyhwBA84xF7XBSpglF0g7ePz9xDfG2FbB9Ax6+Lie9N3Z64bVeIVadKVe2iX0kAeq9fzCaKMqOiPm9JXITaEnvmQMcESjyA44bzCRT0PFAoVuNrIZyG9QRPzfmWmAKdjTuVk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=SovLzznF; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="SovLzznF" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF370C4CEF8; Tue, 17 Jun 2025 22:30:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1750199402; bh=oGJq6YZzLbO82TcEMZLZBS9E98OIIOd5KDDOCIIYowQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SovLzznFPfIAEgcoGd3wa7ftl9jecC4+XnxcYbmljKPn6KsHB6owxneOsiWiHlnab muiKIw9awT6KzPqUeNlzqPMNRQ6FYy7/UhXGHPM/wLDCfc1FPzhQZtrSQX6W5VQKa4 50B2rUTWfZHWORPDSaKSt4nf8HFzuFx1dUcky6sSdjuVTg5jP3l3Ie8z4zoxN0BeIB 5vJahEvic3FD72FGGK9qwYIGiNTNyNAnjg9FNwA98XjMM+3bCyH7NImzGI7tl4fW1C By1EilFtNRcoK8uUYNAou3W+ESJ441BuamWF8ppNnSTp3K+Rnnx3FCX2Vt8euhkRiM JB91sT3DxJ9UQ== From: Eric Biggers To: linux-crypto@vger.kernel.org Cc: linux-kernel@vger.kernel.org, "Jason A . Donenfeld " , Ard Biesheuvel , linux-arm-kernel@lists.infradead.org, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, sparclinux@vger.kernel.org, x86@kernel.org Subject: [PATCH 9/9] MAINTAINERS: drop arch/*/lib/crypto/ pattern Date: Tue, 17 Jun 2025 15:27:26 -0700 Message-ID: <20250617222726.365148-10-ebiggers@kernel.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250617222726.365148-1-ebiggers@kernel.org> References: <20250617222726.365148-1-ebiggers@kernel.org> Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Eric Biggers arch/*/lib/crypto/ will no longer be used, and its contents have been moved to lib/crypto/. (Well, except for a few .gitignore files which are intentionally being kept for a while.) Therefore, remove the arch/*/lib/crypto/ pattern from MAINTAINERS. Signed-off-by: Eric Biggers --- MAINTAINERS | 1 - 1 file changed, 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index a92290fffa163..8ca374b24a806 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -6408,11 +6408,10 @@ M: Jason A. Donenfeld M: Ard Biesheuvel L: linux-crypto@vger.kernel.org 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 L: linux-crypto@vger.kernel.org