You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
1.0 KiB
27 lines
1.0 KiB
6 months ago
|
From 4f87f34d6e8cf2fbbb5899bfd6ae459b5f8d2f09 Mon Sep 17 00:00:00 2001
|
||
|
From: Dan Streetman <ddstreet@ieee.org>
|
||
|
Date: Mon, 21 Aug 2023 17:37:40 -0400
|
||
|
Subject: [PATCH] tpm2: check pcr value hash != 0 before looking up hash
|
||
|
algorithm name
|
||
|
|
||
|
(cherry picked from commit 8e757259c3f491841a6c5aa853f2cfce41e95b2e)
|
||
|
|
||
|
Related: RHEL-16182
|
||
|
---
|
||
|
src/shared/tpm2-util.c | 2 +-
|
||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||
|
|
||
|
diff --git a/src/shared/tpm2-util.c b/src/shared/tpm2-util.c
|
||
|
index 02ea6a61f9..d0217e4655 100644
|
||
|
--- a/src/shared/tpm2-util.c
|
||
|
+++ b/src/shared/tpm2-util.c
|
||
|
@@ -1758,7 +1758,7 @@ char *tpm2_pcr_value_to_string(const Tpm2PCRValue *pcr_value) {
|
||
|
if (asprintf(&index, "%u", pcr_value->index) < 0)
|
||
|
return NULL;
|
||
|
|
||
|
- const char *hash = tpm2_hash_alg_to_string(pcr_value->hash);
|
||
|
+ const char *hash = pcr_value->hash > 0 ? tpm2_hash_alg_to_string(pcr_value->hash) : NULL;
|
||
|
|
||
|
if (hash && pcr_value->value.size > 0) {
|
||
|
value = hexmem(pcr_value->value.buffer, pcr_value->value.size);
|