From patchwork Thu Jan 21 03:13:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1429607 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=SCW1rlNv; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DLnbc2BjTz9sVX for ; Thu, 21 Jan 2021 14:16:12 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 91DE582AA7; Thu, 21 Jan 2021 04:14:00 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="SCW1rlNv"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id EDF8D82AA7; Thu, 21 Jan 2021 04:13:48 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 6544E82A3C for ; Thu, 21 Jan 2021 04:13:42 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-pl1-x631.google.com with SMTP id e9so502763plh.3 for ; Wed, 20 Jan 2021 19:13:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Shw50q6sTsOeTIllq4BqRBJxsck+JJyrI5TMEB5alIA=; b=SCW1rlNvfbtxYDZOWa8amphrjED0kPXEbAoVAPGQLbb1LIKqaKY0c4oXL6juypJG0E 3ex/NYy0zPHmtEBmQNCIjHq2Rih+f6+2VSKahwC3pZNIEVz/H0yM1dH58/fxM97iKs// oBjl6ajQfHPGqW5EFkQhJoc7TZXvOcoocKJIw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Shw50q6sTsOeTIllq4BqRBJxsck+JJyrI5TMEB5alIA=; b=Z9nZGu4bE7AcxYhynjcYGzyqkfXwo6en1AVZZ6K6bQzAxWvsuw8kXwuDUM7Ng7Bf/d r1ihgv688azmQunZHL4d26xzcKqPuGNKDUqrbRlCG7HXdLypSomk6XgpP9yxdR1ZEMup dLzXEmq4Zy/9iGoijJbk5kU879l0hTVDYEQSFfZ0qB3D1BThLAurBIAlLh2FQcfPbh/A J49jiC/C78J4DQo/p8RWQQX5pUyQbhsPi1xzp1c3CBl/x1Jd2GIrMaCJu95ymQkVkndt 8bUVMT2xoQL6ciNPglSKrOAS+4xvrpKLuhRpS2+PcKLz3F2y6BzfwAezJurS9jJ/DBot Jcpw== X-Gm-Message-State: AOAM530pWYgzEVGj8hsS/yhD6bNHjA0E2MrA9dV8umOFbOKaqd65u36j VukP8MPtrHDUAsUP5r1Wr+67b+3Xb8+mBgS7 X-Google-Smtp-Source: ABdhPJwZPETDj/p2HmQmlEYmdU1A6ds46DqEbq7B/o9oCcWxdIoDFJ216pW33b7CGqRCF92Nt4XYKQ== X-Received: by 2002:a17:90b:4c8c:: with SMTP id my12mr9015171pjb.29.1611198820817; Wed, 20 Jan 2021 19:13:40 -0800 (PST) Received: from sjg1.home ([2600:6c4c:507f:f8e5:0:ec6e:a61e:6ad]) by smtp.gmail.com with ESMTPSA id s65sm3802287pfc.95.2021.01.20.19.13.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Jan 2021 19:13:40 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass Subject: [PATCH v2 03/11] tpm: Add debugging of request in tpm_sendrecv_command() Date: Wed, 20 Jan 2021 20:13:23 -0700 Message-Id: <20210121031332.560433-4-sjg@chromium.org> X-Mailer: git-send-email 2.30.0.296.g2bfb1c46d8-goog In-Reply-To: <20210121031332.560433-1-sjg@chromium.org> References: <20210121031332.560433-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean The response is shown but not the request. Update the code to show both if debugging is enabled. Signed-off-by: Simon Glass --- (no changes since v1) 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;