2021-02-27 03:36:01

by Julian Braha

[permalink] [raw]
Subject: [PATCH] drivers: firmware: efi: fix Kconfig dependency on CRYPTO

When EFI_EMBEDDED_FIRMWARE is enabled, and CRYPTO is not enabled,
Kbuild gives the following warning:

WARNING: unmet direct dependencies detected for CRYPTO_LIB_SHA256
Depends on [n]: CRYPTO [=n]
Selected by [y]:
- EFI_EMBEDDED_FIRMWARE [=y] && EFI [=y]

This is because EFI_EMBEDDED_FIRMWARE selects CRYPTO_LIB_SHA256
without selecting or depending on CRYPTO, despite CRYPTO_LIB_SHA256
depending on CRYPTO.

Signed-off-by: Julian Braha <[email protected]>
---
drivers/firmware/efi/Kconfig | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/firmware/efi/Kconfig b/drivers/firmware/efi/Kconfig
index 2c3dac5ecb36..f914da9845ac 100644
--- a/drivers/firmware/efi/Kconfig
+++ b/drivers/firmware/efi/Kconfig
@@ -248,6 +248,7 @@ endmenu
config EFI_EMBEDDED_FIRMWARE
bool
depends on EFI
+ select CRYPTO
select CRYPTO_LIB_SHA256

config UEFI_CPER
--
2.27.0


2021-02-28 14:38:49

by Ard Biesheuvel

[permalink] [raw]
Subject: Re: [PATCH] drivers: firmware: efi: fix Kconfig dependency on CRYPTO

On Sat, 27 Feb 2021 at 04:29, Julian Braha <[email protected]> wrote:
>
> When EFI_EMBEDDED_FIRMWARE is enabled, and CRYPTO is not enabled,
> Kbuild gives the following warning:
>
> WARNING: unmet direct dependencies detected for CRYPTO_LIB_SHA256
> Depends on [n]: CRYPTO [=n]
> Selected by [y]:
> - EFI_EMBEDDED_FIRMWARE [=y] && EFI [=y]
>
> This is because EFI_EMBEDDED_FIRMWARE selects CRYPTO_LIB_SHA256
> without selecting or depending on CRYPTO, despite CRYPTO_LIB_SHA256
> depending on CRYPTO.
>
> Signed-off-by: Julian Braha <[email protected]>

Could you try the below instead? CRYPTO_LIB_SHA256 should not depend
on CRYPTO in the first place, we should fix that if we can

diff --git a/crypto/Kconfig b/crypto/Kconfig
index a367fcfeb5d4..77e6bc6df0ee 100644
--- a/crypto/Kconfig
+++ b/crypto/Kconfig
@@ -1936,9 +1936,10 @@ config CRYPTO_STATS
config CRYPTO_HASH_INFO
bool

-source "lib/crypto/Kconfig"
source "drivers/crypto/Kconfig"
source "crypto/asymmetric_keys/Kconfig"
source "certs/Kconfig"

endif # if CRYPTO
+
+source "lib/crypto/Kconfig"


> ---
> drivers/firmware/efi/Kconfig | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/firmware/efi/Kconfig b/drivers/firmware/efi/Kconfig
> index 2c3dac5ecb36..f914da9845ac 100644
> --- a/drivers/firmware/efi/Kconfig
> +++ b/drivers/firmware/efi/Kconfig
> @@ -248,6 +248,7 @@ endmenu
> config EFI_EMBEDDED_FIRMWARE
> bool
> depends on EFI
> + select CRYPTO
> select CRYPTO_LIB_SHA256
>
> config UEFI_CPER
> --
> 2.27.0
>

2021-02-28 22:43:38

by Julian Braha

[permalink] [raw]
Subject: Re: [PATCH] drivers: firmware: efi: fix Kconfig dependency on CRYPTO

On Sunday, February 28, 2021 9:30:29 AM EST you wrote:
> On Sat, 27 Feb 2021 at 04:29, Julian Braha <[email protected]> wrote:
> >
> > When EFI_EMBEDDED_FIRMWARE is enabled, and CRYPTO is not enabled,
> > Kbuild gives the following warning:
> >
> > WARNING: unmet direct dependencies detected for CRYPTO_LIB_SHA256
> > Depends on [n]: CRYPTO [=n]
> > Selected by [y]:
> > - EFI_EMBEDDED_FIRMWARE [=y] && EFI [=y]
> >
> > This is because EFI_EMBEDDED_FIRMWARE selects CRYPTO_LIB_SHA256
> > without selecting or depending on CRYPTO, despite CRYPTO_LIB_SHA256
> > depending on CRYPTO.
> >
> > Signed-off-by: Julian Braha <[email protected]>
>
> Could you try the below instead? CRYPTO_LIB_SHA256 should not depend
> on CRYPTO in the first place, we should fix that if we can
>
> diff --git a/crypto/Kconfig b/crypto/Kconfig
> index a367fcfeb5d4..77e6bc6df0ee 100644
> --- a/crypto/Kconfig
> +++ b/crypto/Kconfig
> @@ -1936,9 +1936,10 @@ config CRYPTO_STATS
> config CRYPTO_HASH_INFO
> bool
>
> -source "lib/crypto/Kconfig"
> source "drivers/crypto/Kconfig"
> source "crypto/asymmetric_keys/Kconfig"
> source "certs/Kconfig"
>
> endif # if CRYPTO
> +
> +source "lib/crypto/Kconfig"
>
>
> > ---
> > drivers/firmware/efi/Kconfig | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/firmware/efi/Kconfig b/drivers/firmware/efi/Kconfig
> > index 2c3dac5ecb36..f914da9845ac 100644
> > --- a/drivers/firmware/efi/Kconfig
> > +++ b/drivers/firmware/efi/Kconfig
> > @@ -248,6 +248,7 @@ endmenu
> > config EFI_EMBEDDED_FIRMWARE
> > bool
> > depends on EFI
> > + select CRYPTO
> > select CRYPTO_LIB_SHA256
> >
> > config UEFI_CPER
> > --
> > 2.27.0
> >
>

Hi Ard, this solution works fine, and doesn't seem to introduce
any new issues with unmet dependencies.

- Julian Braha