Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(460)

Unified Diff: lib/chromeos/tlcl_stub.c

Issue 6683023: Add Infineon v05 TPM driver (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/u-boot-next.git@chromeos-v2010.09
Patch Set: Fix nits Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/tpm.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/chromeos/tlcl_stub.c
diff --git a/lib/chromeos/tlcl_stub.c b/lib/chromeos/tlcl_stub.c
index c2136456a549b0de64ad5269f68de398634ea162..edc63bab0f817fdd2d539fc21af48e7b352635b4 100644
--- a/lib/chromeos/tlcl_stub.c
+++ b/lib/chromeos/tlcl_stub.c
@@ -18,19 +18,34 @@
uint32_t TlclStubInit(void)
{
#ifdef CONFIG_HARDWARE_TPM
- return tpm_init();
-#else
- return TPM_SUCCESS;
+ int ret = tis_init();
+ if (ret)
+ return TPM_E_IOERROR;
+ /* tpm-lite lib doesn't call TlclOpenDevice after TlclStubInit */
+ ret = tis_open();
+ if (ret)
+ return TPM_E_IOERROR;
#endif
+ return TPM_SUCCESS;
}
uint32_t TlclCloseDevice(void)
{
+#ifdef CONFIG_HARDWARE_TPM
+ int ret = tis_close();
+ if (ret)
+ return TPM_E_IOERROR;
+#endif
return TPM_SUCCESS;
}
uint32_t TlclOpenDevice(void)
{
+#ifdef CONFIG_HARDWARE_TPM
+ int ret = tis_open();
+ if (ret)
+ return TPM_E_IOERROR;
+#endif
return TPM_SUCCESS;
}
@@ -38,16 +53,12 @@ uint32_t TlclStubSendReceive(const uint8_t* request, int request_length,
uint8_t* response, int max_length)
{
#ifdef CONFIG_HARDWARE_TPM
- int ret_code;
- ret_code = tpm_send(request, request_length);
- if (ret_code)
- return TPM_E_IOERROR;
- ret_code = tpm_receive(response, max_length);
- if (ret_code)
+ int ret;
+ size_t recv_len = (size_t) max_length;
+ ret= tis_sendrecv(request, request_length, response, &recv_len);
+ if (ret)
return TPM_E_IOERROR;
- return TPM_SUCCESS;
-#else
- return TPM_SUCCESS;
#endif
+ return TPM_SUCCESS;
}
« no previous file with comments | « include/tpm.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698