Skip to contentSkip to conversation

Finish disentangling ChaCha, Poly1305, and BLAKE2s from CRYPTO

PATCH Superseded Eric Biggers 4 participants 28 messages Apr 17, 2025 – Apr 19, 2025

Subsystems (14)
Arm (32-bit) x86 PowerPC MIPS +10 more subsystems

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Eric Biggers

author maintainer
#0 lore raw

cover Finish disentangling ChaCha, Poly1305, and BLAKE2s from CRYPTO

This series removes the unnecessary dependency of the ChaCha, Poly1305, and BLAKE2s library functions on the generic crypto infrastructure, i.e. CONFIG_CRYPTO. To do this, it moves arch/*/crypto/Kconfig from a submenu of crypto/Kconfig to a submenu of arch/*/Kconfig, then re-adds the CRYPTO dependency to the symbols that actually need it.

Patches 14-15 then simplify the ChaCha and Poly1305 symbols by removing the unneeded "internal" symbols.

Note that Curve25519 is still entangled. Later patches will fix that.

Eric Biggers (15):
crypto: arm - remove CRYPTO dependency of library functions
crypto: arm64 - drop redundant dependencies on ARM64
crypto: arm64 - remove CRYPTO dependency of library functions
crypto: loongarch - source arch/loongarch/crypto/Kconfig without
CRYPTO
crypto: mips - remove CRYPTO dependency of library functions
crypto: powerpc - drop redundant dependencies on PPC
crypto: powerpc - remove CRYPTO dependency of library functions
crypto: riscv - remove CRYPTO dependency of library functions
crypto: s390 - drop redundant dependencies on S390
crypto: s390 - remove CRYPTO dependency of library functions
crypto: sparc - source arch/sparc/crypto/Kconfig without CRYPTO
crypto: x86 - drop redundant dependencies on X86
crypto: x86 - remove CRYPTO dependency of library functions
crypto: lib/chacha - remove INTERNAL symbol and selection of CRYPTO
crypto: lib/poly1305 - remove INTERNAL symbol and selection of CRYPTO

 arch/arm/Kconfig            |  2 ++
 arch/arm/crypto/Kconfig     | 28 ++++++++-------
 arch/arm64/Kconfig          |  3 +-
 arch/arm64/crypto/Kconfig   | 45 ++++++++++++-----------
 arch/loongarch/Kconfig      |  1 +
 arch/mips/Kconfig           |  2 ++
 arch/mips/crypto/Kconfig    | 12 +++----
 arch/powerpc/Kconfig        |  2 ++
 arch/powerpc/crypto/Kconfig | 22 ++++++------
 arch/riscv/Kconfig          |  2 ++
 arch/riscv/crypto/Kconfig   | 14 ++++----
 arch/s390/Kconfig           |  4 +++
 arch/s390/crypto/Kconfig    | 21 ++++++-----
 arch/sparc/Kconfig          |  2 ++
 arch/sparc/crypto/Kconfig   | 14 ++++----
 arch/x86/Kconfig            |  4 +++
 arch/x86/crypto/Kconfig     | 72 ++++++++++++++++++-------------------
 crypto/Kconfig              | 34 ++----------------
 lib/crypto/Kconfig          | 32 ++++++-----------
 19 files changed, 149 insertions(+), 167 deletions(-)

base-commit: da4cb617bc7d827946cbb368034940b379a1de90

Signature · 1 line
2.49.0
author maintainer
#1 lore raw

PATCH 1/15 crypto: arm - remove CRYPTO dependency of library functions

From: Eric Biggers <[email protected]>

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

---
 arch/arm/Kconfig        |  2 ++
 arch/arm/crypto/Kconfig | 24 +++++++++++++-----------
 crypto/Kconfig          |  3 ---
 3 files changed, 15 insertions(+), 14 deletions(-)
arch/arm/Kconfig +2 -0
index 25ed6f1a7c7a..86fcce738887 100644
@@ -1753,5 +1753,7 @@ config ARCH_HIBERNATION_POSSIBLE
 	bool
 	depends on MMU
 	default y if ARCH_SUSPEND_POSSIBLE
 
 endmenu
+
+source "arch/arm/crypto/Kconfig"
arch/arm/crypto/Kconfig +13 -11
index 3530e7c80793..a03017a6dbc4 100644
@@ -2,11 +2,11 @@
 
 menu "Accelerated Cryptographic Algorithms for CPU (arm)"
 
 config CRYPTO_CURVE25519_NEON
 	tristate
-	depends on KERNEL_MODE_NEON
+	depends on CRYPTO && KERNEL_MODE_NEON
 	select CRYPTO_KPP
 	select CRYPTO_LIB_CURVE25519_GENERIC
 	select CRYPTO_ARCH_HAVE_LIB_CURVE25519
 	default CRYPTO_LIB_CURVE25519_INTERNAL
 	help
@@ -15,11 +15,11 @@ config CRYPTO_CURVE25519_NEON
 	  Architecture: arm with
 	  - NEON (Advanced SIMD) extensions
 
 config CRYPTO_GHASH_ARM_CE
 	tristate "Hash functions: GHASH (PMULL/NEON/ARMv8 Crypto Extensions)"
-	depends on KERNEL_MODE_NEON
+	depends on CRYPTO && KERNEL_MODE_NEON
 	select CRYPTO_AEAD
 	select CRYPTO_HASH
 	select CRYPTO_CRYPTD
 	select CRYPTO_LIB_AES
 	select CRYPTO_LIB_GF128MUL
@@ -36,11 +36,11 @@ config CRYPTO_GHASH_ARM_CE
 	  that is part of the ARMv8 Crypto Extensions, or a slower variant that
 	  uses the vmull.p8 instruction that is part of the basic NEON ISA.
 
 config CRYPTO_NHPOLY1305_NEON
 	tristate "Hash functions: NHPoly1305 (NEON)"
-	depends on KERNEL_MODE_NEON
+	depends on CRYPTO && KERNEL_MODE_NEON
 	select CRYPTO_NHPOLY1305
 	help
 	  NHPoly1305 hash function (Adiantum)
 
 	  Architecture: arm using:
@@ -64,11 +64,11 @@ config CRYPTO_BLAKE2S_ARM
 	  There is no NEON implementation of BLAKE2s, since NEON doesn't
 	  really help with it.
 
 config CRYPTO_BLAKE2B_NEON
 	tristate "Hash functions: BLAKE2b (NEON)"
-	depends on KERNEL_MODE_NEON
+	depends on CRYPTO && KERNEL_MODE_NEON
 	select CRYPTO_BLAKE2B
 	help
 	  BLAKE2b cryptographic hash function (RFC 7693)
 
 	  Architecture: arm using
@@ -80,20 +80,21 @@ config CRYPTO_BLAKE2B_NEON
 	  much faster than the SHA-2 family and slightly faster than
 	  SHA-1.
 
 config CRYPTO_SHA1_ARM
 	tristate "Hash functions: SHA-1"
+	depends on CRYPTO
 	select CRYPTO_SHA1
 	select CRYPTO_HASH
 	help
 	  SHA-1 secure hash algorithm (FIPS 180)
 
 	  Architecture: arm
 
 config CRYPTO_SHA1_ARM_NEON
 	tristate "Hash functions: SHA-1 (NEON)"
-	depends on KERNEL_MODE_NEON
+	depends on CRYPTO && KERNEL_MODE_NEON
 	select CRYPTO_SHA1_ARM
 	select CRYPTO_SHA1
 	select CRYPTO_HASH
 	help
 	  SHA-1 secure hash algorithm (FIPS 180)
@@ -101,51 +102,52 @@ config CRYPTO_SHA1_ARM_NEON
 	  Architecture: arm using
 	  - NEON (Advanced SIMD) extensions
 
 config CRYPTO_SHA1_ARM_CE
 	tristate "Hash functions: SHA-1 (ARMv8 Crypto Extensions)"
-	depends on KERNEL_MODE_NEON
+	depends on CRYPTO && KERNEL_MODE_NEON
 	select CRYPTO_SHA1_ARM
 	select CRYPTO_HASH
 	help
 	  SHA-1 secure hash algorithm (FIPS 180)
 
 	  Architecture: arm using ARMv8 Crypto Extensions
 
 config CRYPTO_SHA2_ARM_CE
 	tristate "Hash functions: SHA-224 and SHA-256 (ARMv8 Crypto Extensions)"
-	depends on KERNEL_MODE_NEON
+	depends on CRYPTO && KERNEL_MODE_NEON
 	select CRYPTO_SHA256_ARM
 	select CRYPTO_HASH
 	help
 	  SHA-224 and SHA-256 secure hash algorithms (FIPS 180)
 
 	  Architecture: arm using
 	  - ARMv8 Crypto Extensions
 
 config CRYPTO_SHA256_ARM
 	tristate "Hash functions: SHA-224 and SHA-256 (NEON)"
+	depends on CRYPTO && !CPU_V7M
 	select CRYPTO_HASH
-	depends on !CPU_V7M
 	help
 	  SHA-224 and SHA-256 secure hash algorithms (FIPS 180)
 
 	  Architecture: arm using
 	  - NEON (Advanced SIMD) extensions
 
 config CRYPTO_SHA512_ARM
 	tristate "Hash functions: SHA-384 and SHA-512 (NEON)"
+	depends on CRYPTO && !CPU_V7M
 	select CRYPTO_HASH
-	depends on !CPU_V7M
 	help
 	  SHA-384 and SHA-512 secure hash algorithms (FIPS 180)
 
 	  Architecture: arm using
 	  - NEON (Advanced SIMD) extensions
 
 config CRYPTO_AES_ARM
 	tristate "Ciphers: AES"
+	depends on CRYPTO
 	select CRYPTO_ALGAPI
 	select CRYPTO_AES
 	help
 	  Block ciphers: AES cipher algorithms (FIPS-197)
 
@@ -160,11 +162,11 @@ config CRYPTO_AES_ARM
 	  disables IRQs and preloads the tables; it is hoped this makes
 	  such attacks very difficult.
 
 config CRYPTO_AES_ARM_BS
 	tristate "Ciphers: AES, modes: ECB/CBC/CTR/XTS (bit-sliced NEON)"
-	depends on KERNEL_MODE_NEON
+	depends on CRYPTO && KERNEL_MODE_NEON
 	select CRYPTO_AES_ARM
 	select CRYPTO_SKCIPHER
 	select CRYPTO_LIB_AES
 	help
 	  Length-preserving ciphers: AES cipher algorithms (FIPS-197)
@@ -188,11 +190,11 @@ config CRYPTO_AES_ARM_BS
 	  ciphertext stealing when the message isn't a multiple of 16 bytes, and
 	  CTR when invoked in a context in which NEON instructions are unusable.
 
 config CRYPTO_AES_ARM_CE
 	tristate "Ciphers: AES, modes: ECB/CBC/CTS/CTR/XTS (ARMv8 Crypto Extensions)"
-	depends on KERNEL_MODE_NEON
+	depends on CRYPTO && KERNEL_MODE_NEON
 	select CRYPTO_SKCIPHER
 	select CRYPTO_LIB_AES
 	help
 	  Length-preserving ciphers: AES cipher algorithms (FIPS-197)
 	   with block cipher modes:
