Re: [PATCH] macsec: fix crypto Kconfig dependency

From: Arnd Bergmann
Date: Mon Apr 18 2016 - 07:07:44 EST


On Monday 18 April 2016 18:43:36 Herbert Xu wrote:
>
> It's kind of silly really now that IPv4 selects CRYPTO which
> means that you can't really avoid seeing all those options which
> most users won't care about.

I had not noticed that IPv4 does it, but that is a good point.

We have had a couple of other subsystems with the issue (e.g. MFD),
and have turned around the logic in the end so the user-visible
options are always there and the subsystem core is selected by
all drivers that need it. We could do the same for crypto as below
(untested). I only select CRYPTO from ALGAPI2 there, which may be
wrong if some parts of crypto need the core but do not need algapi,
but it illustrates what we could do.

Arnd

diff --git a/crypto/Kconfig b/crypto/Kconfig
index 93a1fdc1feee..ed1bc0c49022 100644
--- a/crypto/Kconfig
+++ b/crypto/Kconfig
@@ -12,14 +12,12 @@ source "crypto/async_tx/Kconfig"
#
# Cryptographic API Configuration
#
-menuconfig CRYPTO
- tristate "Cryptographic API"
+config CRYPTO
+ tristate
help
This option provides the core Cryptographic API.

-if CRYPTO
-
-comment "Crypto core or helper"
+menu "Crypto core or helper"

config CRYPTO_FIPS
bool "FIPS 200 compliance"
@@ -39,6 +37,7 @@ config CRYPTO_ALGAPI

config CRYPTO_ALGAPI2
tristate
+ select CRYPTO

config CRYPTO_AEAD
tristate
@@ -1633,4 +1632,4 @@ source "drivers/crypto/Kconfig"
source crypto/asymmetric_keys/Kconfig
source certs/Kconfig

-endif # if CRYPTO
+endmenu