From 180444b8851a8654771361b1494b5db286d8724e Mon Sep 17 00:00:00 2001 From: Dan Streetman Date: Thu, 8 Jun 2023 14:06:46 -0400 Subject: [PATCH] tpm2: replace magic number in hmac_sensitive initialization Instead of setting hmac_sensitive.sensitive.data.size to '32' use the actual hash size as set in the hmac_template. --- 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 aaaff81309..fd645789f8 100644 --- a/src/shared/tpm2-util.c +++ b/src/shared/tpm2-util.c @@ -2973,7 +2973,7 @@ int tpm2_seal(const char *device, TPM2B_SENSITIVE_CREATE hmac_sensitive = { .size = sizeof(hmac_sensitive.sensitive), - .sensitive.data.size = 32, + .sensitive.data.size = hmac_template.publicArea.unique.keyedHash.size, }; CLEANUP_ERASE(hmac_sensitive); -- 2.25.1