crypto/Kconfig +0 -3
index 9322e42e562d..cad71f32e1e3 100644
@@ -1424,13 +1424,10 @@ endmenu
 
 config CRYPTO_HASH_INFO
 	bool
 
 if !KMSAN # avoid false positives from assembly
-if ARM
-source "arch/arm/crypto/Kconfig"
-endif
 if ARM64
 source "arch/arm64/crypto/Kconfig"
 endif
 if LOONGARCH
 source "arch/loongarch/crypto/Kconfig"
Signature · 1 line
2.49.0
author maintainer
#12 lore raw

PATCH 2/15 crypto: arm64 - drop redundant dependencies on ARM64

In reply to Eric Biggers

From: Eric Biggers <[email protected]>

arch/arm64/crypto/Kconfig is sourced only when CONFIG_ARM64=y, so there is no need for the symbols defined inside it to depend on ARM64.

---
 arch/arm64/crypto/Kconfig | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/crypto/Kconfig +2 -2
index 7c2f63f2e307..704d0b7e1d13 100644
@@ -135,11 +135,11 @@ config CRYPTO_AES_ARM64
 
 	  Architecture: arm64
 
 config CRYPTO_AES_ARM64_CE
 	tristate "Ciphers: AES (ARMv8 Crypto Extensions)"
-	depends on ARM64 && KERNEL_MODE_NEON
+	depends on KERNEL_MODE_NEON
 	select CRYPTO_ALGAPI
 	select CRYPTO_LIB_AES
 	help
 	  Block ciphers: AES cipher algorithms (FIPS-197)
 
@@ -252,11 +252,11 @@ config CRYPTO_SM4_ARM64_NEON_BLK
 	  Architecture: arm64 using:
 	  - NEON (Advanced SIMD) extensions
 
 config CRYPTO_AES_ARM64_CE_CCM
 	tristate "AEAD cipher: AES in CCM mode (ARMv8 Crypto Extensions)"
-	depends on ARM64 && KERNEL_MODE_NEON
+	depends on KERNEL_MODE_NEON
 	select CRYPTO_ALGAPI
 	select CRYPTO_AES_ARM64_CE
 	select CRYPTO_AES_ARM64_CE_BLK
 	select CRYPTO_AEAD
 	select CRYPTO_LIB_AES
Signature · 1 line
2.49.0
author maintainer
#13 lore raw

PATCH 3/15 crypto: arm64 - remove CRYPTO dependency of library functions

In reply to Eric Biggers

From: Eric Biggers <[email protected]>

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

---
 arch/arm64/Kconfig        |  3 ++-
 arch/arm64/crypto/Kconfig | 41 +++++++++++++++++++++------------------
 crypto/Kconfig            |  3 ---
 3 files changed, 24 insertions(+), 23 deletions(-)
arch/arm64/Kconfig +2 -1
index a182295e6f08..7f6ce0da6f87 100644
@@ -2509,7 +2509,8 @@ source "drivers/cpufreq/Kconfig"
 
 endmenu # "CPU Power Management"
 
 source "drivers/acpi/Kconfig"
 
-source "arch/arm64/kvm/Kconfig"
+source "arch/arm64/crypto/Kconfig"
 
+source "arch/arm64/kvm/Kconfig"
arch/arm64/crypto/Kconfig +22 -19

256 lines not on this page · raw message

crypto/Kconfig +0 -3
index cad71f32e1e3..a5225c6d0488 100644
@@ -1424,13 +1424,10 @@ endmenu
 
 config CRYPTO_HASH_INFO
 	bool
 
 if !KMSAN # avoid false positives from assembly
-if ARM64
-source "arch/arm64/crypto/Kconfig"
-endif
 if LOONGARCH
 source "arch/loongarch/crypto/Kconfig"
 endif
 if MIPS
 source "arch/mips/crypto/Kconfig"
Signature · 1 line
2.49.0
author maintainer
#14 lore raw

PATCH 4/15 crypto: loongarch - source arch/loongarch/crypto/Kconfig without CRYPTO

In reply to Eric Biggers

From: Eric Biggers <[email protected]>

Source arch/loongarch/crypto/Kconfig regardless of CRYPTO, so that if library functions are ever added to there they can be built without pulling in the generic crypto infrastructure.

---
 arch/loongarch/Kconfig | 1 +
 crypto/Kconfig         | 3 ---
 2 files changed, 1 insertion(+), 3 deletions(-)
arch/loongarch/Kconfig +1 -0
index 067c0b994648..8ad6cbd8676f 100644
@@ -737,6 +737,7 @@ source "kernel/power/Kconfig"
 source "drivers/acpi/Kconfig"
 source "drivers/cpufreq/Kconfig"
 
 endmenu
 
+source "arch/loongarch/crypto/Kconfig"
 source "arch/loongarch/kvm/Kconfig"
crypto/Kconfig +0 -3
index a5225c6d0488..de71e9c9f2ad 100644
@@ -1424,13 +1424,10 @@ endmenu
 
 config CRYPTO_HASH_INFO
 	bool
 
 if !KMSAN # avoid false positives from assembly
-if LOONGARCH
-source "arch/loongarch/crypto/Kconfig"
-endif
 if MIPS
 source "arch/mips/crypto/Kconfig"
 endif
 if PPC
 source "arch/powerpc/crypto/Kconfig"
Signature · 1 line
2.49.0
author maintainer
#15 lore raw

PATCH 5/15 crypto: mips - remove CRYPTO dependency of library functions

In reply to Eric Biggers

From: Eric Biggers <[email protected]>

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.

---
 arch/mips/Kconfig        | 2 ++
 arch/mips/crypto/Kconfig | 8 ++++----
 crypto/Kconfig           | 3 ---
 3 files changed, 6 insertions(+), 7 deletions(-)
arch/mips/Kconfig +2 -0
index fc0772c1bad4..9e0cf394a46b 100644
@@ -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"
arch/mips/crypto/Kconfig +4 -4
index 8283664a1f24..beb7b20cf3e8 100644
@@ -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)
 
crypto/Kconfig +0 -3
index de71e9c9f2ad..cfa426bea0c6 100644
@@ -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"
Signature · 1 line
2.49.0
author maintainer
#16 lore raw

PATCH 6/15 crypto: powerpc - drop redundant dependencies on PPC

In reply to Eric Biggers

From: Eric Biggers <[email protected]>

arch/powerpc/crypto/Kconfig is sourced only when CONFIG_PPC=y, so there is no need for the symbols defined inside it to depend on PPC.

---
 arch/powerpc/crypto/Kconfig | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
arch/powerpc/crypto/Kconfig +3 -5
index cbcf76953d83..8bcc69013464 100644
@@ -15,48 +15,46 @@ config CRYPTO_CURVE25519_PPC64
 	  Architecture: PowerPC64
 	  - Little-endian
 
 config CRYPTO_MD5_PPC
 	tristate "Digests: MD5"
-	depends on PPC
 	select CRYPTO_HASH
 	help
 	  MD5 message digest algorithm (RFC1321)
 
 	  Architecture: powerpc
 
 config CRYPTO_SHA1_PPC
 	tristate "Hash functions: SHA-1"
-	depends on PPC
 	help
 	  SHA-1 secure hash algorithm (FIPS 180)
 
 	  Architecture: powerpc
 
 config CRYPTO_SHA1_PPC_SPE
 	tristate "Hash functions: SHA-1 (SPE)"
-	depends on PPC && SPE
+	depends on SPE
 	help
 	  SHA-1 secure hash algorithm (FIPS 180)
 
 	  Architecture: powerpc using
 	  - SPE (Signal Processing Engine) extensions
 
 config CRYPTO_SHA256_PPC_SPE
 	tristate "Hash functions: SHA-224 and SHA-256 (SPE)"
-	depends on PPC && SPE
+	depends on SPE
 	select CRYPTO_SHA256
 	select CRYPTO_HASH
 	help
 	  SHA-224 and SHA-256 secure hash algorithms (FIPS 180)
 
 	  Architecture: powerpc using
 	  - SPE (Signal Processing Engine) extensions
 
 config CRYPTO_AES_PPC_SPE
 	tristate "Ciphers: AES, modes: ECB/CBC/CTR/XTS (SPE)"
-	depends on PPC && SPE
+	depends on SPE
 	select CRYPTO_SKCIPHER
 	help
 	  Block ciphers: AES cipher algorithms (FIPS-197)
 	  Length-preserving ciphers: AES with ECB, CBC, CTR, and XTS modes
 
Signature · 1 line
2.49.0
author maintainer
#17 lore raw

PATCH 7/15 crypto: powerpc - remove CRYPTO dependency of library functions

In reply to Eric Biggers

From: Eric Biggers <[email protected]>

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

---
 arch/powerpc/Kconfig        |  2 ++
 arch/powerpc/crypto/Kconfig | 16 +++++++++-------
 crypto/Kconfig              |  3 ---
 3 files changed, 11 insertions(+), 10 deletions(-)
arch/powerpc/Kconfig +2 -0
index 6722625a406a..9ffd80880675 100644
@@ -1346,8 +1346,10 @@ config PHYSICAL_START
 endif
 
 config PPC_LIB_RHEAP
 	bool
 
+source "arch/powerpc/crypto/Kconfig"
+
 source "arch/powerpc/kvm/Kconfig"
 
 source "kernel/livepatch/Kconfig"
arch/powerpc/crypto/Kconfig +9 -7
index 8bcc69013464..0f14bdf104d5 100644
@@ -2,11 +2,11 @@
 
 menu "Accelerated Cryptographic Algorithms for CPU (powerpc)"
 
 config CRYPTO_CURVE25519_PPC64
 	tristate
-	depends on PPC64 && CPU_LITTLE_ENDIAN
+	depends on CRYPTO && PPC64 && CPU_LITTLE_ENDIAN
 	select CRYPTO_KPP
 	select CRYPTO_LIB_CURVE25519_GENERIC
 	select CRYPTO_ARCH_HAVE_LIB_CURVE25519
 	default CRYPTO_LIB_CURVE25519_INTERNAL
 	help
@@ -15,46 +15,48 @@ config CRYPTO_CURVE25519_PPC64
 	  Architecture: PowerPC64
 	  - Little-endian
 
 config CRYPTO_MD5_PPC
 	tristate "Digests: MD5"
+	depends on CRYPTO
 	select CRYPTO_HASH
 	help
 	  MD5 message digest algorithm (RFC1321)
 
 	  Architecture: powerpc
 
 config CRYPTO_SHA1_PPC
 	tristate "Hash functions: SHA-1"
+	depends on CRYPTO
 	help
 	  SHA-1 secure hash algorithm (FIPS 180)
 
 	  Architecture: powerpc
 
 config CRYPTO_SHA1_PPC_SPE
 	tristate "Hash functions: SHA-1 (SPE)"
-	depends on SPE
+	depends on CRYPTO && SPE
 	help
 	  SHA-1 secure hash algorithm (FIPS 180)
 
 	  Architecture: powerpc using
 	  - SPE (Signal Processing Engine) extensions
 
 config CRYPTO_SHA256_PPC_SPE
 	tristate "Hash functions: SHA-224 and SHA-256 (SPE)"
