vboot: Convert response_length from uint32_t to size_t in VbExTpmSendReceive

Length arguments for VbExTpmSendReceive have type uint32_t but it calls function
which expects size_t. This change converts uint32_t to size_t on call and
size_t to uint32_t on return.

BUG=None
BRANCH=None
TEST=Booted Nyan Big to Linux

Original-Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Original-Change-Id: I1971488baae2d060c0cddec7749461c91602a4f9
Original-Reviewed-on: https://chromium-review.googlesource.com/198016
(cherry picked from commit 6830747eb47568f2a2b494624522d37d8945c030)
Signed-off-by: Marc Jones <marc.jones@se-eng.com>

Change-Id: I20741759e7bbd60dd7044c532287d6b55047e19a
Reviewed-on: http://review.coreboot.org/7894
Tested-by: build bot (Jenkins)
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
This commit is contained in:
Daisuke Nojiri 2014-05-02 10:36:43 -07:00 committed by Marc Jones
parent 704c006479
commit afde961adf
1 changed files with 6 additions and 2 deletions

View File

@ -225,9 +225,13 @@ VbError_t VbExTpmOpen(void)
VbError_t VbExTpmSendReceive(const uint8_t *request, uint32_t request_length, VbError_t VbExTpmSendReceive(const uint8_t *request, uint32_t request_length,
uint8_t *response, uint32_t *response_length) uint8_t *response, uint32_t *response_length)
{ {
if (gcontext->tis_sendrecv(request, request_length, size_t len = *response_length;
response, response_length)) if (gcontext->tis_sendrecv(request, request_length, response, &len))
return VBERROR_UNKNOWN; return VBERROR_UNKNOWN;
/* check 64->32bit overflow and (re)check response buffer overflow */
if (len > *response_length)
return VBERROR_UNKNOWN;
*response_length = len;
return VBERROR_SUCCESS; return VBERROR_SUCCESS;
} }