All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: U-Boot Mailing List <u-boot@lists.denx.de>
Subject: Re: [PATCH 3/8] tpm: Correct the permissions command in TPMv1
Date: Sun, 14 Aug 2022 17:29:31 -0600	[thread overview]
Message-ID: <CAPnjgZ0S1XBURN0uZ3FktjKO0kxxRgCMXsCMptb7_=AuBiC2-Q@mail.gmail.com> (raw)
In-Reply-To: <Yp8P6Ozq5+HVLcRp@hera>

Hi Ilias,

On Tue, 7 Jun 2022 at 02:44, Ilias Apalodimas
<ilias.apalodimas@linaro.org> wrote:
>
> Hi Simon,
>
> On Mon, Feb 28, 2022 at 05:11:20PM -0700, Simon Glass wrote:
> > The offset here is incorrect. Fix it.
> >
> > Signed-off-by: Simon Glass <sjg@chromium.org>
> > ---
> >
> >  lib/tpm-v1.c | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/lib/tpm-v1.c b/lib/tpm-v1.c
> > index 22a769c587..d0e3ab1b21 100644
> > --- a/lib/tpm-v1.c
> > +++ b/lib/tpm-v1.c
> > @@ -456,12 +456,13 @@ u32 tpm1_get_permissions(struct udevice *dev, u32 index, u32 *perm)
> >               0x0, 0x0, 0x0, 0x4,
> >       };
> >       const size_t index_offset = 18;
> > -     const size_t perm_offset = 60;
> > +     const size_t perm_offset = 74;
>
> This is fine, but I hate all these magic values sprinkled around the TPM
> APIs.  Starting with this patch can we do the right thing and at lease have
> those in a #define with a names that makes some sense?

Er, isn't this what I am doing? See the const values which have
sensible names. It really doesn't make sense to put them in a #define
in a distant header file since we don't use these in most commands.
There are just local to the function and determined by the format used
with pack_byte_string(), etc. (see below).

>
> >       u8 buf[COMMAND_BUFFER_SIZE], response[COMMAND_BUFFER_SIZE];
> >       size_t response_length = sizeof(response);
> >       u32 err;
> >
> > -     if (pack_byte_string(buf, sizeof(buf), "d", 0, command, sizeof(command),
> > +     if (pack_byte_string(buf, sizeof(buf), "sd",
> > +                          0, command, sizeof(command),
> >                            index_offset, index))
> >               return TPM_LIB_ERROR;
> >       err = tpm_sendrecv_command(dev, buf, response, &response_length);
> > --
> > 2.35.1.574.g5d30c73bfb-goog
> >
>
> Thanks
> /Ilias

Regards,
SImon

  reply	other threads:[~2022-08-14 23:30 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-01  0:11 [PATCH 0/8] tpm: Various minor fixes and enhancements Simon Glass
2022-03-01  0:11 ` [PATCH 1/8] tpm: Export the TPM-version functions Simon Glass
2022-06-07  8:28   ` Ilias Apalodimas
2022-03-01  0:11 ` [PATCH 2/8] tpm: Require a digest source when extending the PCR Simon Glass
2022-06-07  8:42   ` Ilias Apalodimas
2022-08-14 23:29     ` Simon Glass
2022-03-01  0:11 ` [PATCH 3/8] tpm: Correct the permissions command in TPMv1 Simon Glass
2022-06-07  8:44   ` Ilias Apalodimas
2022-08-14 23:29     ` Simon Glass [this message]
2022-03-01  0:11 ` [PATCH 4/8] tpm: Correct the define-space command in TPMv2 Simon Glass
2022-06-07  8:46   ` Ilias Apalodimas
2022-08-14 23:29     ` Simon Glass
2022-03-01  0:11 ` [PATCH 5/8] tpm: sandbox: Allow init of TPM in a different phase Simon Glass
2022-06-07  8:48   ` Ilias Apalodimas
2022-03-01  0:11 ` [PATCH 6/8] tpm: Allow reporting the internal state Simon Glass
2022-03-01  0:11 ` [PATCH 7/8] tpm: Implement state command for Cr50 Simon Glass
2022-06-07  8:54   ` Ilias Apalodimas
2022-08-14 23:29     ` Simon Glass
2022-03-01  0:11 ` [PATCH 8/8] tpm: Allow commiting non-volatile data 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='CAPnjgZ0S1XBURN0uZ3FktjKO0kxxRgCMXsCMptb7_=AuBiC2-Q@mail.gmail.com' \
    --to=sjg@chromium.org \
    --cc=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.