]> git.ipfire.org Git - thirdparty/linux.git/commit
sample/tsm-mr: Use SHA-2 library APIs
authorEric Biggers <ebiggers@kernel.org>
Wed, 18 Mar 2026 16:42:33 +0000 (09:42 -0700)
committerEric Biggers <ebiggers@kernel.org>
Thu, 19 Mar 2026 17:57:15 +0000 (10:57 -0700)
commit645e64136b93e431a48f3b178fe7cf13737b10f6
treedcf9fd84627cc82386fb9c71a5d8874696c59b2f
parentc2db2288b8c3e2878cc37962375419cca8dfe3b6
sample/tsm-mr: Use SHA-2 library APIs

Given that tsm_mr_sample has a particular set of algorithms that it
wants, just use the library APIs for those algorithms rather than
crypto_shash.  This is more straightforward and more efficient.

This also fixes a bug where this module failed to build if it was
enabled without CRYPTO_HASH happening to be set elsewhere in the
kconfig.  (With the concurrent change to make TSM_MEASUREMENTS stop
selecting CRYPTO, this existing build error would have become easier to
encounter, as well.)  Also, even if it built, crypto_alloc_shash() could
fail at runtime due to the needed algorithms not being available.

The library functions simply use direct linking.  So if it builds, which
it will due to the kconfig options being selected, they are available.

Fixes: f6953f1f9ec4 ("tsm-mr: Add tsm-mr sample code")
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Dan Williams <dan.j.williams@intel.com>
Link: https://lore.kernel.org/r/20260318164233.19800-1-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
samples/Kconfig
samples/tsm-mr/tsm_mr_sample.c