]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tpm2: replace magic number in hmac_sensitive initialization
authorDan Streetman <ddstreet@ieee.org>
Thu, 8 Jun 2023 18:06:46 +0000 (14:06 -0400)
committerDan Streetman <ddstreet@ieee.org>
Wed, 5 Jul 2023 21:33:55 +0000 (17:33 -0400)
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

index aaaff81309af03afa3d7c03d9d9e0df4599563df..fd645789f87213f438ad1bf0ab289354fd49514a 100644 (file)
@@ -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);