-	depends on SPE
+	depends on CRYPTO && SPE
 	select CRYPTO_SHA256
 	select CRYPTO_HASH
 	help
 	  SHA-224 and SHA-256 secure hash algorithms (FIPS 180)
 
 	  Architecture: powerpc using
 	  - SPE (Signal Processing Engine) extensions
 
 config CRYPTO_AES_PPC_SPE
 	tristate "Ciphers: AES, modes: ECB/CBC/CTR/XTS (SPE)"
-	depends on SPE
+	depends on CRYPTO && SPE
 	select CRYPTO_SKCIPHER
 	help
 	  Block ciphers: AES cipher algorithms (FIPS-197)
 	  Length-preserving ciphers: AES with ECB, CBC, CTR, and XTS modes
 
@@ -72,11 +74,11 @@ config CRYPTO_AES_PPC_SPE
 	  architecture specific assembler implementations that work on 1KB
 	  tables or 256 bytes S-boxes.
 
 config CRYPTO_AES_GCM_P10
 	tristate "Stitched AES/GCM acceleration support on P10 or later CPU (PPC)"
-	depends on PPC64 && CPU_LITTLE_ENDIAN && VSX
+	depends on CRYPTO && PPC64 && CPU_LITTLE_ENDIAN && VSX
 	select CRYPTO_LIB_AES
 	select CRYPTO_ALGAPI
 	select CRYPTO_AEAD
 	select CRYPTO_SKCIPHER
 	select CRYPTO_SIMD
@@ -104,17 +106,17 @@ config CRYPTO_POLY1305_P10
 	select CRYPTO_LIB_POLY1305_GENERIC
 	default CRYPTO_LIB_POLY1305_INTERNAL
 
 config CRYPTO_DEV_VMX
         bool "Support for VMX cryptographic acceleration instructions"
-        depends on PPC64 && VSX
+        depends on CRYPTO && PPC64 && VSX
         help
           Support for VMX cryptographic acceleration instructions.
 
 config CRYPTO_DEV_VMX_ENCRYPT
 	tristate "Encryption acceleration support on P8 CPU"
-	depends on CRYPTO_DEV_VMX
+	depends on CRYPTO && CRYPTO_DEV_VMX
 	select CRYPTO_AES
 	select CRYPTO_CBC
 	select CRYPTO_CTR
 	select CRYPTO_GHASH
 	select CRYPTO_XTS
crypto/Kconfig +0 -3
index cfa426bea0c6..2467dba73372 100644
@@ -1424,13 +1424,10 @@ endmenu
 
 config CRYPTO_HASH_INFO
 	bool
 
 if !KMSAN # avoid false positives from assembly
-if PPC
-source "arch/powerpc/crypto/Kconfig"
-endif
 if RISCV
 source "arch/riscv/crypto/Kconfig"
 endif
 if S390
 source "arch/s390/crypto/Kconfig"
Signature · 1 line
2.49.0
author maintainer
#18 lore raw

PATCH 8/15 crypto: riscv - remove CRYPTO dependency of library functions

In reply to Eric Biggers

From: Eric Biggers <[email protected]>

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

---
 arch/riscv/Kconfig        |  2 ++
 arch/riscv/crypto/Kconfig | 12 ++++++------
 crypto/Kconfig            |  3 ---
 3 files changed, 8 insertions(+), 9 deletions(-)
arch/riscv/Kconfig +2 -0
index bbec87b79309..baa7b8d98ed8 100644
@@ -1349,8 +1349,10 @@ source "drivers/cpuidle/Kconfig"
 
 source "drivers/cpufreq/Kconfig"
 
 endmenu # "CPU Power Management"
 
+source "arch/riscv/crypto/Kconfig"
+
 source "arch/riscv/kvm/Kconfig"
 
 source "drivers/acpi/Kconfig"
arch/riscv/crypto/Kconfig +6 -6
index 27a1f26d41bd..08547694937c 100644
@@ -2,11 +2,11 @@
 
 menu "Accelerated Cryptographic Algorithms for CPU (riscv)"
 
 config CRYPTO_AES_RISCV64
 	tristate "Ciphers: AES, modes: ECB, CBC, CTS, CTR, XTS"
-	depends on 64BIT && RISCV_ISA_V && TOOLCHAIN_HAS_VECTOR_CRYPTO
+	depends on CRYPTO && 64BIT && RISCV_ISA_V && TOOLCHAIN_HAS_VECTOR_CRYPTO
 	select CRYPTO_ALGAPI
 	select CRYPTO_LIB_AES
 	select CRYPTO_SKCIPHER
 	help
 	  Block cipher: AES cipher algorithms
@@ -25,43 +25,43 @@ config CRYPTO_CHACHA_RISCV64
 	select CRYPTO_LIB_CHACHA_GENERIC
 	default CRYPTO_LIB_CHACHA_INTERNAL
 
 config CRYPTO_GHASH_RISCV64
 	tristate "Hash functions: GHASH"
-	depends on 64BIT && RISCV_ISA_V && TOOLCHAIN_HAS_VECTOR_CRYPTO
+	depends on CRYPTO && 64BIT && RISCV_ISA_V && TOOLCHAIN_HAS_VECTOR_CRYPTO
 	select CRYPTO_GCM
 	help
 	  GCM GHASH function (NIST SP 800-38D)
 
 	  Architecture: riscv64 using:
 	  - Zvkg vector crypto extension
 
 config CRYPTO_SHA256_RISCV64
 	tristate "Hash functions: SHA-224 and SHA-256"
-	depends on 64BIT && RISCV_ISA_V && TOOLCHAIN_HAS_VECTOR_CRYPTO
+	depends on CRYPTO && 64BIT && RISCV_ISA_V && TOOLCHAIN_HAS_VECTOR_CRYPTO
 	select CRYPTO_SHA256
 	help
 	  SHA-224 and SHA-256 secure hash algorithm (FIPS 180)
 
 	  Architecture: riscv64 using:
 	  - Zvknha or Zvknhb vector crypto extensions
 	  - Zvkb vector crypto extension
 
 config CRYPTO_SHA512_RISCV64
 	tristate "Hash functions: SHA-384 and SHA-512"
-	depends on 64BIT && RISCV_ISA_V && TOOLCHAIN_HAS_VECTOR_CRYPTO
+	depends on CRYPTO && 64BIT && RISCV_ISA_V && TOOLCHAIN_HAS_VECTOR_CRYPTO
 	select CRYPTO_SHA512
 	help
 	  SHA-384 and SHA-512 secure hash algorithm (FIPS 180)
 
 	  Architecture: riscv64 using:
 	  - Zvknhb vector crypto extension
 	  - Zvkb vector crypto extension
 
 config CRYPTO_SM3_RISCV64
 	tristate "Hash functions: SM3 (ShangMi 3)"
-	depends on 64BIT && RISCV_ISA_V && TOOLCHAIN_HAS_VECTOR_CRYPTO
+	depends on CRYPTO && 64BIT && RISCV_ISA_V && TOOLCHAIN_HAS_VECTOR_CRYPTO
 	select CRYPTO_HASH
 	select CRYPTO_LIB_SM3
 	help
 	  SM3 (ShangMi 3) secure hash function (OSCCA GM/T 0004-2012)
 
@@ -69,11 +69,11 @@ config CRYPTO_SM3_RISCV64
 	  - Zvksh vector crypto extension
 	  - Zvkb vector crypto extension
 
 config CRYPTO_SM4_RISCV64
 	tristate "Ciphers: SM4 (ShangMi 4)"
-	depends on 64BIT && RISCV_ISA_V && TOOLCHAIN_HAS_VECTOR_CRYPTO
+	depends on CRYPTO && 64BIT && RISCV_ISA_V && TOOLCHAIN_HAS_VECTOR_CRYPTO
 	select CRYPTO_ALGAPI
 	select CRYPTO_SM4
 	help
 	  SM4 block cipher algorithm (OSCCA GB/T 32907-2016,
 	  ISO/IEC 18033-3:2010/Amd 1:2021)
crypto/Kconfig +0 -3
index 2467dba73372..8c334c9f2081 100644
@@ -1424,13 +1424,10 @@ endmenu
 
 config CRYPTO_HASH_INFO
 	bool
 
 if !KMSAN # avoid false positives from assembly
-if RISCV
-source "arch/riscv/crypto/Kconfig"
-endif
 if S390
 source "arch/s390/crypto/Kconfig"
 endif
 if SPARC
 source "arch/sparc/crypto/Kconfig"
Signature · 1 line
2.49.0
author maintainer
#20 lore raw

PATCH 9/15 crypto: s390 - drop redundant dependencies on S390

In reply to Eric Biggers

From: Eric Biggers <[email protected]>

arch/s390/crypto/Kconfig is sourced only when CONFIG_S390=y, so there is no need for the symbols defined inside it to depend on S390.

---
 arch/s390/crypto/Kconfig | 10 ----------
 1 file changed, 10 deletions(-)
arch/s390/crypto/Kconfig +0 -10
index 055b08f259ab..e88d9cd256ef 100644
@@ -2,77 +2,70 @@
 
 menu "Accelerated Cryptographic Algorithms for CPU (s390)"
 
 config CRYPTO_SHA512_S390
 	tristate "Hash functions: SHA-384 and SHA-512"
-	depends on S390
 	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 S390
 	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 S390
 	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 S390
 	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 S390
 	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 S390
 	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 S390
 	select CRYPTO_ALGAPI
 	select CRYPTO_SKCIPHER
 	help
 	  Block cipher: AES cipher algorithms (FIPS 197)
 	  AEAD cipher: AES with GCM
@@ -90,11 +83,10 @@ 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 S390
 	select CRYPTO_ALGAPI
 	select CRYPTO_SKCIPHER
 	select CRYPTO_LIB_DES
 	help
 	  Block ciphers: DES (FIPS 46-2) cipher algorithm
@@ -107,18 +99,16 @@ config CRYPTO_DES_S390
 	  As of z990 the ECB and CBC mode are hardware accelerated.
 	  As of z196 the CTR mode is hardware accelerated.
 
 config CRYPTO_CHACHA_S390
 	tristate
-	depends on S390
 	select CRYPTO_LIB_CHACHA_GENERIC
 	select CRYPTO_ARCH_HAVE_LIB_CHACHA
 	default CRYPTO_LIB_CHACHA_INTERNAL
 
 config CRYPTO_HMAC_S390
 	tristate "Keyed-hash message authentication code: HMAC"
-	depends on S390
 	select CRYPTO_HASH
 	help
 	  s390 specific HMAC hardware support for SHA224, SHA256, SHA384 and
 	  SHA512.
 
Signature · 1 line
2.49.0
author maintainer
#21 lore raw

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

In reply to Eric Biggers

From: Eric Biggers <[email protected]>

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.

---
 arch/s390/Kconfig        | 4 ++++
 arch/s390/crypto/Kconfig | 9 +++++++++
 crypto/Kconfig           | 3 ---
 3 files changed, 13 insertions(+), 3 deletions(-)
arch/s390/Kconfig +4 -0
index db8161ebb43c..2f32d51e8a73 100644
@@ -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
arch/s390/crypto/Kconfig +9 -0
index e88d9cd256ef..a2e6efd8aed8 100644
@@ -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.
 
crypto/Kconfig +0 -3
index 8c334c9f2081..78e83ce576ed 100644
@@ -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"
Signature · 1 line
2.49.0
author maintainer
#22 lore raw

PATCH 11/15 crypto: sparc - source arch/sparc/crypto/Kconfig without CRYPTO

