mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: James Bottomley <James.Bottomley@HansenPartnership.com>
To: Jarkko Sakkinen <jarkko@kernel.org>,
	linux-integrity@vger.kernel.org,
	 Jonathan Corbet <corbet@lwn.net>,
	Peter Huewe <peterhuewe@gmx.de>, Jason Gunthorpe <jgg@ziepe.ca>
Cc: Roberto Sassu <roberto.sassu@huawei.com>,
	Mimi Zohar <zohar@linux.ibm.com>,
	 linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] tpm: Opt-in in disable PCR integrity protection
Date: Thu, 07 Nov 2024 08:20:53 -0500	[thread overview]
Message-ID: <76d9ae11c339b589a8ec94f010e7439b7ce7d283.camel@HansenPartnership.com> (raw)
In-Reply-To: <20241107095138.78209-1-jarkko@kernel.org>

On Thu, 2024-11-07 at 11:51 +0200, Jarkko Sakkinen wrote:
[...]
> +void tpm_buf_append_auth(struct tpm_chip *chip, struct tpm_buf *buf,
> +                        u8 attributes, u8 *passphrase, int
> passphrase_len)
> +{
> +       /* offset tells us where the sessions area begins */
> +       int offset = buf->handles * 4 + TPM_HEADER_SIZE;
> +       u32 len = 9 + passphrase_len;
> +
> +       if (tpm_buf_length(buf) != offset) {
> +               /* not the first session so update the existing
> length */
> +               len += get_unaligned_be32(&buf->data[offset]);
> +               put_unaligned_be32(len, &buf->data[offset]);
> +       } else {
> +               tpm_buf_append_u32(buf, len);
> +       }
> +       /* auth handle */
> +       tpm_buf_append_u32(buf, TPM2_RS_PW);
> +       /* nonce */
> +       tpm_buf_append_u16(buf, 0);
> +       /* attributes */
> +       tpm_buf_append_u8(buf, 0);
> +       /* passphrase */
> +       tpm_buf_append_u16(buf, passphrase_len);
> +       tpm_buf_append(buf, passphrase, passphrase_len);
> +}
> +

The rest of the code looks fine, but if you're going to extract this as
a separate function instead of doing the open coded struct
tpm2_null_auth that was there originally, you should probably extract
and use the tpm2_buf_append_auth() function in trusted_tpm2.c

James


  reply	other threads:[~2024-11-07 13:20 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-07  9:51 Jarkko Sakkinen
2024-11-07 13:20 ` James Bottomley [this message]
2024-11-07 13:49   ` Jarkko Sakkinen
2024-11-07 13:52     ` James Bottomley
2024-11-11 19:53       ` Mimi Zohar
2024-11-11 20:12         ` James Bottomley
2024-11-12 17:57         ` Jarkko Sakkinen
2024-11-12 20:00           ` Mimi Zohar
2024-11-07 13:44 ` Mimi Zohar
2024-11-07 13:47   ` Jarkko Sakkinen
2024-11-07 14:00     ` Mimi Zohar
2024-11-07 16:45       ` Jarkko Sakkinen
2024-11-07 13:46 ` kernel test robot
2024-11-07 20:43 ` kernel test robot

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=76d9ae11c339b589a8ec94f010e7439b7ce7d283.camel@HansenPartnership.com \
    --to=james.bottomley@hansenpartnership.com \
    --cc=corbet@lwn.net \
    --cc=jarkko@kernel.org \
    --cc=jgg@ziepe.ca \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterhuewe@gmx.de \
    --cc=roberto.sassu@huawei.com \
    --cc=zohar@linux.ibm.com \
    /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

all inboxes | Powered by JetHome®