tpm: Don't replay an EventLog if tcg2_log_parse() fails
authorIlias Apalodimas <ilias.apalodimas@linaro.org>
Tue, 24 Dec 2024 16:01:12 +0000 (08:01 -0800)
committerIlias Apalodimas <ilias.apalodimas@linaro.org>
Tue, 7 Jan 2025 13:45:52 +0000 (15:45 +0200)
commit3dbd84cb10aa64478e7ce9d3ee32ce1f44c169f6
treee6030a0ba7b49a90db97df57699f4504e91bb4b5
parent05834d4b83f5987f158d7893a9f79706b6ff7045
tpm: Don't replay an EventLog if tcg2_log_parse() fails

We used to stop replaying an EventLog if parsing failed, but that got
lost in commit 97707f12fdab ("tpm: Support boot measurements").

When an EventLog is passed yo us from a previous bootloader, we want to
validate it as much as we can and make sure the defined PCR banks of
the log exist in our TPM and firmware so we can replay it if needed or
use it as-in, in case the PCRs are already extended.

So let's add the checks back and while at it simplify the logic of
rejecting an EventLog.

Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
lib/tpm_tcg2.c