In reply to Eric Biggers

From: Eric Biggers <[email protected]>

Source arch/sparc/crypto/Kconfig regardless of CRYPTO, so that if library functions are ever added to there they can be built without pulling in the generic crypto infrastructure.

---
 arch/sparc/Kconfig        |  2 ++
 arch/sparc/crypto/Kconfig | 14 +++++++-------
 crypto/Kconfig            |  3 ---
 3 files changed, 9 insertions(+), 10 deletions(-)
arch/sparc/Kconfig +2 -0
index 0f88123925a4..b1081e627a28 100644
@@ -407,10 +407,12 @@ config UBOOT_ENTRY_ADDR
 	 hardcoded by the SPARC32 and LEON port.
 
 	 This is the virtual address u-boot jumps to when booting the Linux
 	 Kernel.
 
+source "arch/sparc/crypto/Kconfig"
+
 endmenu
 endif
 
 endmenu
 
arch/sparc/crypto/Kconfig +7 -7
index e858597de89d..477a85370507 100644
@@ -2,11 +2,11 @@
 
 menu "Accelerated Cryptographic Algorithms for CPU (sparc64)"
 
 config CRYPTO_DES_SPARC64
 	tristate "Ciphers: DES and Triple DES EDE, modes: ECB/CBC"
-	depends on SPARC64
+	depends on CRYPTO && SPARC64
 	select CRYPTO_ALGAPI
 	select CRYPTO_LIB_DES
 	select CRYPTO_SKCIPHER
 	help
 	  Block cipher: DES (FIPS 46-2) cipher algorithm
@@ -16,61 +16,61 @@ config CRYPTO_DES_SPARC64
 
 	  Architecture: sparc64
 
 config CRYPTO_MD5_SPARC64
 	tristate "Digests: MD5"
-	depends on SPARC64
+	depends on CRYPTO && SPARC64
 	select CRYPTO_MD5
 	select CRYPTO_HASH
 	help
 	  MD5 message digest algorithm (RFC1321)
 
 	  Architecture: sparc64 using crypto instructions, when available
 
 config CRYPTO_SHA1_SPARC64
 	tristate "Hash functions: SHA-1"
-	depends on SPARC64
+	depends on CRYPTO && SPARC64
 	select CRYPTO_SHA1
 	select CRYPTO_HASH
 	help
 	  SHA-1 secure hash algorithm (FIPS 180)
 
 	  Architecture: sparc64
 
 config CRYPTO_SHA256_SPARC64
 	tristate "Hash functions: SHA-224 and SHA-256"
-	depends on SPARC64
+	depends on CRYPTO && SPARC64
 	select CRYPTO_SHA256
 	select CRYPTO_HASH
 	help
 	  SHA-224 and SHA-256 secure hash algorithms (FIPS 180)
 
 	  Architecture: sparc64 using crypto instructions, when available
 
 config CRYPTO_SHA512_SPARC64
 	tristate "Hash functions: SHA-384 and SHA-512"
-	depends on SPARC64
+	depends on CRYPTO && SPARC64
 	select CRYPTO_SHA512
 	select CRYPTO_HASH
 	help
 	  SHA-384 and SHA-512 secure hash algorithms (FIPS 180)
 
 	  Architecture: sparc64 using crypto instructions, when available
 
 config CRYPTO_AES_SPARC64
 	tristate "Ciphers: AES, modes: ECB, CBC, CTR"
-	depends on SPARC64
+	depends on CRYPTO && SPARC64
 	select CRYPTO_SKCIPHER
 	help
 	  Block ciphers: AES cipher algorithms (FIPS-197)
 	  Length-preseving ciphers: AES with ECB, CBC, and CTR modes
 
 	  Architecture: sparc64 using crypto instructions
 
 config CRYPTO_CAMELLIA_SPARC64
 	tristate "Ciphers: Camellia, modes: ECB, CBC"
-	depends on SPARC64
+	depends on CRYPTO && SPARC64
 	select CRYPTO_ALGAPI
 	select CRYPTO_SKCIPHER
 	help
 	  Block ciphers: Camellia cipher algorithms
 	  Length-preserving ciphers: Camellia with ECB and CBC modes
crypto/Kconfig +0 -3
index 78e83ce576ed..c0906bb4f844 100644
@@ -1424,13 +1424,10 @@ endmenu
 
 config CRYPTO_HASH_INFO
 	bool
 
 if !KMSAN # avoid false positives from assembly
-if SPARC
-source "arch/sparc/crypto/Kconfig"
-endif
 if X86
 source "arch/x86/crypto/Kconfig"
 endif
 endif
 
Signature · 1 line
2.49.0
author maintainer
#23 lore raw

PATCH 12/15 crypto: x86 - drop redundant dependencies on X86

In reply to Eric Biggers

From: Eric Biggers <[email protected]>

arch/x86/crypto/Kconfig is sourced only when CONFIG_X86=y, so there is no need for the symbols defined inside it to depend on X86.

In the case of CRYPTO_TWOFISH_586 and CRYPTO_TWOFISH_X86_64, the dependency was actually on '(X86 || UML_X86)', which suggests that these two symbols were intended to be available under user-mode Linux as well. Yet, again these symbols were defined only when CONFIG_X86=y, so that was not the case. Just remove this redundant dependency.

---
 arch/x86/crypto/Kconfig | 67 ++++++++++++++++++++---------------------
 1 file changed, 33 insertions(+), 34 deletions(-)
arch/x86/crypto/Kconfig +33 -34
index 9a3cade49f63..b4df6cf37e0e 100644
@@ -2,11 +2,11 @@
 
 menu "Accelerated Cryptographic Algorithms for CPU (x86)"
 
 config CRYPTO_CURVE25519_X86
 	tristate
-	depends on X86 && 64BIT
+	depends on 64BIT
 	select CRYPTO_KPP
 	select CRYPTO_LIB_CURVE25519_GENERIC
 	select CRYPTO_ARCH_HAVE_LIB_CURVE25519
 	default CRYPTO_LIB_CURVE25519_INTERNAL
 	help
@@ -15,11 +15,10 @@ config CRYPTO_CURVE25519_X86
 	  Architecture: x86_64 using:
 	  - ADX (large integer arithmetic)
 
 config CRYPTO_AES_NI_INTEL
 	tristate "Ciphers: AES, modes: ECB, CBC, CTS, CTR, XCTR, XTS, GCM (AES-NI/VAES)"
-	depends on X86
 	select CRYPTO_AEAD
 	select CRYPTO_LIB_AES
 	select CRYPTO_LIB_GF128MUL
 	select CRYPTO_ALGAPI
 	select CRYPTO_SKCIPHER
@@ -35,11 +34,11 @@ config CRYPTO_AES_NI_INTEL
 	  Some algorithm implementations are supported only in 64-bit builds,
 	  and some have additional prerequisites such as AVX2 or AVX512.
 
 config CRYPTO_BLOWFISH_X86_64
 	tristate "Ciphers: Blowfish, modes: ECB, CBC"
-	depends on X86 && 64BIT
+	depends on 64BIT
 	select CRYPTO_SKCIPHER
 	select CRYPTO_BLOWFISH_COMMON
 	imply CRYPTO_CTR
 	help
 	  Block cipher: Blowfish cipher algorithm
@@ -47,22 +46,22 @@ config CRYPTO_BLOWFISH_X86_64
 
 	  Architecture: x86_64
 
 config CRYPTO_CAMELLIA_X86_64
 	tristate "Ciphers: Camellia with modes: ECB, CBC"
-	depends on X86 && 64BIT
+	depends on 64BIT
 	select CRYPTO_SKCIPHER
 	imply CRYPTO_CTR
 	help
 	  Block cipher: Camellia cipher algorithms
 	  Length-preserving ciphers: Camellia with ECB and CBC modes
 
 	  Architecture: x86_64
 
 config CRYPTO_CAMELLIA_AESNI_AVX_X86_64
 	tristate "Ciphers: Camellia with modes: ECB, CBC (AES-NI/AVX)"
-	depends on X86 && 64BIT
+	depends on 64BIT
 	select CRYPTO_SKCIPHER
 	select CRYPTO_CAMELLIA_X86_64
 	imply CRYPTO_XTS
 	help
 	  Length-preserving ciphers: Camellia with ECB and CBC modes
@@ -71,22 +70,22 @@ config CRYPTO_CAMELLIA_AESNI_AVX_X86_64
 	  - AES-NI (AES New Instructions)
 	  - AVX (Advanced Vector Extensions)
 
 config CRYPTO_CAMELLIA_AESNI_AVX2_X86_64
 	tristate "Ciphers: Camellia with modes: ECB, CBC (AES-NI/AVX2)"
-	depends on X86 && 64BIT
+	depends on 64BIT
 	select CRYPTO_CAMELLIA_AESNI_AVX_X86_64
 	help
 	  Length-preserving ciphers: Camellia with ECB and CBC modes
 
 	  Architecture: x86_64 using:
 	  - AES-NI (AES New Instructions)
 	  - AVX2 (Advanced Vector Extensions 2)
 
 config CRYPTO_CAST5_AVX_X86_64
 	tristate "Ciphers: CAST5 with modes: ECB, CBC (AVX)"
-	depends on X86 && 64BIT
+	depends on 64BIT
 	select CRYPTO_SKCIPHER
 	select CRYPTO_CAST5
 	select CRYPTO_CAST_COMMON
 	imply CRYPTO_CTR
 	help
@@ -98,11 +97,11 @@ config CRYPTO_CAST5_AVX_X86_64
 
 	  Processes 16 blocks in parallel.
 
 config CRYPTO_CAST6_AVX_X86_64
 	tristate "Ciphers: CAST6 with modes: ECB, CBC (AVX)"
-	depends on X86 && 64BIT
+	depends on 64BIT
 	select CRYPTO_SKCIPHER
 	select CRYPTO_CAST6
 	select CRYPTO_CAST_COMMON
 	imply CRYPTO_XTS
 	imply CRYPTO_CTR
@@ -115,11 +114,11 @@ config CRYPTO_CAST6_AVX_X86_64
 
 	  Processes eight blocks in parallel.
 
 config CRYPTO_DES3_EDE_X86_64
 	tristate "Ciphers: Triple DES EDE with modes: ECB, CBC"
-	depends on X86 && 64BIT
+	depends on 64BIT
 	select CRYPTO_SKCIPHER
 	select CRYPTO_LIB_DES
 	imply CRYPTO_CTR
 	help
 	  Block cipher: Triple DES EDE (FIPS 46-3) cipher algorithm
@@ -129,11 +128,11 @@ config CRYPTO_DES3_EDE_X86_64
 
 	  Processes one or three blocks in parallel.
 
 config CRYPTO_SERPENT_SSE2_X86_64
 	tristate "Ciphers: Serpent with modes: ECB, CBC (SSE2)"
-	depends on X86 && 64BIT
+	depends on 64BIT
 	select CRYPTO_SKCIPHER
 	select CRYPTO_SERPENT
 	imply CRYPTO_CTR
 	help
 	  Length-preserving ciphers: Serpent cipher algorithm
@@ -144,11 +143,11 @@ config CRYPTO_SERPENT_SSE2_X86_64
 
 	  Processes eight blocks in parallel.
 
 config CRYPTO_SERPENT_SSE2_586
 	tristate "Ciphers: Serpent with modes: ECB, CBC (32-bit with SSE2)"
