Skip to contentSkip to conversation

tsm-mr: fix sample dependencies

PATCH In review Arnd Bergmann 2 participants 2 messages Mar 18

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tsm-mr: fix sample dependencies

From: Arnd Bergmann <[email protected]>

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

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

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")
---
 samples/Kconfig | 2 ++
 1 file changed, 2 insertions(+)
samples/Kconfig +2 -0
index 5bc7c9e5a59e..730cc9f4197e 100644
@@ -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
Signature · 1 line
2.39.5
#1 lore raw
Quoted 31 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

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

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

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")
---
 samples/Kconfig | 2 ++
 1 file changed, 2 insertions(+)
samples/Kconfig +0 -0
index 5bc7c9e5a59e..730cc9f4197e 100644

samples/Kconfig config SAMPLE_TIMER · line 193

Quoted 8 lines
samples/Kconfig +2 -0
@@ -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/[email protected]/).
That patch fixes both problems.

- Eric