tpm2-tools/backport-CVE-2024-29038.patch
cenhuilin 465397ad89 fix CVE-2024-29038 CVE-2024-29039
(cherry picked from commit 726694d50276ccb7a6802a9d9bde576a44a269a9)
2024-05-10 14:51:46 +08:00

31 lines
881 B
Diff

From c9d57cae9316ab22d37db87a123e9255bfd21112 Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Thu, 2 May 2024 09:53:57 +0800
Subject: [PATCH] init
---
tools/misc/tpm2_checkquote.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/tools/misc/tpm2_checkquote.c b/tools/misc/tpm2_checkquote.c
index ca78238..6d1a9f6 100644
--- a/tools/misc/tpm2_checkquote.c
+++ b/tools/misc/tpm2_checkquote.c
@@ -115,6 +115,13 @@ static bool verify(void) {
goto err;
}
+ // check magic
+ if (ctx.attest.magic != TPM2_GENERATED_VALUE) {
+ LOG_ERR("Bad magic, got: 0x%x, expected: 0x%x",
+ ctx.attest.magic, TPM2_GENERATED_VALUE);
+ return false;
+ }
+
// Also ensure digest from quote matches PCR digest
if (ctx.flags.pcr) {
if (!tpm2_util_verify_digests(&ctx.attest.attested.quote.pcrDigest,
--
2.23.0