-	depends on X86 && !64BIT
+	depends on !64BIT
 	select CRYPTO_SKCIPHER
 	select CRYPTO_SERPENT
 	imply CRYPTO_CTR
 	help
 	  Length-preserving ciphers: Serpent cipher algorithm
@@ -159,11 +158,11 @@ config CRYPTO_SERPENT_SSE2_586
 
 	  Processes four blocks in parallel.
 
 config CRYPTO_SERPENT_AVX_X86_64
 	tristate "Ciphers: Serpent with modes: ECB, CBC (AVX)"
-	depends on X86 && 64BIT
+	depends on 64BIT
 	select CRYPTO_SKCIPHER
 	select CRYPTO_SERPENT
 	imply CRYPTO_XTS
 	imply CRYPTO_CTR
 	help
@@ -175,11 +174,11 @@ config CRYPTO_SERPENT_AVX_X86_64
 
 	  Processes eight blocks in parallel.
 
 config CRYPTO_SERPENT_AVX2_X86_64
 	tristate "Ciphers: Serpent with modes: ECB, CBC (AVX2)"
-	depends on X86 && 64BIT
+	depends on 64BIT
 	select CRYPTO_SERPENT_AVX_X86_64
 	help
 	  Length-preserving ciphers: Serpent cipher algorithm
 	  with ECB and CBC modes
 
@@ -188,11 +187,11 @@ config CRYPTO_SERPENT_AVX2_X86_64
 
 	  Processes 16 blocks in parallel.
 
 config CRYPTO_SM4_AESNI_AVX_X86_64
 	tristate "Ciphers: SM4 with modes: ECB, CBC, CTR (AES-NI/AVX)"
-	depends on X86 && 64BIT
+	depends on 64BIT
 	select CRYPTO_SKCIPHER
 	select CRYPTO_ALGAPI
 	select CRYPTO_SM4
 	help
 	  Length-preserving ciphers: SM4 cipher algorithms
@@ -208,11 +207,11 @@ config CRYPTO_SM4_AESNI_AVX_X86_64
 
 	  If unsure, say N.
 
 config CRYPTO_SM4_AESNI_AVX2_X86_64
 	tristate "Ciphers: SM4 with modes: ECB, CBC, CTR (AES-NI/AVX2)"
-	depends on X86 && 64BIT
+	depends on 64BIT
 	select CRYPTO_SKCIPHER
 	select CRYPTO_ALGAPI
 	select CRYPTO_SM4
 	select CRYPTO_SM4_AESNI_AVX_X86_64
 	help
@@ -229,33 +228,33 @@ config CRYPTO_SM4_AESNI_AVX2_X86_64
 
 	  If unsure, say N.
 
 config CRYPTO_TWOFISH_586
 	tristate "Ciphers: Twofish (32-bit)"
-	depends on (X86 || UML_X86) && !64BIT
+	depends on !64BIT
 	select CRYPTO_ALGAPI
 	select CRYPTO_TWOFISH_COMMON
 	imply CRYPTO_CTR
 	help
 	  Block cipher: Twofish cipher algorithm
 
 	  Architecture: x86 (32-bit)
 
 config CRYPTO_TWOFISH_X86_64
 	tristate "Ciphers: Twofish"
-	depends on (X86 || UML_X86) && 64BIT
+	depends on 64BIT
 	select CRYPTO_ALGAPI
 	select CRYPTO_TWOFISH_COMMON
 	imply CRYPTO_CTR
 	help
 	  Block cipher: Twofish cipher algorithm
 
 	  Architecture: x86_64
 
 config CRYPTO_TWOFISH_X86_64_3WAY
 	tristate "Ciphers: Twofish with modes: ECB, CBC (3-way parallel)"
-	depends on X86 && 64BIT
+	depends on 64BIT
 	select CRYPTO_SKCIPHER
 	select CRYPTO_TWOFISH_COMMON
 	select CRYPTO_TWOFISH_X86_64
 	help
 	  Length-preserving cipher: Twofish cipher algorithm
@@ -266,11 +265,11 @@ config CRYPTO_TWOFISH_X86_64_3WAY
 	  Processes three blocks in parallel, better utilizing resources of
 	  out-of-order CPUs.
 
 config CRYPTO_TWOFISH_AVX_X86_64
 	tristate "Ciphers: Twofish with modes: ECB, CBC (AVX)"
-	depends on X86 && 64BIT
+	depends on 64BIT
 	select CRYPTO_SKCIPHER
 	select CRYPTO_TWOFISH_COMMON
 	select CRYPTO_TWOFISH_X86_64
 	select CRYPTO_TWOFISH_X86_64_3WAY
 	imply CRYPTO_XTS
@@ -283,11 +282,11 @@ config CRYPTO_TWOFISH_AVX_X86_64
 
 	  Processes eight blocks in parallel.
 
 config CRYPTO_ARIA_AESNI_AVX_X86_64
 	tristate "Ciphers: ARIA with modes: ECB, CTR (AES-NI/AVX/GFNI)"
-	depends on X86 && 64BIT
+	depends on 64BIT
 	select CRYPTO_SKCIPHER
 	select CRYPTO_ALGAPI
 	select CRYPTO_ARIA
 	help
 	  Length-preserving cipher: ARIA cipher algorithms
@@ -300,11 +299,11 @@ config CRYPTO_ARIA_AESNI_AVX_X86_64
 
 	  Processes 16 blocks in parallel.
 
 config CRYPTO_ARIA_AESNI_AVX2_X86_64
 	tristate "Ciphers: ARIA with modes: ECB, CTR (AES-NI/AVX2/GFNI)"
-	depends on X86 && 64BIT
+	depends on 64BIT
 	select CRYPTO_SKCIPHER
 	select CRYPTO_ALGAPI
 	select CRYPTO_ARIA
 	select CRYPTO_ARIA_AESNI_AVX_X86_64
 	help
@@ -318,11 +317,11 @@ config CRYPTO_ARIA_AESNI_AVX2_X86_64
 
 	  Processes 32 blocks in parallel.
 
 config CRYPTO_ARIA_GFNI_AVX512_X86_64
 	tristate "Ciphers: ARIA with modes: ECB, CTR (AVX512/GFNI)"
-	depends on X86 && 64BIT && AS_GFNI
+	depends on 64BIT && AS_GFNI
 	select CRYPTO_SKCIPHER
 	select CRYPTO_ALGAPI
 	select CRYPTO_ARIA
 	select CRYPTO_ARIA_AESNI_AVX_X86_64
 	select CRYPTO_ARIA_AESNI_AVX2_X86_64
@@ -336,49 +335,49 @@ config CRYPTO_ARIA_GFNI_AVX512_X86_64
 
 	  Processes 64 blocks in parallel.
 
 config CRYPTO_CHACHA20_X86_64
 	tristate
-	depends on X86 && 64BIT
+	depends on 64BIT
 	select CRYPTO_LIB_CHACHA_GENERIC
 	select CRYPTO_ARCH_HAVE_LIB_CHACHA
 	default CRYPTO_LIB_CHACHA_INTERNAL
 
 config CRYPTO_AEGIS128_AESNI_SSE2
 	tristate "AEAD ciphers: AEGIS-128 (AES-NI/SSE4.1)"
-	depends on X86 && 64BIT
+	depends on 64BIT
 	select CRYPTO_AEAD
 	help
 	  AEGIS-128 AEAD algorithm
 
 	  Architecture: x86_64 using:
 	  - AES-NI (AES New Instructions)
 	  - SSE4.1 (Streaming SIMD Extensions 4.1)
 
 config CRYPTO_NHPOLY1305_SSE2
 	tristate "Hash functions: NHPoly1305 (SSE2)"
-	depends on X86 && 64BIT
+	depends on 64BIT
 	select CRYPTO_NHPOLY1305
 	help
 	  NHPoly1305 hash function for Adiantum
 
 	  Architecture: x86_64 using:
 	  - SSE2 (Streaming SIMD Extensions 2)
 
 config CRYPTO_NHPOLY1305_AVX2
 	tristate "Hash functions: NHPoly1305 (AVX2)"
-	depends on X86 && 64BIT
+	depends on 64BIT
 	select CRYPTO_NHPOLY1305
 	help
 	  NHPoly1305 hash function for Adiantum
 
 	  Architecture: x86_64 using:
 	  - AVX2 (Advanced Vector Extensions 2)
 
 config CRYPTO_BLAKE2S_X86
 	bool "Hash functions: BLAKE2s (SSSE3/AVX-512)"
-	depends on X86 && 64BIT
+	depends on 64BIT
 	select CRYPTO_LIB_BLAKE2S_GENERIC
 	select CRYPTO_ARCH_HAVE_LIB_BLAKE2S
 	help
 	  BLAKE2s cryptographic hash function (RFC 7693)
 
@@ -386,27 +385,27 @@ config CRYPTO_BLAKE2S_X86
 	  - SSSE3 (Supplemental SSE3)
 	  - AVX-512 (Advanced Vector Extensions-512)
 
 config CRYPTO_POLYVAL_CLMUL_NI
 	tristate "Hash functions: POLYVAL (CLMUL-NI)"
-	depends on X86 && 64BIT
+	depends on 64BIT
 	select CRYPTO_POLYVAL
 	help
 	  POLYVAL hash function for HCTR2
 
 	  Architecture: x86_64 using:
 	  - CLMUL-NI (carry-less multiplication new instructions)
 
 config CRYPTO_POLY1305_X86_64
 	tristate
-	depends on X86 && 64BIT
+	depends on 64BIT
 	select CRYPTO_ARCH_HAVE_LIB_POLY1305
 	default CRYPTO_LIB_POLY1305_INTERNAL
 
 config CRYPTO_SHA1_SSSE3
 	tristate "Hash functions: SHA-1 (SSSE3/AVX/AVX2/SHA-NI)"
-	depends on X86 && 64BIT
+	depends on 64BIT
 	select CRYPTO_SHA1
 	select CRYPTO_HASH
 	help
 	  SHA-1 secure hash algorithm (FIPS 180)
 
@@ -416,11 +415,11 @@ config CRYPTO_SHA1_SSSE3
 	  - AVX2 (Advanced Vector Extensions 2)
 	  - SHA-NI (SHA Extensions New Instructions)
 
 config CRYPTO_SHA256_SSSE3
 	tristate "Hash functions: SHA-224 and SHA-256 (SSSE3/AVX/AVX2/SHA-NI)"
-	depends on X86 && 64BIT
+	depends on 64BIT
 	select CRYPTO_SHA256
 	select CRYPTO_HASH
 	help
 	  SHA-224 and SHA-256 secure hash algorithms (FIPS 180)
 
@@ -430,11 +429,11 @@ config CRYPTO_SHA256_SSSE3
 	  - AVX2 (Advanced Vector Extensions 2)
 	  - SHA-NI (SHA Extensions New Instructions)
 
 config CRYPTO_SHA512_SSSE3
 	tristate "Hash functions: SHA-384 and SHA-512 (SSSE3/AVX/AVX2)"
-	depends on X86 && 64BIT
+	depends on 64BIT
 	select CRYPTO_SHA512
 	select CRYPTO_HASH
 	help
 	  SHA-384 and SHA-512 secure hash algorithms (FIPS 180)
 
