summaryrefslogtreecommitdiff
path: root/firmware/lib/tpm_lite
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2011-07-01 16:12:47 -0700
committerRandall Spangler <rspangler@chromium.org>2011-07-08 13:31:36 -0700
commit1b1998dff0002f20b3f27a21e6e79d8951e64684 (patch)
treefec838ef7d0867dc021087308c57b8b9cd1197b1 /firmware/lib/tpm_lite
parente49e8af65fce38da7a308305566f8a14f102254a (diff)
downloadvboot-1b1998dff0002f20b3f27a21e6e79d8951e64684.tar.gz
Vboot wrapper initial implementation
Patch 1: Initial change Patch 2: Fix comment in vboot_struct.h Patch 3: Revert files unintentionally reverted Patch 4: (rebase) Patch 5: (rebase) Patch 6: Revert files unintentionally reverted (again) Patch 7: Fix mocked tlcl for ARM build BUG=chromium-os:17010 TEST=make && make runtests; works on H2C; emerge-tegra2_seaboard chromeos-bootimage compiles Change-Id: I6e5ce72d41b9297c07a3f330a881eba68cfabee2 Reviewed-on: http://gerrit.chromium.org/gerrit/3593 Reviewed-by: Randall Spangler <rspangler@chromium.org> Tested-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'firmware/lib/tpm_lite')
-rw-r--r--firmware/lib/tpm_lite/mocked_tlcl.c5
-rw-r--r--firmware/lib/tpm_lite/tlcl.c12
2 files changed, 12 insertions, 5 deletions
diff --git a/firmware/lib/tpm_lite/mocked_tlcl.c b/firmware/lib/tpm_lite/mocked_tlcl.c
index 6253105d..790274f5 100644
--- a/firmware/lib/tpm_lite/mocked_tlcl.c
+++ b/firmware/lib/tpm_lite/mocked_tlcl.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010-2011 The Chromium OS Authors. All rights reserved.
+/* Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -6,9 +6,10 @@
#include "tlcl.h"
#include "tlcl_internal.h"
#include "utility.h"
+#include "vboot_api.h"
uint32_t TlclLibInit(void) {
- return TlclStubInit();
+ return VbExTpmInit();
}
uint32_t TlclStartup(void) {
diff --git a/firmware/lib/tpm_lite/tlcl.c b/firmware/lib/tpm_lite/tlcl.c
index 5c623b6f..fc820b55 100644
--- a/firmware/lib/tpm_lite/tlcl.c
+++ b/firmware/lib/tpm_lite/tlcl.c
@@ -50,6 +50,8 @@ static INLINE int TpmReturnCode(const uint8_t* buffer) {
*/
static uint32_t TlclSendReceiveNoRetry(const uint8_t* request,
uint8_t* response, int max_length) {
+
+ uint32_t response_length = max_length;
uint32_t result;
#ifdef EXTRA_LOGGING
@@ -59,8 +61,8 @@ static uint32_t TlclSendReceiveNoRetry(const uint8_t* request,
request[6], request[7], request[8], request[9]));
#endif
- result = TlclStubSendReceive(request, TpmCommandSize(request),
- response, max_length);
+ result = VbExTpmSendReceive(request, TpmCommandSize(request),
+ response, &response_length);
if (0 != result) {
/* Communication with TPM failed, so response is garbage */
VBDEBUG(("TPM: command 0x%x send/receive failed: 0x%x\n",
@@ -70,6 +72,10 @@ static uint32_t TlclSendReceiveNoRetry(const uint8_t* request,
/* Otherwise, use the result code from the response */
result = TpmReturnCode(response);
+ /* TODO: add paranoia about returned response_length vs. max_length
+ * (and possibly expected length from the response header). See
+ * crosbug.com/17017 */
+
#ifdef EXTRA_LOGGING
VBDEBUG(("TPM: response: %x%x %x%x%x%x %x%x%x%x\n",
response[0], response[1],
@@ -127,7 +133,7 @@ static uint32_t Send(const uint8_t* command) {
/* Exported functions. */
uint32_t TlclLibInit(void) {
- return TlclStubInit();
+ return VbExTpmInit();
}
uint32_t TlclStartup(void) {