]> xenbits.xensource.com Git - seabios.git/commitdiff
tpm: Merge tpm_log_event() and tpm_extend_acpi_log()
authorKevin O'Connor <kevin@koconnor.net>
Sun, 22 Nov 2015 23:51:31 +0000 (18:51 -0500)
committerKevin O'Connor <kevin@koconnor.net>
Tue, 24 Nov 2015 03:54:33 +0000 (22:54 -0500)
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@koconnor.net>
src/tcgbios.c

index e5cb9eb7cd89e1b5603d10b43e18f05d974fac47..704993f78fa9202e7e2431d811c2748c61255b80 100644 (file)
@@ -280,7 +280,7 @@ 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, const void *event)
+tpm_log_event(struct pcpes *pcpes, const void *event)
 {
     dprintf(DEBUG_tcg, "TCGBIOS: LASA = %p, next entry = %p\n",
             tpm_state.log_area_start_address, tpm_state.log_area_next_entry);
@@ -468,26 +468,19 @@ tpm_extend(u8 *hash, u32 pcrindex)
 }
 
 static u32
-tpm_log_event(struct pcpes *pcpes, const void *event)
+tpm_log_extend_event(struct pcpes *pcpes, const void *event)
 {
-    if (pcpes->pcrindex >= 24)
-        return TCG_INVALID_INPUT_PARA;
-
     if (!has_working_tpm())
         return TCG_GENERAL_ERROR;
 
-    u32 rc = tpm_extend_acpi_log(pcpes, event);
-    if (rc)
-        tpm_set_failure();
-    return rc;
-}
+    if (pcpes->pcrindex >= 24)
+        return TCG_INVALID_INPUT_PARA;
 
-static u32
-tpm_log_extend_event(struct pcpes *pcpes, const void *event)
-{
     u32 rc = tpm_log_event(pcpes, event);
-    if (rc)
+    if (rc) {
+        tpm_set_failure();
         return rc;
+    }
     return tpm_extend(pcpes->digest, pcpes->pcrindex);
 }