[PATCH 05/15] crypto: mips - remove CRYPTO dependency of library functions

Eric Biggers
2025-04-17T19:43:50Z

Continue disentangling the crypto library functions from the generic
crypto infrastructure by removing the unnecessary CRYPTO dependency of
CRYPTO_CHACHA_MIPS and CRYPTO_POLY1305_MIPS. To do this, make
arch/mips/crypto/Kconfig be sourced regardless of CRYPTO, and explicitly
list the CRYPTO dependency in the symbols that do need it.

Signed-off-by: Eric Biggers <ebiggers@google.com>
---
arch/mips/Kconfig | 2 ++
arch/mips/crypto/Kconfig | 8 ++++----
crypto/Kconfig | 3 ---
3 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index fc0772c1bad4..9e0cf394a46b 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -3136,8 +3136,10 @@ endif # CPU_SUPPORTS_CPUFREQ && MIPS_EXTERNAL_TIMER

source "drivers/cpuidle/Kconfig"

endmenu

+source "arch/mips/crypto/Kconfig"
+
source "arch/mips/kvm/Kconfig"

source "arch/mips/vdso/Kconfig"
diff --git a/arch/mips/crypto/Kconfig b/arch/mips/crypto/Kconfig
index 8283664a1f24..beb7b20cf3e8 100644
--- a/arch/mips/crypto/Kconfig
+++ b/arch/mips/crypto/Kconfig
@@ -7,41 +7,41 @@ config CRYPTO_POLY1305_MIPS
select CRYPTO_ARCH_HAVE_LIB_POLY1305
default CRYPTO_LIB_POLY1305_INTERNAL

config CRYPTO_MD5_OCTEON
tristate "Digests: MD5 (OCTEON)"
- depends on CPU_CAVIUM_OCTEON
+ depends on CRYPTO && CPU_CAVIUM_OCTEON
select CRYPTO_MD5
select CRYPTO_HASH
help
MD5 message digest algorithm (RFC1321)

Architecture: mips OCTEON using crypto instructions, when available

config CRYPTO_SHA1_OCTEON
tristate "Hash functions: SHA-1 (OCTEON)"
- depends on CPU_CAVIUM_OCTEON
+ depends on CRYPTO && CPU_CAVIUM_OCTEON
select CRYPTO_SHA1
select CRYPTO_HASH
help
SHA-1 secure hash algorithm (FIPS 180)

Architecture: mips OCTEON

config CRYPTO_SHA256_OCTEON
tristate "Hash functions: SHA-224 and SHA-256 (OCTEON)"
- depends on CPU_CAVIUM_OCTEON
+ depends on CRYPTO && CPU_CAVIUM_OCTEON
select CRYPTO_SHA256
select CRYPTO_HASH
help
SHA-224 and SHA-256 secure hash algorithms (FIPS 180)

Architecture: mips OCTEON using crypto instructions, when available

config CRYPTO_SHA512_OCTEON
tristate "Hash functions: SHA-384 and SHA-512 (OCTEON)"
- depends on CPU_CAVIUM_OCTEON
+ depends on CRYPTO && CPU_CAVIUM_OCTEON
select CRYPTO_SHA512
select CRYPTO_HASH
help
SHA-384 and SHA-512 secure hash algorithms (FIPS 180)

diff --git a/crypto/Kconfig b/crypto/Kconfig
index de71e9c9f2ad..cfa426bea0c6 100644
--- a/crypto/Kconfig
+++ b/crypto/Kconfig
@@ -1424,13 +1424,10 @@ endmenu

config CRYPTO_HASH_INFO
bool

if !KMSAN # avoid false positives from assembly
-if MIPS
-source "arch/mips/crypto/Kconfig"
-endif
if PPC
source "arch/powerpc/crypto/Kconfig"
endif
if RISCV
source "arch/riscv/crypto/Kconfig"