U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: u-boot@lists.denx.de
Subject: [PATCH 03/11] tpm: Add debugging of request in tpm_sendrecv_command()
Date: Sat, 16 Jan 2021 14:51:30 -0700	[thread overview]
Message-ID: <20210116215138.1218256-4-sjg@chromium.org> (raw)
In-Reply-To: <20210116215138.1218256-1-sjg@chromium.org>

The response is shown but not the request. Update the code to show both
if debugging is enabled.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 lib/tpm-common.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/lib/tpm-common.c b/lib/tpm-common.c
index e4af87f76aa..0255d3bd9cf 100644
--- a/lib/tpm-common.c
+++ b/lib/tpm-common.c
@@ -165,7 +165,7 @@ u32 tpm_sendrecv_command(struct udevice *dev, const void *command,
 	int err, ret;
 	u8 response_buffer[COMMAND_BUFFER_SIZE];
 	size_t response_length;
-	int i;
+	int i, size;
 
 	if (response) {
 		response_length = *size_ptr;
@@ -174,8 +174,13 @@ u32 tpm_sendrecv_command(struct udevice *dev, const void *command,
 		response_length = sizeof(response_buffer);
 	}
 
-	err = tpm_xfer(dev, command, tpm_command_size(command),
-		       response, &response_length);
+	size = tpm_command_size(command);
+	log_debug("TPM request [size:%d]: ", size);
+	for (i = 0; i < size; i++)
+		log_debug("%02x ", ((u8 *)command)[i]);
+	log_debug("\n");
+
+	err = tpm_xfer(dev, command, size, response, &response_length);
 
 	if (err < 0)
 		return err;
-- 
2.30.0.284.gd98b1dd5eaa7-goog

  parent reply	other threads:[~2021-01-16 21:51 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-16 21:51 [PATCH 00/11] tpm: Support using TPM1 and TPM2 from a single API Simon Glass
2021-01-16 21:51 ` [PATCH 01/11] tpm: Don't include cr50 in TPL/SPL Simon Glass
2021-01-16 21:51 ` [PATCH 02/11] tpm: Use logging in the uclass Simon Glass
2021-01-16 21:51 ` Simon Glass [this message]
2021-01-16 21:51 ` [PATCH 04/11] tpm: Add an API that can support v1.2 and v2 Simon Glass
2021-01-16 21:51 ` [PATCH 05/11] tpm: Switch TPMv1 over to use the new API Simon Glass
2021-01-16 21:51 ` [PATCH 06/11] tpm: Add a basic API implementation for TPMv2 Simon Glass
2021-01-16 21:51 ` [PATCH 07/11] tpm: Reduce duplication in a few functions Simon Glass
2021-01-19  8:22   ` Ilias Apalodimas
2021-01-16 21:51 ` [PATCH 08/11] tpm: Add an implementation of define_space Simon Glass
2021-01-19  8:24   ` Ilias Apalodimas
2021-01-23 15:37     ` Simon Glass
2021-01-16 21:51 ` [PATCH 09/11] tpm: Add TPM2 support for read/write values Simon Glass
2021-01-16 21:51 ` [PATCH 10/11] tpm: Add TPM2 support for write_lock Simon Glass
2021-01-16 21:51 ` [PATCH 11/11] tpm: Allow disabling platform hierarchy with TPM2 Simon Glass

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210116215138.1218256-4-sjg@chromium.org \
    --to=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox