[PATCH 10/15] crypto: s390 - remove CRYPTO dependency of library functions

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

Continue disentangling the crypto library functions from the generic
crypto infrastructure by removing the unnecessary CRYPTO dependency of
CRYPTO_CHACHA_S390. To do this, make arch/s390/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/s390/Kconfig | 4 ++++
arch/s390/crypto/Kconfig | 9 +++++++++
crypto/Kconfig | 3 ---
3 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index db8161ebb43c..2f32d51e8a73 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -679,10 +679,14 @@ config KERNEL_IMAGE_BASE

If the value of this option leads to the kernel image overlapping
the virtual memory where other data structures are located, this
option is ignored and the image is loaded above the structures.

+if !KMSAN # avoid false positives from assembly
+source "arch/s390/crypto/Kconfig"
+endif
+
endmenu

menu "Memory setup"

config ARCH_SPARSEMEM_ENABLE
diff --git a/arch/s390/crypto/Kconfig b/arch/s390/crypto/Kconfig
index e88d9cd256ef..a2e6efd8aed8 100644
--- a/arch/s390/crypto/Kconfig
+++ b/arch/s390/crypto/Kconfig
@@ -2,70 +2,77 @@

menu "Accelerated Cryptographic Algorithms for CPU (s390)"

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

Architecture: s390

It is available as of z10.

config CRYPTO_SHA1_S390
tristate "Hash functions: SHA-1"
+ depends on CRYPTO
select CRYPTO_HASH
help
SHA-1 secure hash algorithm (FIPS 180)

Architecture: s390

It is available as of z990.

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

Architecture: s390

It is available as of z9.

config CRYPTO_SHA3_256_S390
tristate "Hash functions: SHA3-224 and SHA3-256"
+ depends on CRYPTO
select CRYPTO_HASH
help
SHA3-224 and SHA3-256 secure hash algorithms (FIPS 202)

Architecture: s390

It is available as of z14.

config CRYPTO_SHA3_512_S390
tristate "Hash functions: SHA3-384 and SHA3-512"
+ depends on CRYPTO
select CRYPTO_HASH
help
SHA3-384 and SHA3-512 secure hash algorithms (FIPS 202)

Architecture: s390

It is available as of z14.

config CRYPTO_GHASH_S390
tristate "Hash functions: GHASH"
+ depends on CRYPTO
select CRYPTO_HASH
help
GCM GHASH hash function (NIST SP800-38D)

Architecture: s390

It is available as of z196.

config CRYPTO_AES_S390
tristate "Ciphers: AES, modes: ECB, CBC, CTR, XTS, GCM"
+ depends on CRYPTO
select CRYPTO_ALGAPI
select CRYPTO_SKCIPHER
help
Block cipher: AES cipher algorithms (FIPS 197)
AEAD cipher: AES with GCM
@@ -83,10 +90,11 @@ config CRYPTO_AES_S390
key sizes and XTS mode is hardware accelerated for 256 and
512 bit keys.

config CRYPTO_DES_S390
tristate "Ciphers: DES and Triple DES EDE, modes: ECB, CBC, CTR"
+ depends on CRYPTO
select CRYPTO_ALGAPI
select CRYPTO_SKCIPHER
select CRYPTO_LIB_DES
help
Block ciphers: DES (FIPS 46-2) cipher algorithm
@@ -105,10 +113,11 @@ config CRYPTO_CHACHA_S390
select CRYPTO_ARCH_HAVE_LIB_CHACHA
default CRYPTO_LIB_CHACHA_INTERNAL

config CRYPTO_HMAC_S390
tristate "Keyed-hash message authentication code: HMAC"
+ depends on CRYPTO
select CRYPTO_HASH
help
s390 specific HMAC hardware support for SHA224, SHA256, SHA384 and
SHA512.

diff --git a/crypto/Kconfig b/crypto/Kconfig
index 8c334c9f2081..78e83ce576ed 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 S390
-source "arch/s390/crypto/Kconfig"
-endif
if SPARC
source "arch/sparc/crypto/Kconfig"
endif
if X86
source "arch/x86/crypto/Kconfig"