diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2015-11-22 11:00:06 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2015-11-22 12:14:28 -0500 |
commit | f4820ac1269b3c855edc0d5139d4b4c319ef0e69 (patch) | |
tree | c4edf8680437a650174a81e19553f04e7d47f87c /src/tcgbios.c | |
parent | f51c50a16720feeaa7ddcbfbc798e2da20918239 (diff) | |
download | seabios-f4820ac1269b3c855edc0d5139d4b4c319ef0e69.tar.gz |
tpm: Move error recovery from tpm_extend_acpi_log() to only caller
Move tpm state checking and error handling from tpm_extend_acpi_log()
to its only caller hash_log_event(). This makes tpm_extend_acpi_log()
specific to just ACPI table handling.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/tcgbios.c')
-rw-r--r-- | src/tcgbios.c | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/src/tcgbios.c b/src/tcgbios.c index 7877840c..88652fec 100644 --- a/src/tcgbios.c +++ b/src/tcgbios.c @@ -280,8 +280,6 @@ reset_acpi_log(void) tpm_state.entry_count = 0; } -static void tpm_set_failure(void); - /* * Extend the ACPI log with the given entry by copying the * entry data into the log. @@ -301,27 +299,17 @@ tpm_extend_acpi_log(struct pcpes *pcpes, { u32 size; - if (!has_working_tpm()) - return TCG_GENERAL_ERROR; - dprintf(DEBUG_tcg, "TCGBIOS: LASA = %p, next entry = %p\n", tpm_state.log_area_start_address, tpm_state.log_area_next_entry); - if (tpm_state.log_area_next_entry == NULL) { - - tpm_set_failure(); - + if (tpm_state.log_area_next_entry == NULL) return TCG_PC_LOGOVERFLOW; - } size = offsetof(struct pcpes, event) + event_length; if ((tpm_state.log_area_next_entry + size - tpm_state.log_area_start_address) > tpm_state.log_area_minimum_length) { dprintf(DEBUG_tcg, "TCGBIOS: LOG OVERFLOW: size = %d\n", size); - - tpm_set_failure(); - return TCG_PC_LOGOVERFLOW; } @@ -548,7 +536,13 @@ hash_log_event(const void *hashdata, u32 hashdata_length, return rc; } - return tpm_extend_acpi_log(pcpes, event, event_length, entry_count); + if (!has_working_tpm()) + return TCG_GENERAL_ERROR; + + rc = tpm_extend_acpi_log(pcpes, event, event_length, entry_count); + if (rc) + tpm_set_failure(); + return rc; } static u32 |