From 954b95e77ef0a857a0b5272e3e6c0e5318dc1208 Mon Sep 17 00:00:00 2001 From: Tim Harvey Date: Sat, 25 May 2024 13:00:48 -0700 Subject: tpm-v2: add support for mapping algorithm names to algos replace tpm2_supported_algorithms with an array of structures relating algorithm names, to TCG id's, digest length and mask values. While at it fix the tpm2_algorithm_to_mask to return the proper value. Cc: Eddie James Cc: Ilias Apalodimas Fixes: 97707f12fdab ("tpm: Support boot measurements") Signed-off-by: Tim Harvey Tested-by: Ilias Apalodimas Reviewed-by: Ilias Apalodimas Signed-off-by: Ilias Apalodimas --- lib/efi_loader/efi_tcg2.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/efi_loader') diff --git a/lib/efi_loader/efi_tcg2.c b/lib/efi_loader/efi_tcg2.c index b07e0099c27..945aafb847d 100644 --- a/lib/efi_loader/efi_tcg2.c +++ b/lib/efi_loader/efi_tcg2.c @@ -414,10 +414,10 @@ static efi_status_t tcg2_hash_pe_image(void *efi, u64 efi_size, } digest_list->count = 0; - for (i = 0; i < ARRAY_SIZE(tpm2_supported_algorithms); i++) { - u16 hash_alg = tpm2_supported_algorithms[i]; + for (i = 0; i < ARRAY_SIZE(hash_algo_list); i++) { + u16 hash_alg = hash_algo_list[i].hash_alg; - if (!(active & tpm2_algorithm_to_mask(hash_alg))) + if (!(active & hash_algo_list[i].hash_mask)) continue; switch (hash_alg) { case TPM2_ALG_SHA1: -- cgit v1.3.1