aboutsummaryrefslogtreecommitdiff
path: root/src/tcgbios.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2015-11-22 11:28:14 -0500
committerKevin O'Connor <kevin@koconnor.net>2015-11-22 19:23:11 -0500
commita617542063071da7de3908b85df5ca8b4a4378fd (patch)
treebfd228e90f68ead4c245b689dc6ba6dbdd58bfcf /src/tcgbios.c
parent7ea191bb4127052bfd5088584f0a93dd20d8d558 (diff)
downloadseabios-hppa-a617542063071da7de3908b85df5ca8b4a4378fd.zip
seabios-hppa-a617542063071da7de3908b85df5ca8b4a4378fd.tar.gz
seabios-hppa-a617542063071da7de3908b85df5ca8b4a4378fd.tar.bz2
tpm: Change tpm_add_measurement() to tpm_add_action()
Make the only caller of tpm_add_measurement() with EV_SEPARATOR directly call tpm_add_measurement_to_log(). Rename to tpm_add_action() and change all callers with EV_ACTION to use this function. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/tcgbios.c')
-rw-r--r--src/tcgbios.c55
1 files changed, 13 insertions, 42 deletions
diff --git a/src/tcgbios.c b/src/tcgbios.c
index 1f73593..01fddcc 100644
--- a/src/tcgbios.c
+++ b/src/tcgbios.c
@@ -55,8 +55,6 @@ static const u8 GetCapability_Durations[] = {
0x00, 0x00, 0x01, 0x20
};
-static u8 evt_separator[] = {0xff,0xff,0xff,0xff};
-
/****************************************************************
* TPM state tracking
@@ -594,40 +592,13 @@ tpm_add_measurement_to_log(u32 pcrindex, u32 event_type,
* Setup and Measurements
****************************************************************/
-/*
- * Add a measurement to the list of measurements
- * pcrIndex : PCR to be extended
- * event_type : type of event; specs section on 'Event Types'
- * data : additional parameter; used as parameter for
- * 'action index'
- */
+// Add an EV_ACTION measurement to the list of measurements
static u32
-tpm_add_measurement(u32 pcrIndex,
- u16 event_type,
- const char *string)
+tpm_add_action(u32 pcrIndex, const char *string)
{
- u32 rc;
- u32 len;
-
- switch (event_type) {
- case EV_SEPARATOR:
- len = sizeof(evt_separator);
- rc = tpm_add_measurement_to_log(pcrIndex, event_type,
- (char *)NULL, 0,
- (u8 *)evt_separator, len);
- break;
-
- case EV_ACTION:
- rc = tpm_add_measurement_to_log(pcrIndex, event_type,
- string, strlen(string),
- (u8 *)string, strlen(string));
- break;
-
- default:
- rc = TCG_INVALID_INPUT_PARA;
- }
-
- return rc;
+ u32 len = strlen(string);
+ return tpm_add_measurement_to_log(pcrIndex, EV_ACTION,
+ string, len, (u8 *)string, len);
}
static u32
@@ -639,8 +610,7 @@ tpm_calling_int19h(void)
if (!has_working_tpm())
return TCG_GENERAL_ERROR;
- return tpm_add_measurement(4, EV_ACTION,
- "Calling INT 19h");
+ return tpm_add_action(4, "Calling INT 19h");
}
/*
@@ -658,8 +628,12 @@ tpm_add_event_separators(void)
if (!has_working_tpm())
return TCG_GENERAL_ERROR;
+ static const u8 evt_separator[] = {0xff,0xff,0xff,0xff};
while (pcrIndex <= 7) {
- rc = tpm_add_measurement(pcrIndex, EV_SEPARATOR, NULL);
+ rc = tpm_add_measurement_to_log(pcrIndex, EV_SEPARATOR,
+ NULL, 0,
+ (u8 *)evt_separator,
+ sizeof(evt_separator));
if (rc)
break;
pcrIndex ++;
@@ -680,8 +654,7 @@ tpm_start_option_rom_scan(void)
if (!has_working_tpm())
return TCG_GENERAL_ERROR;
- return tpm_add_measurement(2, EV_ACTION,
- "Start Option ROM Scan");
+ return tpm_add_action(2, "Start Option ROM Scan");
}
static u32
@@ -925,9 +898,7 @@ tpm_add_bootdevice(u32 bootcd, u32 bootdrv)
string = "Booting from CD ROM device";
}
- return tpm_add_measurement_to_log(4, EV_ACTION,
- string, strlen(string),
- (u8 *)string, strlen(string));
+ return tpm_add_action(4, string);
}
u32