U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Ilias Apalodimas <ilias.apalodimas@linaro.org>
To: u-boot@lists.denx.de
Subject: [PATCH 07/11] tpm: Reduce duplication in a few functions
Date: Tue, 19 Jan 2021 10:22:44 +0200	[thread overview]
Message-ID: <YAaW1OH8KnwM8fAp@apalos.home> (raw)
In-Reply-To: <20210116215138.1218256-7-sjg@chromium.org>

Hi Simon, 

On Sat, Jan 16, 2021 at 02:51:34PM -0700, Simon Glass wrote:
> Update tpm2_clear() and tpm2_pcr_extend() so that the command size
> is not repeated twice. Add a small comment to the latter.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
> 
>  lib/tpm-v2.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/lib/tpm-v2.c b/lib/tpm-v2.c
> index 1f3deb06e48..b148081afd7 100644
> --- a/lib/tpm-v2.c
> +++ b/lib/tpm-v2.c
> @@ -47,9 +47,10 @@ u32 tpm2_self_test(struct udevice *dev, enum tpm2_yes_no full_test)
>  u32 tpm2_clear(struct udevice *dev, u32 handle, const char *pw,
>  	       const ssize_t pw_sz)
>  {
> +	uint offset = 27;

I know this was a pre-existing problem, but a comment explaining the 'magic'
offsets, or a link to the relevant documentation would come in handy.

>  	u8 command_v2[COMMAND_BUFFER_SIZE] = {
>  	 */

[...]

>  	ret = pack_byte_string(command_v2, sizeof(command_v2), "s",
>  			       offset, digest, digest_len);
> -	offset += digest_len;

This is removed because offset is not used after the calculation, right?

>  	if (ret)
>  		return TPM_LIB_ERROR;
>  
> -- 
> 2.30.0.284.gd98b1dd5eaa7-goog
> 

  reply	other threads:[~2021-01-19  8:22 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 ` [PATCH 03/11] tpm: Add debugging of request in tpm_sendrecv_command() Simon Glass
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 [this message]
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=YAaW1OH8KnwM8fAp@apalos.home \
    --to=ilias.apalodimas@linaro.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