[PATCH v2 12/12] wireguard: kconfig: Simplify crypto kconfig selections

Eric Biggers posted 12 patches 2 days, 18 hours ago
[PATCH v2 12/12] wireguard: kconfig: Simplify crypto kconfig selections
Posted by Eric Biggers 2 days, 18 hours ago
Simplify the kconfig entry for WIREGUARD:

- Drop the selections of the arch-optimized ChaCha20, Poly1305, BLAKE2s,
  and Curve25519 code.  These options no longer exist, as lib/crypto/
  now enables the arch-optimized code automatically.

- Drop the selection of CRYPTO.  This was needed only to make the
  arch-optimized options visible.  lib/crypto/ now handles these options
  internally, without any dependency on CRYPTO.

- Drop the dependency on !KMSAN.  This was needed only to avoid
  selecting arch-optimized code that isn't compatible with KMSAN.
  lib/crypto/ now handles the !KMSAN dependencies internally.

- Add a selection of CRYPTO_LIB_UTILS, since WireGuard directly calls
  crypto_memneq().  This gets selected indirectly by
  CRYPTO_LIB_CURVE25519 and CRYPTO_LIB_CHACHA20POLY1305 anyway, but it's
  best to make this dependency explicit.

Signed-off-by: Eric Biggers <ebiggers@kernel.org>
---
 drivers/net/Kconfig | 15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)

diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index b29628d46be9b..ac12eaf11755d 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -74,28 +74,15 @@ config DUMMY
 
 config WIREGUARD
 	tristate "WireGuard secure network tunnel"
 	depends on NET && INET
 	depends on IPV6 || !IPV6
-	depends on !KMSAN # KMSAN doesn't support the crypto configs below
 	select NET_UDP_TUNNEL
 	select DST_CACHE
-	select CRYPTO
 	select CRYPTO_LIB_CURVE25519
 	select CRYPTO_LIB_CHACHA20POLY1305
-	select CRYPTO_CHACHA20_X86_64 if X86 && 64BIT
-	select CRYPTO_POLY1305_X86_64 if X86 && 64BIT
-	select CRYPTO_BLAKE2S_X86 if X86 && 64BIT
-	select CRYPTO_CURVE25519_X86 if X86 && 64BIT
-	select CRYPTO_CHACHA20_NEON if ARM || (ARM64 && KERNEL_MODE_NEON)
-	select CRYPTO_POLY1305_NEON if ARM64 && KERNEL_MODE_NEON
-	select CRYPTO_POLY1305_ARM if ARM
-	select CRYPTO_BLAKE2S_ARM if ARM
-	select CRYPTO_CURVE25519_NEON if ARM && KERNEL_MODE_NEON
-	select CRYPTO_CHACHA_MIPS if CPU_MIPS32_R2
-	select CRYPTO_POLY1305_MIPS if MIPS
-	select CRYPTO_CHACHA_S390 if S390
+	select CRYPTO_LIB_UTILS
 	help
 	  WireGuard is a secure, fast, and easy to use replacement for IPSec
 	  that uses modern cryptography and clever networking tricks. It's
 	  designed to be fairly general purpose and abstract enough to fit most
 	  use cases, while at the same time remaining extremely simple to
-- 
2.50.1
Re: [PATCH v2 12/12] wireguard: kconfig: Simplify crypto kconfig selections
Posted by Jason A. Donenfeld 23 hours ago
Hi Eric,

Just a small nit -- would you commit this with the subject line all
lower case, like the other wireguard commits?

By the way, I have been reading every single one of your patches. It
didn't seem like it'd be useful for me to respond endlessly with
Acked-by/Reviewed-by, so I haven't. But I have quite actively been
looking through these series. Thanks for doing these cleanups and
reorganizations. This patch here especially is quite the relief...

Jason
Re: [PATCH v2 12/12] wireguard: kconfig: Simplify crypto kconfig selections
Posted by Eric Biggers 23 hours ago
On Mon, Sep 08, 2025 at 06:35:04PM +0200, Jason A. Donenfeld wrote:
> Hi Eric,
> 
> Just a small nit -- would you commit this with the subject line all
> lower case, like the other wireguard commits?

Done.

> By the way, I have been reading every single one of your patches. It
> didn't seem like it'd be useful for me to respond endlessly with
> Acked-by/Reviewed-by, so I haven't. But I have quite actively been
> looking through these series. Thanks for doing these cleanups and
> reorganizations. This patch here especially is quite the relief...

Thanks!  I think Acks/Reviews would still be helpful, as it shows that
someone else really read the patches.  Maybe you'd at least like to send
those for the cleanups for the algorithms used by WireGuard?

- Eric
Re: [PATCH v2 12/12] wireguard: kconfig: Simplify crypto kconfig selections
Posted by Jason A. Donenfeld 23 hours ago
On Mon, Sep 8, 2025 at 6:48 PM Eric Biggers <ebiggers@kernel.org> wrote:
>
> On Mon, Sep 08, 2025 at 06:35:04PM +0200, Jason A. Donenfeld wrote:
> > Hi Eric,
> >
> > Just a small nit -- would you commit this with the subject line all
> > lower case, like the other wireguard commits?
>
> Done.
>
> > By the way, I have been reading every single one of your patches. It
> > didn't seem like it'd be useful for me to respond endlessly with
> > Acked-by/Reviewed-by, so I haven't. But I have quite actively been
> > looking through these series. Thanks for doing these cleanups and
> > reorganizations. This patch here especially is quite the relief...
>
> Thanks!  I think Acks/Reviews would still be helpful, as it shows that
> someone else really read the patches.  Maybe you'd at least like to send
> those for the cleanups for the algorithms used by WireGuard?

I can do it for everything I read, I suppose. I care about a lot more
than just wg, anyhow.

Jason