summaryrefslogtreecommitdiff
path: root/lib/tpm-common.c
diff options
context:
space:
mode:
authorMiquel Raynal <miquel.raynal@bootlin.com>2018-05-15 12:57:10 +0300
committerTom Rini <trini@konsulko.com>2018-05-26 03:12:56 +0300
commitaa643013e47b3527b819d1bbdfd1eb679daf5f27 (patch)
tree750129d3622a2609278b4a8d532a4a2ea661caf2 /lib/tpm-common.c
parentf6872816ce07b6b26c9b6a4b1ba9206805d9321d (diff)
downloadu-boot-aa643013e47b3527b819d1bbdfd1eb679daf5f27.tar.xz
tpm: add possible traces to analyze buffers returned by the TPM
When debugging, it is welcome to get more information about what the TPM returns. Add the possibility to print the packets received to show their exact content. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'lib/tpm-common.c')
-rw-r--r--lib/tpm-common.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/tpm-common.c b/lib/tpm-common.c
index 4c2b9393c4..33fa85926c 100644
--- a/lib/tpm-common.c
+++ b/lib/tpm-common.c
@@ -153,6 +153,7 @@ u32 tpm_sendrecv_command(const void *command, void *response, size_t *size_ptr)
int err, ret;
u8 response_buffer[COMMAND_BUFFER_SIZE];
size_t response_length;
+ int i;
if (response) {
response_length = *size_ptr;
@@ -172,7 +173,14 @@ u32 tpm_sendrecv_command(const void *command, void *response, size_t *size_ptr)
if (size_ptr)
*size_ptr = response_length;
- return tpm_return_code(response);
+ ret = tpm_return_code(response);
+
+ log(LOGC_NONE, LOGL_DEBUG, "TPM response [ret:%d]: ", ret);
+ for (i = 0; i < response_length; i++)
+ log(LOGC_NONE, LOGL_DEBUG, "%02x ", ((u8 *)response)[i]);
+ log(LOGC_NONE, LOGL_DEBUG, "\n");
+
+ return ret;
}
int tpm_init(void)