Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

firmware_loader: rework crypto dependencies

The crypto dependencies for the firmwware loader are incomplete,
in particular a built-in FW_LOADER fails to link against a modular
crypto hash driver:

ld.lld: error: undefined symbol: crypto_alloc_shash
ld.lld: error: undefined symbol: crypto_shash_digest
ld.lld: error: undefined symbol: crypto_destroy_tfm
>>> referenced by main.c
>>> drivers/base/firmware_loader/main.o:(fw_log_firmware_info) in archive vmlinux.a

Rework this to use the usual 'select' from the driver module,
to respect the built-in vs module dependencies, and add a
more verbose crypto dependency to the debug option to prevent
configurations that lead to a link failure.

Fixes: 02fe26f25325 ("firmware_loader: Add debug message with checksum for FW file")
Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Acked-by: Herbert Xu <herbert@gondor.apana.org.au>
Acked-by: Luis Chamberlain <mcgrof@kernel.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20230414080329.76176-1-arnd@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Arnd Bergmann and committed by
Greg Kroah-Hartman
bedee105 495ff363

+3 -2
+3 -2
drivers/base/firmware_loader/Kconfig
··· 3 3 4 4 config FW_LOADER 5 5 tristate "Firmware loading facility" if EXPERT 6 + select CRYPTO_HASH if FW_LOADER_DEBUG 7 + select CRYPTO_SHA256 if FW_LOADER_DEBUG 6 8 default y 7 9 help 8 10 This enables the firmware loading facility in the kernel. The kernel ··· 28 26 29 27 config FW_LOADER_DEBUG 30 28 bool "Log filenames and checksums for loaded firmware" 29 + depends on CRYPTO = FW_LOADER || CRYPTO=y 31 30 depends on DYNAMIC_DEBUG 32 31 depends on FW_LOADER 33 - depends on CRYPTO 34 - depends on CRYPTO_SHA256 35 32 default FW_LOADER 36 33 help 37 34 Select this option to use dynamic debug to log firmware filenames and