From f4aab8258d77d3ee58567ce68cc42176088c527d Mon Sep 17 00:00:00 2001 From: Bret Barkelew Date: Thu, 1 Aug 2024 12:34:09 -0700 Subject: [PATCH] SecurityPkg: Make TPM2_Startup() return an error The TPM2_Startup() function is called in the Tcg2Pei driver to start the TPM. The function is expected to return an error if the TPM is not in the correct state. --- SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c b/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c index 5375b6dfea..771b7e604b 100644 --- a/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c +++ b/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c @@ -1204,6 +1204,11 @@ PeimEntryMA ( } if (EFI_ERROR (Status)) { + // MU_CHANGE_58957 + // MU_CHANGE [BEGIN] - Make sure that TPM2_Startup() can report an error. + DEBUG ((DEBUG_ERROR, "Tcg2Pei::%a - TPM failed Startup!\n", __func__)); + ASSERT_EFI_ERROR (Status); + // MU_CHANGE [END] goto Done; } } @@ -1236,6 +1241,10 @@ PeimEntryMA ( if (PcdGet8 (PcdTpm2SelfTestPolicy) == 1) { Status = Tpm2SelfTest (NO); if (EFI_ERROR (Status)) { + // MU_CHANGE_58957 + // MU_CHANGE [BEGIN] - Make sure that TPM2_Startup() can report an error. + DEBUG ((DEBUG_ERROR, "Tcg2Pei::%a - TPM failed Startup!\n", __func__)); + // MU_CHANGE [END] goto Done; } }