linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: fsverity@lists.linux.dev
Cc: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-ext4@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net,
	linux-btrfs@vger.kernel.org, Ard Biesheuvel <ardb@kernel.org>,
	"Jason A . Donenfeld" <Jason@zx2c4.com>,
	Theodore Ts'o <tytso@mit.edu>, Eric Biggers <ebiggers@kernel.org>
Subject: [PATCH 1/2] lib/crypto: hash_info: Move hash_info.c into lib/crypto/
Date: Mon, 30 Jun 2025 10:22:23 -0700	[thread overview]
Message-ID: <20250630172224.46909-2-ebiggers@kernel.org> (raw)
In-Reply-To: <20250630172224.46909-1-ebiggers@kernel.org>

crypto/hash_info.c just contains a couple of arrays that map HASH_ALGO_*
algorithm IDs to properties of those algorithms.  It is compiled only
when CRYPTO_HASH_INFO=y, but currently CRYPTO_HASH_INFO depends on
CRYPTO.  Since this can be useful without the old-school crypto API,
move it into lib/crypto/ so that it no longer depends on CRYPTO.

This eliminates the need for FS_VERITY to select CRYPTO after it's been
converted to use lib/crypto/.

Signed-off-by: Eric Biggers <ebiggers@kernel.org>
---
 crypto/Kconfig                     | 3 ---
 crypto/Makefile                    | 1 -
 lib/crypto/Kconfig                 | 3 +++
 lib/crypto/Makefile                | 2 ++
 {crypto => lib/crypto}/hash_info.c | 0
 5 files changed, 5 insertions(+), 4 deletions(-)
 rename {crypto => lib/crypto}/hash_info.c (100%)

diff --git a/crypto/Kconfig b/crypto/Kconfig
index 3ea1397214e02..5d4cf022c5775 100644
--- a/crypto/Kconfig
+++ b/crypto/Kconfig
@@ -1420,13 +1420,10 @@ config CRYPTO_USER_API_ENABLE_OBSOLETE
 	  already been phased out from internal use by the kernel, and are
 	  only useful for userspace clients that still rely on them.
 
 endmenu
 
-config CRYPTO_HASH_INFO
-	bool
-
 if !KMSAN # avoid false positives from assembly
 if ARM
 source "arch/arm/crypto/Kconfig"
 endif
 if ARM64
diff --git a/crypto/Makefile b/crypto/Makefile
index 5098fa6d5f39c..816607e0e78ce 100644
--- a/crypto/Makefile
+++ b/crypto/Makefile
@@ -202,11 +202,10 @@ obj-$(CONFIG_CRYPTO_ECRDSA) += ecrdsa_generic.o
 # generic algorithms and the async_tx api
 #
 obj-$(CONFIG_XOR_BLOCKS) += xor.o
 obj-$(CONFIG_ASYNC_CORE) += async_tx/
 obj-$(CONFIG_ASYMMETRIC_KEY_TYPE) += asymmetric_keys/
-obj-$(CONFIG_CRYPTO_HASH_INFO) += hash_info.o
 crypto_simd-y := simd.o
 obj-$(CONFIG_CRYPTO_SIMD) += crypto_simd.o
 
 #
 # Key derivation function
diff --git a/lib/crypto/Kconfig b/lib/crypto/Kconfig
index 3305c69085816..cce53ae15cd58 100644
--- a/lib/crypto/Kconfig
+++ b/lib/crypto/Kconfig
@@ -3,10 +3,13 @@
 menu "Crypto library routines"
 
 config CRYPTO_LIB_UTILS
 	tristate
 
+config CRYPTO_HASH_INFO
+	bool
+
 config CRYPTO_LIB_AES
 	tristate
 
 config CRYPTO_LIB_AESCFB
 	tristate
diff --git a/lib/crypto/Makefile b/lib/crypto/Makefile
index a887bf103bf05..533bb1533e19b 100644
--- a/lib/crypto/Makefile
+++ b/lib/crypto/Makefile
@@ -6,10 +6,12 @@ quiet_cmd_perlasm = PERLASM $@
       cmd_perlasm = $(PERL) $(<) > $(@)
 
 quiet_cmd_perlasm_with_args = PERLASM $@
       cmd_perlasm_with_args = $(PERL) $(<) void $(@)
 
+obj-$(CONFIG_CRYPTO_HASH_INFO)			+= hash_info.o
+
 obj-$(CONFIG_CRYPTO_LIB_UTILS)			+= libcryptoutils.o
 libcryptoutils-y				:= memneq.o utils.o
 
 # chacha is used by the /dev/random driver which is always builtin
 obj-y						+= chacha.o
diff --git a/crypto/hash_info.c b/lib/crypto/hash_info.c
similarity index 100%
rename from crypto/hash_info.c
rename to lib/crypto/hash_info.c
-- 
2.50.0


  reply	other threads:[~2025-06-30 17:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-30 17:22 [PATCH 0/2] Convert fs/verity/ to use SHA-2 library API Eric Biggers
2025-06-30 17:22 ` Eric Biggers [this message]
2025-06-30 17:22 ` [PATCH 2/2] fsverity: Switch from crypto_shash to SHA-2 library Eric Biggers
2025-07-04 13:25 ` [PATCH 0/2] Convert fs/verity/ to use SHA-2 library API Ard Biesheuvel
2025-07-09 19:26 ` Eric Biggers
2025-07-09 20:29   ` Eric Biggers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250630172224.46909-2-ebiggers@kernel.org \
    --to=ebiggers@kernel.org \
    --cc=Jason@zx2c4.com \
    --cc=ardb@kernel.org \
    --cc=fsverity@lists.linux.dev \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).