@@ -443,11 +442,11 @@ config CRYPTO_SHA512_SSSE3
 	  - AVX (Advanced Vector Extensions)
 	  - AVX2 (Advanced Vector Extensions 2)
 
 config CRYPTO_SM3_AVX_X86_64
 	tristate "Hash functions: SM3 (AVX)"
-	depends on X86 && 64BIT
+	depends on 64BIT
 	select CRYPTO_HASH
 	select CRYPTO_LIB_SM3
 	help
 	  SM3 secure hash function as defined by OSCCA GM/T 0004-2012 SM3
 
@@ -456,11 +455,11 @@ config CRYPTO_SM3_AVX_X86_64
 
 	  If unsure, say N.
 
 config CRYPTO_GHASH_CLMUL_NI_INTEL
 	tristate "Hash functions: GHASH (CLMUL-NI)"
-	depends on X86 && 64BIT
+	depends on 64BIT
 	select CRYPTO_CRYPTD
 	help
 	  GCM GHASH hash function (NIST SP800-38D)
 
 	  Architecture: x86_64 using:
Signature · 1 line
2.49.0
author maintainer
#24 lore raw

PATCH 13/15 crypto: x86 - remove CRYPTO dependency of library functions

In reply to Eric Biggers

From: Eric Biggers <[email protected]>

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

---
 arch/x86/Kconfig        |  4 +++
 arch/x86/crypto/Kconfig | 61 +++++++++++++++++++++--------------------
 crypto/Kconfig          |  6 ----
 3 files changed, 35 insertions(+), 36 deletions(-)
arch/x86/Kconfig +4 -0
index 4b9f378e05f6..24346944439a 100644
@@ -2382,10 +2382,14 @@ config X86_BUS_LOCK_DETECT
 	default y
 	help
 	  Enable Split Lock Detect and Bus Lock Detect functionalities.
 	  See <file:Documentation/arch/x86/buslock.rst> for more information.
 
+if !KMSAN # avoid false positives from assembly
+source "arch/x86/crypto/Kconfig"
+endif
+
 endmenu
 
 config CC_HAS_NAMED_AS
 	def_bool $(success,echo 'int __seg_fs fs; int __seg_gs gs;' | $(CC) -x c - -S -o /dev/null)
 	depends on CC_IS_GCC
arch/x86/crypto/Kconfig +31 -30

370 lines not on this page · raw message

crypto/Kconfig +0 -6
index c0906bb4f844..7e207f3d3eca 100644
@@ -1423,16 +1423,10 @@ config CRYPTO_USER_API_ENABLE_OBSOLETE
 endmenu
 
 config CRYPTO_HASH_INFO
 	bool
 
-if !KMSAN # avoid false positives from assembly
-if X86
-source "arch/x86/crypto/Kconfig"
-endif
-endif
-
 source "drivers/crypto/Kconfig"
 source "crypto/asymmetric_keys/Kconfig"
 source "certs/Kconfig"
 source "crypto/krb5/Kconfig"
 
Signature · 1 line
2.49.0
author maintainer
#25 lore raw

PATCH 14/15 crypto: lib/chacha - remove INTERNAL symbol and selection of CRYPTO

In reply to Eric Biggers

From: Eric Biggers <[email protected]>

Now that the architecture-optimized ChaCha kconfig symbols are visible without CRYPTO, there is no need for CRYPTO_LIB_CHACHA to select CRYPTO. So, remove that. This makes the indirection through the CRYPTO_LIB_CHACHA_INTERNAL symbol unnecessary, so get rid of that and just use CRYPTO_LIB_CHACHA directly. Finally, make the fallback to the generic implementation use a default value instead of a select; this makes it consistent with how the arch-optimized code gets enabled and also with how CRYPTO_LIB_BLAKE2S_GENERIC gets enabled.

---
 arch/arm/crypto/Kconfig     |  2 +-
 arch/arm64/crypto/Kconfig   |  2 +-
 arch/mips/crypto/Kconfig    |  2 +-
 arch/powerpc/crypto/Kconfig |  2 +-
 arch/riscv/crypto/Kconfig   |  2 +-
 arch/s390/crypto/Kconfig    |  2 +-
 arch/x86/crypto/Kconfig     |  2 +-
 crypto/Kconfig              |  2 +-
 lib/crypto/Kconfig          | 16 +++++-----------
 9 files changed, 13 insertions(+), 19 deletions(-)
arch/arm/crypto/Kconfig +1 -1
index a03017a6dbc4..960602271443 100644
@@ -208,10 +208,10 @@ config CRYPTO_AES_ARM_CE
 	  Architecture: arm using:
 	  - ARMv8 Crypto Extensions
 
 config CRYPTO_CHACHA20_NEON
 	tristate
+	default CRYPTO_LIB_CHACHA
 	select CRYPTO_ARCH_HAVE_LIB_CHACHA
-	default CRYPTO_LIB_CHACHA_INTERNAL
 
 endmenu
 
arch/arm64/crypto/Kconfig +1 -1
index a2cccd2accb0..8184da75b24f 100644
@@ -184,13 +184,13 @@ config CRYPTO_AES_ARM64_NEON_BLK
 	  - NEON (Advanced SIMD) extensions
 
 config CRYPTO_CHACHA20_NEON
 	tristate
 	depends on KERNEL_MODE_NEON
+	default CRYPTO_LIB_CHACHA
 	select CRYPTO_LIB_CHACHA_GENERIC
 	select CRYPTO_ARCH_HAVE_LIB_CHACHA
-	default CRYPTO_LIB_CHACHA_INTERNAL
 
 config CRYPTO_AES_ARM64_BS
 	tristate "Ciphers: AES, modes: ECB/CBC/CTR/XCTR/XTS modes (bit-sliced NEON)"
 	depends on CRYPTO && KERNEL_MODE_NEON
 	select CRYPTO_SKCIPHER
arch/mips/crypto/Kconfig +1 -1
index beb7b20cf3e8..f1d61457518f 100644
@@ -48,9 +48,9 @@ config CRYPTO_SHA512_OCTEON
 	  Architecture: mips OCTEON using crypto instructions, when available
 
 config CRYPTO_CHACHA_MIPS
 	tristate
 	depends on CPU_MIPS32_R2
+	default CRYPTO_LIB_CHACHA
 	select CRYPTO_ARCH_HAVE_LIB_CHACHA
-	default CRYPTO_LIB_CHACHA_INTERNAL
 
 endmenu
arch/powerpc/crypto/Kconfig +1 -1
index 0f14bdf104d5..dd3bd22d8e20 100644
@@ -93,13 +93,13 @@ config CRYPTO_AES_GCM_P10
 	  later CPU. This module supports stitched acceleration for AES/GCM.
 
 config CRYPTO_CHACHA20_P10
 	tristate
 	depends on PPC64 && CPU_LITTLE_ENDIAN && VSX
+	default CRYPTO_LIB_CHACHA
 	select CRYPTO_LIB_CHACHA_GENERIC
 	select CRYPTO_ARCH_HAVE_LIB_CHACHA
-	default CRYPTO_LIB_CHACHA_INTERNAL
 
 config CRYPTO_POLY1305_P10
 	tristate
 	depends on PPC64 && CPU_LITTLE_ENDIAN && VSX
 	select CRYPTO_ARCH_HAVE_LIB_POLY1305
arch/riscv/crypto/Kconfig +1 -1
index 08547694937c..b5ac0d41f4a3 100644
@@ -19,13 +19,13 @@ config CRYPTO_AES_RISCV64
 	  - Zvkg vector crypto extension (XTS)
 
 config CRYPTO_CHACHA_RISCV64
 	tristate
 	depends on 64BIT && RISCV_ISA_V && TOOLCHAIN_HAS_VECTOR_CRYPTO
+	default CRYPTO_LIB_CHACHA
 	select CRYPTO_ARCH_HAVE_LIB_CHACHA
 	select CRYPTO_LIB_CHACHA_GENERIC
-	default CRYPTO_LIB_CHACHA_INTERNAL
 
 config CRYPTO_GHASH_RISCV64
 	tristate "Hash functions: GHASH"
 	depends on CRYPTO && 64BIT && RISCV_ISA_V && TOOLCHAIN_HAS_VECTOR_CRYPTO
 	select CRYPTO_GCM
arch/s390/crypto/Kconfig +1 -1
index a2e6efd8aed8..c0d238228cad 100644
@@ -107,13 +107,13 @@ config CRYPTO_DES_S390
 	  As of z990 the ECB and CBC mode are hardware accelerated.
 	  As of z196 the CTR mode is hardware accelerated.
 
 config CRYPTO_CHACHA_S390
 	tristate
+	default CRYPTO_LIB_CHACHA
 	select CRYPTO_LIB_CHACHA_GENERIC
 	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
arch/x86/crypto/Kconfig +1 -1
index daa168e37b59..5b9d6dbe6185 100644
@@ -337,13 +337,13 @@ config CRYPTO_ARIA_GFNI_AVX512_X86_64
 	  Processes 64 blocks in parallel.
 
 config CRYPTO_CHACHA20_X86_64
 	tristate
 	depends on 64BIT
+	default CRYPTO_LIB_CHACHA
 	select CRYPTO_LIB_CHACHA_GENERIC
 	select CRYPTO_ARCH_HAVE_LIB_CHACHA
-	default CRYPTO_LIB_CHACHA_INTERNAL
 
 config CRYPTO_AEGIS128_AESNI_SSE2
 	tristate "AEAD ciphers: AEGIS-128 (AES-NI/SSE4.1)"
 	depends on CRYPTO && 64BIT
 	select CRYPTO_AEAD
crypto/Kconfig +1 -1
index 7e207f3d3eca..ed50d1b6f6f3 100644
@@ -632,12 +632,12 @@ config CRYPTO_ARC4
 	  WEP, but it should not be for other purposes because of the
 	  weakness of the algorithm.
 
 config CRYPTO_CHACHA20
 	tristate "ChaCha"
+	select CRYPTO_LIB_CHACHA
 	select CRYPTO_LIB_CHACHA_GENERIC
-	select CRYPTO_LIB_CHACHA_INTERNAL
 	select CRYPTO_SKCIPHER
 	help
 	  The ChaCha20, XChaCha20, and XChaCha12 stream cipher algorithms
 
 	  ChaCha20 is a 256-bit high-speed stream cipher designed by Daniel J.
lib/crypto/Kconfig +5 -11
index 2c6ab80e0cdc..cc4c0ee04f98 100644
@@ -48,26 +48,20 @@ config CRYPTO_ARCH_HAVE_LIB_CHACHA
 	  accelerated implementation of the ChaCha library interface,
 	  either builtin or as a module.
 
 config CRYPTO_LIB_CHACHA_GENERIC
 	tristate
+	default CRYPTO_LIB_CHACHA if !CRYPTO_ARCH_HAVE_LIB_CHACHA
 	select CRYPTO_LIB_UTILS
 	help
