[SeaBIOS] [PATCH 7/8] tpm: Merge tpm_log_event() and tpm_extend_acpi_log()

Kevin O'Connor kevin at koconnor.net
Mon Nov 23 02:02:37 CET 2015


Merge tpm_extend_acpi_log() and tpm_log_event().  Move error checking
and handling to callers.  Don't shutdown the TPM on a failure from the
16bit BIOS interface.

Signed-off-by: Kevin O'Connor <kevin at koconnor.net>
---
 src/tcgbios.c | 23 ++++++++---------------
 1 file changed, 8 insertions(+), 15 deletions(-)

diff --git a/src/tcgbios.c b/src/tcgbios.c
index 13393a2..16eb699 100644
--- a/src/tcgbios.c
+++ b/src/tcgbios.c
@@ -281,11 +281,14 @@ reset_acpi_log(void)
  *  Returns an error code in case of faiure, 0 in case of success
  */
 static u32
-tpm_extend_acpi_log(struct pcpes *pcpes)
+tpm_log_event(struct pcpes *pcpes)
 {
     dprintf(DEBUG_tcg, "TCGBIOS: LASA = %p, next entry = %p\n",
             tpm_state.log_area_start_address, tpm_state.log_area_next_entry);
 
+    if (pcpes->pcrindex >= 24)
+        return TCG_INVALID_INPUT_PARA;
+
     if (tpm_state.log_area_next_entry == NULL)
         return TCG_PC_LOGOVERFLOW;
 
@@ -467,26 +470,16 @@ tpm_extend(u8 *hash, u32 pcrindex)
 }
 
 static u32
-tpm_log_event(struct pcpes *pcpes)
+tpm_log_extend_event(struct pcpes *pcpes)
 {
-    if (pcpes->pcrindex >= 24)
-        return TCG_INVALID_INPUT_PARA;
-
     if (!has_working_tpm())
         return TCG_GENERAL_ERROR;
 
-    u32 rc = tpm_extend_acpi_log(pcpes);
-    if (rc)
-        tpm_set_failure();
-    return rc;
-}
-
-static u32
-tpm_log_extend_event(struct pcpes *pcpes)
-{
     u32 rc = tpm_log_event(pcpes);
-    if (rc)
+    if (rc) {
+        tpm_set_failure();
         return rc;
+    }
     return tpm_extend(pcpes->digest, pcpes->pcrindex);
 }
 
-- 
2.5.0




More information about the SeaBIOS mailing list