Re: [PATCH] tsm-mr: fix sample dependencies
From: Eric Biggers
Date: Wed Mar 18 2026 - 12:58:01 EST
On Wed, Mar 18, 2026 at 11:51:55AM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@xxxxxxxx>
>
> The tsm sample fails to link when crypto support is in a loadable module:
>
> ld.lld-22: error: undefined symbol: crypto_alloc_shash
> ld.lld-22: error: undefined symbol: crypto_shash_tfm_digest
> ld.lld-22: error: undefined symbol: crypto_destroy_tfm
> ld.lld-22: error: undefined symbol: crypto_shash_init
> ld.lld-22: error: undefined symbol: crypto_shash_finup
> >>> referenced by tsm_mr_sample.c
> >>> samples/tsm-mr/tsm_mr_sample.o:(sample_report_extend_mr) in archive vmlinux.a
>
> This used to be handled indirectly by CONFIG_TSM_MEASUREMENTS forcing
> the crypto code to be built-in, but that was changed because TSM
> itself does not require it.
>
> Move the select into the Kconfig option that controls the sample
> instead.
>
> Fixes: f6953f1f9ec4 ("tsm-mr: Add tsm-mr sample code")
> Fixes: 44a3873df811 ("coco/guest: Remove unneeded selection of CRYPTO")
> Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
> ---
> samples/Kconfig | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/samples/Kconfig b/samples/Kconfig
> index 5bc7c9e5a59e..730cc9f4197e 100644
> --- a/samples/Kconfig
> +++ b/samples/Kconfig
> @@ -186,6 +186,8 @@ config SAMPLE_TIMER
>
> config SAMPLE_TSM_MR
> tristate "TSM measurement sample"
> + select CRYPTO
> + select CRYPTO_HASH
> select TSM_MEASUREMENTS
> select VIRT_DRIVERS
> help
Thanks. If we go with this, I can take it through libcrypto-next, given
that that's where "coco/guest: Remove unneeded selection of CRYPTO" is.
However, note that this fix doesn't select the crypto algorithms the
module actually uses. So it doesn't completely fix it either, and we'd
at least need an additional fix to actually select the algorithms.
I suggest that we instead convert this module to use the SHA-2 library
APIs
(https://lore.kernel.org/linux-crypto/20260318164233.19800-1-ebiggers@xxxxxxxxxx/).
That patch fixes both problems.
- Eric