summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
authorLuigi Semenzato <semenzato@chromium.org>2013-01-11 15:50:39 -0800
committerChromeBot <chrome-bot@google.com>2013-01-11 18:15:14 -0800
commit3428b4bcd99a6d2e9f8b3e1bdf800d943fbe78c3 (patch)
tree3270eaffc59874e813f195f026a1147ef8acd718 /firmware
parent17f8d341099120da78a6ca71165834eefb0960ed (diff)
downloadvboot-3428b4bcd99a6d2e9f8b3e1bdf800d943fbe78c3.tar.gz
Make tpmc able to send and receive raw datagrams.
This is immediately needed to debug a Parrot TPM problems, but we've had similar situation in the past and probably will again in the future. BUG=chromium-os:37819 TEST=manually tested with a couple of different packets, and error inputs BRANCH=none Change-Id: Id7f66bdbdfe5887fa49cd62af4a9b807fa3d9a89 Reviewed-on: https://gerrit.chromium.org/gerrit/41166 Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Queue: Luigi Semenzato <semenzato@chromium.org> Tested-by: Luigi Semenzato <semenzato@chromium.org>
Diffstat (limited to 'firmware')
-rw-r--r--firmware/include/tlcl.h13
-rw-r--r--firmware/lib/tpm_lite/tlcl.c9
2 files changed, 20 insertions, 2 deletions
diff --git a/firmware/include/tlcl.h b/firmware/include/tlcl.h
index 682bc86b..cd82fdca 100644
--- a/firmware/include/tlcl.h
+++ b/firmware/include/tlcl.h
@@ -33,6 +33,19 @@ void TlclLog(char* format, ...);
*/
void TlclSetLogLevel(int level);
+/* Low-level operations */
+
+/* Performs a raw TPM request/response transaction.
+ */
+uint32_t TlclSendReceive(const uint8_t* request, uint8_t* response,
+ int max_length);
+
+/* Returns the size of a TPM request or response packet.
+ */
+int TlclPacketSize(const uint8_t* packet);
+
+/* Commands */
+
/* Sends a TPM_Startup(ST_CLEAR). The TPM error code is returned (0
* for success).
*/
diff --git a/firmware/lib/tpm_lite/tlcl.c b/firmware/lib/tpm_lite/tlcl.c
index 9a0801f5..332fd019 100644
--- a/firmware/lib/tpm_lite/tlcl.c
+++ b/firmware/lib/tpm_lite/tlcl.c
@@ -33,6 +33,11 @@ POSSIBLY_UNUSED static INLINE int TpmCommandSize(const uint8_t* buffer) {
return (int) size;
}
+/* Gets the size field of a TPM request or response. */
+int TlclPacketSize(const uint8_t* packet) {
+ return TpmCommandSize(packet);
+}
+
/* Gets the code field of a TPM command. */
static INLINE int TpmCommandCode(const uint8_t* buffer) {
uint32_t code;
@@ -93,8 +98,8 @@ static uint32_t TlclSendReceiveNoRetry(const uint8_t* request,
/* Sends a TPM command and gets a response. Returns 0 if success or the TPM
* error code if error. In the firmware, waits for the self test to complete
* if needed. In the host, reports the first error without retries. */
-static uint32_t TlclSendReceive(const uint8_t* request, uint8_t* response,
- int max_length) {
+uint32_t TlclSendReceive(const uint8_t* request, uint8_t* response,
+ int max_length) {
uint32_t result = TlclSendReceiveNoRetry(request, response, max_length);
/* When compiling for the firmware, hide command failures due to the self
* test not having run or completed. */