-	  This symbol can be depended upon by arch implementations of the
-	  ChaCha library interface that require the generic code as a
-	  fallback, e.g., for SIMD implementations. If no arch specific
-	  implementation is enabled, this implementation serves the users
-	  of CRYPTO_LIB_CHACHA.
-
-config CRYPTO_LIB_CHACHA_INTERNAL
-	tristate
-	select CRYPTO_LIB_CHACHA_GENERIC if CRYPTO_ARCH_HAVE_LIB_CHACHA=n
+	  This symbol can be selected by arch implementations of the ChaCha
+	  library interface that require the generic code as a fallback, e.g.,
+	  for SIMD implementations. If no arch specific implementation is
+	  enabled, this implementation serves the users of CRYPTO_LIB_CHACHA.
 
 config CRYPTO_LIB_CHACHA
 	tristate
-	select CRYPTO
-	select CRYPTO_LIB_CHACHA_INTERNAL
 	help
 	  Enable the ChaCha library interface. This interface may be fulfilled
 	  by either the generic implementation or an arch-specific one, if one
 	  is available and enabled.
 
Signature · 1 line
2.49.0
author maintainer
#26 lore raw

PATCH 15/15 crypto: lib/poly1305 - remove INTERNAL symbol and selection of CRYPTO

In reply to Eric Biggers

From: Eric Biggers <[email protected]>

Now that the architecture-optimized Poly1305 kconfig symbols are visible without CRYPTO, there is no need for CRYPTO_LIB_POLY1305 to select CRYPTO. So, remove that. This makes the indirection through the CRYPTO_LIB_POLY1305_INTERNAL symbol unnecessary, so get rid of that and just use CRYPTO_LIB_POLY1305 directly. Finally, make the fallback to the generic implementation use a default value instead of a select; this makes it consistent with how the arch-optimized code gets enabled and also with how CRYPTO_LIB_BLAKE2S_GENERIC gets enabled.

---
 arch/arm/crypto/Kconfig     |  2 +-
 arch/arm64/crypto/Kconfig   |  2 +-
 arch/mips/crypto/Kconfig    |  2 +-
 arch/powerpc/crypto/Kconfig |  2 +-
 arch/x86/crypto/Kconfig     |  2 +-
 crypto/Kconfig              |  2 +-
 lib/crypto/Kconfig          | 16 +++++-----------
 7 files changed, 11 insertions(+), 17 deletions(-)
arch/arm/crypto/Kconfig +1 -1
index 960602271443..e07ff8081da7 100644
@@ -46,12 +46,12 @@ config CRYPTO_NHPOLY1305_NEON
 	  Architecture: arm using:
 	  - NEON (Advanced SIMD) extensions
 
 config CRYPTO_POLY1305_ARM
 	tristate
+	default CRYPTO_LIB_POLY1305
 	select CRYPTO_ARCH_HAVE_LIB_POLY1305
-	default CRYPTO_LIB_POLY1305_INTERNAL
 
 config CRYPTO_BLAKE2S_ARM
 	bool "Hash functions: BLAKE2s"
 	select CRYPTO_ARCH_HAVE_LIB_BLAKE2S
 	help
arch/arm64/crypto/Kconfig +1 -1
index 8184da75b24f..c3322a0fc2f1 100644
@@ -26,12 +26,12 @@ config CRYPTO_NHPOLY1305_NEON
 	  - NEON (Advanced SIMD) extensions
 
 config CRYPTO_POLY1305_NEON
 	tristate
 	depends on KERNEL_MODE_NEON
+	default CRYPTO_LIB_POLY1305
 	select CRYPTO_ARCH_HAVE_LIB_POLY1305
-	default CRYPTO_LIB_POLY1305_INTERNAL
 
 config CRYPTO_SHA1_ARM64_CE
 	tristate "Hash functions: SHA-1 (ARMv8 Crypto Extensions)"
 	depends on CRYPTO && KERNEL_MODE_NEON
 	select CRYPTO_HASH
arch/mips/crypto/Kconfig +1 -1
index f1d61457518f..98c9a2afd676 100644
@@ -2,12 +2,12 @@
 
 menu "Accelerated Cryptographic Algorithms for CPU (mips)"
 
 config CRYPTO_POLY1305_MIPS
 	tristate
+	default CRYPTO_LIB_POLY1305
 	select CRYPTO_ARCH_HAVE_LIB_POLY1305
-	default CRYPTO_LIB_POLY1305_INTERNAL
 
 config CRYPTO_MD5_OCTEON
 	tristate "Digests: MD5 (OCTEON)"
 	depends on CRYPTO && CPU_CAVIUM_OCTEON
 	select CRYPTO_MD5
arch/powerpc/crypto/Kconfig +1 -1
index dd3bd22d8e20..3f3253215470 100644
@@ -100,13 +100,13 @@ config CRYPTO_CHACHA20_P10
 	select CRYPTO_ARCH_HAVE_LIB_CHACHA
 
 config CRYPTO_POLY1305_P10
 	tristate
 	depends on PPC64 && CPU_LITTLE_ENDIAN && VSX
+	default CRYPTO_LIB_POLY1305
 	select CRYPTO_ARCH_HAVE_LIB_POLY1305
 	select CRYPTO_LIB_POLY1305_GENERIC
-	default CRYPTO_LIB_POLY1305_INTERNAL
 
 config CRYPTO_DEV_VMX
         bool "Support for VMX cryptographic acceleration instructions"
         depends on CRYPTO && PPC64 && VSX
         help
arch/x86/crypto/Kconfig +1 -1
index 5b9d6dbe6185..6f4bcdf410d8 100644
@@ -397,12 +397,12 @@ config CRYPTO_POLYVAL_CLMUL_NI
 	  - CLMUL-NI (carry-less multiplication new instructions)
 
 config CRYPTO_POLY1305_X86_64
 	tristate
 	depends on 64BIT
+	default CRYPTO_LIB_POLY1305
 	select CRYPTO_ARCH_HAVE_LIB_POLY1305
-	default CRYPTO_LIB_POLY1305_INTERNAL
 
 config CRYPTO_SHA1_SSSE3
 	tristate "Hash functions: SHA-1 (SSSE3/AVX/AVX2/SHA-NI)"
 	depends on CRYPTO && 64BIT
 	select CRYPTO_SHA1
crypto/Kconfig +1 -1
index ed50d1b6f6f3..82c61c8e7235 100644
@@ -954,12 +954,12 @@ config CRYPTO_POLYVAL
 	  cryptographic hash function.
 
 config CRYPTO_POLY1305
 	tristate "Poly1305"
 	select CRYPTO_HASH
+	select CRYPTO_LIB_POLY1305
 	select CRYPTO_LIB_POLY1305_GENERIC
-	select CRYPTO_LIB_POLY1305_INTERNAL
 	help
 	  Poly1305 authenticator algorithm (RFC7539)
 
 	  Poly1305 is an authenticator algorithm designed by Daniel J. Bernstein.
 	  It is used for the ChaCha20-Poly1305 AEAD, specified in RFC7539 for use
lib/crypto/Kconfig +5 -11
index cc4c0ee04f98..e23280af302a 100644
@@ -112,25 +112,19 @@ config CRYPTO_ARCH_HAVE_LIB_POLY1305
 	  accelerated implementation of the Poly1305 library interface,
 	  either builtin or as a module.
 
 config CRYPTO_LIB_POLY1305_GENERIC
 	tristate
+	default CRYPTO_LIB_POLY1305 if !CRYPTO_ARCH_HAVE_LIB_POLY1305
 	help
-	  This symbol can be depended upon by arch implementations of the
-	  Poly1305 library interface that require the generic code as a
-	  fallback, e.g., for SIMD implementations. If no arch specific
-	  implementation is enabled, this implementation serves the users
-	  of CRYPTO_LIB_POLY1305.
-
-config CRYPTO_LIB_POLY1305_INTERNAL
-	tristate
-	select CRYPTO_LIB_POLY1305_GENERIC if CRYPTO_ARCH_HAVE_LIB_POLY1305=n
+	  This symbol can be selected by arch implementations of the Poly1305
+	  library interface that require the generic code as a fallback, e.g.,
+	  for SIMD implementations. If no arch specific implementation is
+	  enabled, this implementation serves the users of CRYPTO_LIB_POLY1305.
 
 config CRYPTO_LIB_POLY1305
 	tristate
-	select CRYPTO
-	select CRYPTO_LIB_POLY1305_INTERNAL
 	help
 	  Enable the Poly1305 library interface. This interface may be fulfilled
 	  by either the generic implementation or an arch-specific one, if one
 	  is available and enabled.
 
Signature · 1 line
2.49.0
maintainer
#2 lore raw

Re: [PATCH 01/15] crypto: arm - remove CRYPTO dependency of library functions

In reply to Eric Biggers
Quoted 13 lines · Eric Biggers
arch/arm/Kconfig +0 -0
index 25ed6f1a7c7a..86fcce738887 100644
@@ -1753,5 +1753,7 @@ config ARCH_HIBERNATION_POSSIBLE
       bool
       depends on MMU
       default y if ARCH_SUSPEND_POSSIBLE
 

endmenu

arch/arm/Kconfig +2 -0
+
+source "arch/arm/crypto/Kconfig"

...

crypto/Kconfig endmenu · line 1431

Quoted 13 lines
crypto/Kconfig +0 -0
index 9322e42e562d..cad71f32e1e3 100644
@@ -1424,13 +1424,10 @@ endmenu
 

config CRYPTO_HASH_INFO
bool

if !KMSAN # avoid false positives from assembly

crypto/Kconfig +0 -3
-if ARM
-source "arch/arm/crypto/Kconfig"
-endif

So this removes the KMSAN check. Is it still needed or not?

Cheers,

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
maintainer
#5 lore raw

Re: [PATCH 01/15] crypto: arm - remove CRYPTO dependency of library functions

In reply to Eric Biggers

Review

Quoted 5 lines · Eric Biggers

config CRYPTO_CURVE25519_NEON
tristate

(quoted diff) +1 -1
-       depends on KERNEL_MODE_NEON
+       depends on CRYPTO && KERNEL_MODE_NEON

Rather than adding CRYPTO to each symbol, how about grouping all the CRYPTO symbols together under one if statement?

Cheers,

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
author maintainer
#3 lore raw

Re: [PATCH 01/15] crypto: arm - remove CRYPTO dependency of library functions

In reply to Herbert Xu
Quoted 26 lines · Herbert Xu
Quoted 13 lines · Eric Biggers
arch/arm/Kconfig +0 -0
index 25ed6f1a7c7a..86fcce738887 100644
@@ -1753,5 +1753,7 @@ config ARCH_HIBERNATION_POSSIBLE
       bool
       depends on MMU
       default y if ARCH_SUSPEND_POSSIBLE
 

endmenu

arch/arm/Kconfig +2 -0
+
+source "arch/arm/crypto/Kconfig"

...

Quoted 9 lines
crypto/Kconfig +0 -0
index 9322e42e562d..cad71f32e1e3 100644
@@ -1424,13 +1424,10 @@ endmenu
 

config CRYPTO_HASH_INFO
bool

Quoted 7 lines

crypto/Kconfig endmenu · line 1431

Quoted 4 lines

if !KMSAN # avoid false positives from assembly

crypto/Kconfig +0 -3
-if ARM
-source "arch/arm/crypto/Kconfig"
-endif

So this removes the KMSAN check. Is it still needed or not?

Only x86 and s390 support KMSAN.

- Eric

author maintainer
#6 lore raw

Re: [PATCH 01/15] crypto: arm - remove CRYPTO dependency of library functions

