linux-integrity.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Jarkko Sakkinen" <jarkko@kernel.org>
To: "James Bottomley" <James.Bottomley@HansenPartnership.com>,
	<linux-integrity@vger.kernel.org>
Cc: <keyrings@vger.kernel.org>
Subject: Re: [PATCH 3/6] KEYS: trusted: add PCR policy to TPM2 keys
Date: Tue, 16 Jul 2024 15:01:06 +0300	[thread overview]
Message-ID: <D2QY44AS2NS4.3H7KQPHGYH8QW@kernel.org> (raw)
In-Reply-To: <20240524130459.21510-4-James.Bottomley@HansenPartnership.com>

On Fri May 24, 2024 at 4:04 PM EEST, James Bottomley wrote:
> This commit adds the ability to specify a PCR lock policy to TPM2
> keys.  There is a complexity in that keys that contain both a password
> (blobauth) and a PCR lock have to have two policy statements
> (POLICY_PCR and POLICY_AUTHVALUE).  The way to construct a pcrinfo
> statement for a key is simply to use the TPMS_PCR_SELECT structure to
> specify the PCRs and follow this by a hash of all their values in
> order of ascending PCR number.
>
> To construct a policy around the value of the resettable PCR 16 using
> the sha256 bank, first reset the pcr to zero giving a hash of all
      SHA-256                      PCR

> zeros as:
>
> 66687aadf862bd776c8fc18b8e9f8e20089714856ee233b3902a591d0d5f2925

Please also provide example how this kind of hash is constructed, and
no mention about trial and policy modes, which are essential in order
to understand what is going on here.

>
> Then the TPMS_PCR_SELECT value for sha256 bank PCR 16 is
>
> 000b03000001
>
> So create a new 32 byte key with a policy locking the key to this
> value of PCR 16 with a parent key of 81000001 would be:
>
> keyctl add trusted kmk "new 32 keyhandle=0x81000001 pcrinfo=000b0300000166687aadf862bd776c8fc18b8e9f8e20089714856ee233b3902a591d0d5f2925" @u

PCINFO=0x66687aadf862bd776c8fc18b8e9f8e20089714856ee233b3902a591d0d5f2925
HANDLE=0x81000001 
keyctl add trusted kmk "new 32 keyhandle=$HANDLE pcrinfo=$KEYINFO" @u

I won't look at the code this round because commit message is lacking
explanation what it does.

606 is a huge addition for single patch and requires belieable story
why it can't be smaller. I won't even try to understand all the changes
just looking at the code.

BR, Jarkko

  reply	other threads:[~2024-07-16 12:01 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-24 13:04 [PATCH 0/6] Add policy to sealed keys James Bottomley
2024-05-24 13:04 ` [PATCH 1/6] tpm: consolidate TPM to crypto hash algorithm conversion James Bottomley
2024-05-24 13:40   ` Jarkko Sakkinen
2024-05-24 13:52     ` Jarkko Sakkinen
2024-05-27  3:45   ` Ben Boeckel
2024-05-27 11:18     ` Jarkko Sakkinen
2024-07-16 11:13   ` Jarkko Sakkinen
2024-05-24 13:04 ` [PATCH 2/6] tpm: add policy sessions James Bottomley
2024-07-16 11:53   ` Jarkko Sakkinen
2024-07-16 14:07     ` Jarkko Sakkinen
2024-07-16 14:08       ` Jarkko Sakkinen
2024-07-16 14:12         ` Jarkko Sakkinen
2024-07-18  2:30       ` James Bottomley
2024-07-19 13:21         ` Jarkko Sakkinen
2024-07-19 13:26           ` Jarkko Sakkinen
2024-05-24 13:04 ` [PATCH 3/6] KEYS: trusted: add PCR policy to TPM2 keys James Bottomley
2024-07-16 12:01   ` Jarkko Sakkinen [this message]
2024-05-24 13:04 ` [PATCH 4/6] KEYS: trusted: add ability to specify arbitrary policy James Bottomley
2024-07-16 12:01   ` Jarkko Sakkinen
2024-05-24 13:04 ` [PATCH 5/6] KEYS: trusted: implement counter/timer policy James Bottomley
2024-07-16 12:03   ` Jarkko Sakkinen
2024-05-24 13:04 ` [PATCH 6/6] KEYS: trusted: add support for TPM keys with signed policy James Bottomley
2024-07-16 12:03   ` Jarkko Sakkinen
2024-05-24 13:24 ` [PATCH 0/6] Add policy to sealed keys Jarkko Sakkinen

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=D2QY44AS2NS4.3H7KQPHGYH8QW@kernel.org \
    --to=jarkko@kernel.org \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=keyrings@vger.kernel.org \
    --cc=linux-integrity@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).