[SeaBIOS] [PATCH 4/6] tpm: clean up parameters to build_and_send_cmd
Stefan Berger
stefanb at linux.vnet.ibm.com
Wed Jun 10 01:56:31 CEST 2015
Clean up the parameters to the build_and_send_cmd function call.
Use the sizeof() on the preceding buffer parameter. If the buffer
is NULL, we pass 0.
Signed-off-by: Stefan Berger <stefanb at linux.vnet.ibm.com>
---
src/tcgbios.c | 24 ++++++++++--------------
1 file changed, 10 insertions(+), 14 deletions(-)
diff --git a/src/tcgbios.c b/src/tcgbios.c
index 6c1a14f..13b3df3 100644
--- a/src/tcgbios.c
+++ b/src/tcgbios.c
@@ -381,8 +381,7 @@ determine_timeouts(void)
rc = build_and_send_cmd(0, TPM_ORD_GetCapability,
GetCapability_Timeouts,
sizeof(GetCapability_Timeouts),
- (u8 *)&timeouts,
- sizeof(struct tpm_res_getcap_timeouts),
+ (u8 *)&timeouts, sizeof(timeouts),
&returnCode, TPM_DURATION_TYPE_SHORT);
dprintf(DEBUG_tcg, "TCGBIOS: Return code from TPM_GetCapability(Timeouts)"
@@ -394,8 +393,7 @@ determine_timeouts(void)
rc = build_and_send_cmd(0, TPM_ORD_GetCapability,
GetCapability_Durations,
sizeof(GetCapability_Durations),
- (u8 *)&durations,
- sizeof(struct tpm_res_getcap_durations),
+ (u8 *)&durations, sizeof(durations),
&returnCode, TPM_DURATION_TYPE_SHORT);
dprintf(DEBUG_tcg, "TCGBIOS: Return code from TPM_GetCapability(Durations)"
@@ -448,7 +446,7 @@ tpm_startup(void)
dprintf(DEBUG_tcg, "TCGBIOS: Starting with TPM_Startup(ST_CLEAR)\n");
rc = build_and_send_cmd(0, TPM_ORD_Startup,
Startup_ST_CLEAR, sizeof(Startup_ST_CLEAR),
- NULL, 10, &returnCode, TPM_DURATION_TYPE_SHORT);
+ NULL, 0, &returnCode, TPM_DURATION_TYPE_SHORT);
dprintf(DEBUG_tcg, "Return code from TPM_Startup = 0x%08x\n",
returnCode);
@@ -465,7 +463,7 @@ tpm_startup(void)
goto err_exit;
rc = build_and_send_cmd(0, TPM_ORD_SelfTestFull, NULL, 0,
- NULL, 10, &returnCode, TPM_DURATION_TYPE_LONG);
+ NULL, 0, &returnCode, TPM_DURATION_TYPE_LONG);
dprintf(DEBUG_tcg, "Return code from TPM_SelfTestFull = 0x%08x\n",
returnCode);
@@ -474,7 +472,7 @@ tpm_startup(void)
goto err_exit;
rc = build_and_send_cmd(3, TSC_ORD_ResetEstablishmentBit, NULL, 0,
- NULL, 10, &returnCode, TPM_DURATION_TYPE_SHORT);
+ NULL, 0, &returnCode, TPM_DURATION_TYPE_SHORT);
dprintf(DEBUG_tcg, "Return code from TSC_ResetEstablishmentBit = 0x%08x\n",
returnCode);
@@ -535,14 +533,14 @@ tpm_leave_bios(void)
rc = build_and_send_cmd(0, TPM_ORD_PhysicalPresence,
PhysicalPresence_CMD_ENABLE,
sizeof(PhysicalPresence_CMD_ENABLE),
- NULL, 10, &returnCode, TPM_DURATION_TYPE_SHORT);
+ NULL, 0, &returnCode, TPM_DURATION_TYPE_SHORT);
if (rc || returnCode)
goto err_exit;
rc = build_and_send_cmd(0, TPM_ORD_PhysicalPresence,
PhysicalPresence_NOT_PRESENT_LOCK,
sizeof(PhysicalPresence_NOT_PRESENT_LOCK),
- NULL, 10, &returnCode, TPM_DURATION_TYPE_SHORT);
+ NULL, 0, &returnCode, TPM_DURATION_TYPE_SHORT);
if (rc || returnCode)
goto err_exit;
@@ -621,8 +619,7 @@ tpm_sha1_calc(const u8 *data, u32 length, u8 *hash)
rc = build_and_send_cmd(0, TPM_ORD_SHA1Start,
NULL, 0,
- (u8 *)&start,
- sizeof(struct tpm_res_sha1start),
+ (u8 *)&start, sizeof(start),
&returnCode, TPM_DURATION_TYPE_SHORT);
if (rc || returnCode)
@@ -653,8 +650,7 @@ tpm_sha1_calc(const u8 *data, u32 length, u8 *hash)
rc = build_and_send_cmd_od(0, TPM_ORD_SHA1Complete,
(u8 *)&numbytes_no, sizeof(numbytes_no),
- (u8 *)&complete,
- sizeof(struct tpm_res_sha1complete),
+ (u8 *)&complete, sizeof(complete),
&returnCode,
&data[offset], rest, TPM_DURATION_TYPE_SHORT);
@@ -1472,7 +1468,7 @@ tpm_s3_resume(void)
rc = build_and_send_cmd(0, TPM_ORD_Startup,
Startup_ST_STATE, sizeof(Startup_ST_STATE),
- NULL, 10, &returnCode, TPM_DURATION_TYPE_SHORT);
+ NULL, 0, &returnCode, TPM_DURATION_TYPE_SHORT);
dprintf(DEBUG_tcg, "TCGBIOS: ReturnCode from TPM_Startup = 0x%08x\n",
returnCode);
--
1.9.3
More information about the SeaBIOS
mailing list