In reply to Herbert Xu
Quoted 9 lines · Herbert Xu

Review

Quoted 5 lines · Eric Biggers

config CRYPTO_CURVE25519_NEON
tristate

(quoted diff) +1 -1
-       depends on KERNEL_MODE_NEON
+       depends on CRYPTO && KERNEL_MODE_NEON

Rather than adding CRYPTO to each symbol, how about grouping all the CRYPTO symbols together under one if statement?

I don't think that would be better. The 'if' would be up to 400 lines long, and it would be easy for people to miss the context when editing the file.

- Eric

maintainer
#7 lore raw

Re: [PATCH 01/15] crypto: arm - remove CRYPTO dependency of library functions

Quoted 3 lines · Eric Biggers

I don't think that would be better. The 'if' would be up to 400 lines long, and it would be easy for people to miss the context when editing the file.

We should separate the symbols for Crypto API options and the library options. If you're worried about people missing the if statement, how about splitting the file into two? One for Crypto API symbols and one for the library symbols.

In fact we could move the library files into a different directory, e.g., arch/x86/crypto/lib or arch/x86/lib/crypto.

Cheers,

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
maintainer
#4 lore raw

Re: [PATCH 01/15] crypto: arm - remove CRYPTO dependency of library functions

In reply to Eric Biggers
Quoted 2 lines · Eric Biggers

Only x86 and s390 support KMSAN.

OK that's subtle but I'm glad it's not an issue.

Thanks,

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
author maintainer
#8 lore raw

Re: [PATCH 01/15] crypto: arm - remove CRYPTO dependency of library functions

In reply to Herbert Xu
Quoted 5 lines · Herbert Xu
Quoted 3 lines · Eric Biggers

I don't think that would be better. The 'if' would be up to 400 lines long, and it would be easy for people to miss the context when editing the file.

Quoted 7 lines

We should separate the symbols for Crypto API options and the library options. If you're worried about people missing the if statement, how about splitting the file into two? One for Crypto API symbols and one for the library symbols.

In fact we could move the library files into a different directory, e.g., arch/x86/crypto/lib or arch/x86/lib/crypto.

arch/$ARCH/lib/crypto/ is the "right" way to do it, mirroring lib/crypto/. I was just hoping to avoid a 4-deep directory. But we can do it.

- Eric

maintainer
#9 lore raw

Re: [PATCH 01/15] crypto: arm - remove CRYPTO dependency of library functions

Quoted 3 lines · Eric Biggers

arch/$ARCH/lib/crypto/ is the "right" way to do it, mirroring lib/crypto/. I was just hoping to avoid a 4-deep directory. But we can do it.

You can do that in a follow-up, assuming nothing else pops for this series.

Cheers,

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
maintainer Acked-by on the v1 series
#27 lore raw
In reply to Eric Biggers
Quoted 21 lines · Eric Biggers

This series removes the unnecessary dependency of the ChaCha, Poly1305, and BLAKE2s library functions on the generic crypto infrastructure, i.e. CONFIG_CRYPTO. To do this, it moves arch/*/crypto/Kconfig from a submenu of crypto/Kconfig to a submenu of arch/*/Kconfig, then re-adds the CRYPTO dependency to the symbols that actually need it.

Patches 14-15 then simplify the ChaCha and Poly1305 symbols by removing the unneeded "internal" symbols.

Note that Curve25519 is still entangled. Later patches will fix that.

Eric Biggers (15):
crypto: arm - remove CRYPTO dependency of library functions
crypto: arm64 - drop redundant dependencies on ARM64
crypto: arm64 - remove CRYPTO dependency of library functions
crypto: loongarch - source arch/loongarch/crypto/Kconfig without
CRYPTO
crypto: mips - remove CRYPTO dependency of library functions
crypto: powerpc - drop redundant dependencies on PPC
crypto: powerpc - remove CRYPTO dependency of library functions

Quoted 9 lines

crypto: riscv - remove CRYPTO dependency of library functions
crypto: s390 - drop redundant dependencies on S390
crypto: s390 - remove CRYPTO dependency of library functions
crypto: sparc - source arch/sparc/crypto/Kconfig without CRYPTO
crypto: x86 - drop redundant dependencies on X86
crypto: x86 - remove CRYPTO dependency of library functions
crypto: lib/chacha - remove INTERNAL symbol and selection of CRYPTO
crypto: lib/poly1305 - remove INTERNAL symbol and selection of CRYPTO

This seems like a good idea.

author maintainer
#10 lore raw

Re: [PATCH 01/15] crypto: arm - remove CRYPTO dependency of library functions

In reply to Herbert Xu
Quoted 7 lines · Herbert Xu
Quoted 3 lines · Eric Biggers

arch/$ARCH/lib/crypto/ is the "right" way to do it, mirroring lib/crypto/. I was just hoping to avoid a 4-deep directory. But we can do it.

You can do that in a follow-up, assuming nothing else pops for this series.

Doing it as a follow-up when this series hasn't been merged yet would be kind of silly, since it would undo a lot of this series. I'll just send out a v2 of this series.

- Eric

maintainer Acked-by on v1 8/15
#19 lore raw

Re: [PATCH 08/15] crypto: riscv - remove CRYPTO dependency of library functions

In reply to Eric Biggers
Quoted 116 lines · On Thu, 17 Apr 2025 11:26:16 PDT (-0700), [email protected] wrote:

From: Eric Biggers <[email protected]>

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

---
 arch/riscv/Kconfig        |  2 ++
 arch/riscv/crypto/Kconfig | 12 ++++++------
 crypto/Kconfig            |  3 ---
 3 files changed, 8 insertions(+), 9 deletions(-)
arch/riscv/Kconfig +2 -0
index bbec87b79309..baa7b8d98ed8 100644
@@ -1349,8 +1349,10 @@ source "drivers/cpuidle/Kconfig"
 
 source "drivers/cpufreq/Kconfig"
 
 endmenu # "CPU Power Management"
 
+source "arch/riscv/crypto/Kconfig"
+
 source "arch/riscv/kvm/Kconfig"
 
 source "drivers/acpi/Kconfig"
arch/riscv/crypto/Kconfig +6 -6
index 27a1f26d41bd..08547694937c 100644
@@ -2,11 +2,11 @@
 
 menu "Accelerated Cryptographic Algorithms for CPU (riscv)"
 
 config CRYPTO_AES_RISCV64
 	tristate "Ciphers: AES, modes: ECB, CBC, CTS, CTR, XTS"
-	depends on 64BIT && RISCV_ISA_V && TOOLCHAIN_HAS_VECTOR_CRYPTO
+	depends on CRYPTO && 64BIT && RISCV_ISA_V && TOOLCHAIN_HAS_VECTOR_CRYPTO
 	select CRYPTO_ALGAPI
 	select CRYPTO_LIB_AES
 	select CRYPTO_SKCIPHER
 	help
 	  Block cipher: AES cipher algorithms
@@ -25,43 +25,43 @@ config CRYPTO_CHACHA_RISCV64
 	select CRYPTO_LIB_CHACHA_GENERIC
 	default CRYPTO_LIB_CHACHA_INTERNAL
 
 config CRYPTO_GHASH_RISCV64
 	tristate "Hash functions: GHASH"
-	depends on 64BIT && RISCV_ISA_V && TOOLCHAIN_HAS_VECTOR_CRYPTO
+	depends on CRYPTO && 64BIT && RISCV_ISA_V && TOOLCHAIN_HAS_VECTOR_CRYPTO
 	select CRYPTO_GCM
 	help
 	  GCM GHASH function (NIST SP 800-38D)
 
 	  Architecture: riscv64 using:
 	  - Zvkg vector crypto extension
 
 config CRYPTO_SHA256_RISCV64
 	tristate "Hash functions: SHA-224 and SHA-256"
-	depends on 64BIT && RISCV_ISA_V && TOOLCHAIN_HAS_VECTOR_CRYPTO
+	depends on CRYPTO && 64BIT && RISCV_ISA_V && TOOLCHAIN_HAS_VECTOR_CRYPTO
 	select CRYPTO_SHA256
 	help
 	  SHA-224 and SHA-256 secure hash algorithm (FIPS 180)
 
 	  Architecture: riscv64 using:
 	  - Zvknha or Zvknhb vector crypto extensions
 	  - Zvkb vector crypto extension
 
 config CRYPTO_SHA512_RISCV64
 	tristate "Hash functions: SHA-384 and SHA-512"
-	depends on 64BIT && RISCV_ISA_V && TOOLCHAIN_HAS_VECTOR_CRYPTO
+	depends on CRYPTO && 64BIT && RISCV_ISA_V && TOOLCHAIN_HAS_VECTOR_CRYPTO
 	select CRYPTO_SHA512
 	help
 	  SHA-384 and SHA-512 secure hash algorithm (FIPS 180)
 
 	  Architecture: riscv64 using:
 	  - Zvknhb vector crypto extension
 	  - Zvkb vector crypto extension
 
 config CRYPTO_SM3_RISCV64
 	tristate "Hash functions: SM3 (ShangMi 3)"
-	depends on 64BIT && RISCV_ISA_V && TOOLCHAIN_HAS_VECTOR_CRYPTO
+	depends on CRYPTO && 64BIT && RISCV_ISA_V && TOOLCHAIN_HAS_VECTOR_CRYPTO
 	select CRYPTO_HASH
 	select CRYPTO_LIB_SM3
 	help
 	  SM3 (ShangMi 3) secure hash function (OSCCA GM/T 0004-2012)
 
@@ -69,11 +69,11 @@ config CRYPTO_SM3_RISCV64
 	  - Zvksh vector crypto extension
 	  - Zvkb vector crypto extension
 
 config CRYPTO_SM4_RISCV64
 	tristate "Ciphers: SM4 (ShangMi 4)"
-	depends on 64BIT && RISCV_ISA_V && TOOLCHAIN_HAS_VECTOR_CRYPTO
+	depends on CRYPTO && 64BIT && RISCV_ISA_V && TOOLCHAIN_HAS_VECTOR_CRYPTO
 	select CRYPTO_ALGAPI
 	select CRYPTO_SM4
 	help
 	  SM4 block cipher algorithm (OSCCA GB/T 32907-2016,
 	  ISO/IEC 18033-3:2010/Amd 1:2021)
crypto/Kconfig +0 -0
index 2467dba73372..8c334c9f2081 100644
@@ -1424,13 +1424,10 @@ endmenu
 
 config CRYPTO_HASH_INFO
 	bool

crypto/Kconfig endmenu · line 1433

Quoted 10 lines
crypto/Kconfig +0 -3
 
 if !KMSAN # avoid false positives from assembly
-if RISCV
-source "arch/riscv/crypto/Kconfig"
-endif
 if S390
 source "arch/s390/crypto/Kconfig"
 endif
 if SPARC
 source "arch/sparc/crypto/Kconfig"

I'm assuming you want to take this with the rest, thanks!

maintainer
#11 lore raw

Re: [PATCH 01/15] crypto: arm - remove CRYPTO dependency of library functions

In reply to Eric Biggers
Quoted 4 lines · Eric Biggers

Doing it as a follow-up when this series hasn't been merged yet would be kind of silly, since it would undo a lot of this series. I'll just send out a v2 of this series.

OK that's fine too of course.

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt