From: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
To: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: linux-integrity@vger.kernel.org, Mimi Zohar <zohar@linux.ibm.com>,
David Woodhouse <dwmw2@infradead.org>,
keyrings@vger.kernel.org, David Howells <dhowells@redhat.com>
Subject: Re: [PATCH v13 5/5] security: keys: trusted: Make sealed key properly interoperable
Date: Wed, 30 Sep 2020 11:24:44 +0000 [thread overview]
Message-ID: <20200930112444.GC5145@linux.intel.com> (raw)
In-Reply-To: <20200922022809.7105-6-James.Bottomley@HansenPartnership.com>
On Mon, Sep 21, 2020 at 07:28:09PM -0700, James Bottomley wrote:
> The current implementation appends a migratable flag to the end of a
> key, meaning the format isn't exactly interoperable because the using
> party needs to know to strip this extra byte. However, all other
> consumers of TPM sealed blobs expect the unseal to return exactly the
> key. Since TPM2 keys have a key property flag that corresponds to
> migratable, use that flag instead and make the actual key the only
> sealed quantity. This is secure because the key properties are bound
> to a hash in the private part, so if they're altered the key won't
> load.
>
> Backwards compatibility is implemented by detecting whether we're
> loading a new format key or not and correctly setting migratable from
> the last byte of old format keys.
>
> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
> Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Tested-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
➜ tpm2-scripts (master) ✗ sudo keyctl add trusted kmk2 "new 32 blobauth=world keyhandle�000000 migratable=1" @u
add_key: Invalid argument
➜ tpm2-scripts (master) ✗ sudo keyctl add trusted kmk2 "new 32 blobauth=world keyhandle�000000 migratable=0" @u
608433517
Showed the -EINVAL example just to point out this:
case Opt_migratable:
if (*args[0].from = '0')
pay->migratable = 0;
else
return -EINVAL;
break;
I think it should just set migratable in both cases even if no-op,
given that it takes the value and also the documentation says that
"migratable=1" is legit:
"migratable= 0|1 indicating permission to reseal to new PCR values,
default 1 (resealing allowed)"
Obviously not a concern of this patch but this is still IMHO a bug.
Would be nce if you could drop a prepending patch to fix this, when you
rebase the series, with this fixes tag:
Fixes: d00a1c72f7f4 ("keys: add new trusted key-type")
BTW, please check my fixes so that I can push them ASAP and you get to
rebase this and we can land it. Now everything is properly tested.
/Jarkko
WARNING: multiple messages have this Message-ID (diff)
From: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
To: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: linux-integrity@vger.kernel.org, Mimi Zohar <zohar@linux.ibm.com>,
David Woodhouse <dwmw2@infradead.org>,
keyrings@vger.kernel.org, David Howells <dhowells@redhat.com>
Subject: Re: [PATCH v13 5/5] security: keys: trusted: Make sealed key properly interoperable
Date: Wed, 30 Sep 2020 14:24:44 +0300 [thread overview]
Message-ID: <20200930112444.GC5145@linux.intel.com> (raw)
In-Reply-To: <20200922022809.7105-6-James.Bottomley@HansenPartnership.com>
On Mon, Sep 21, 2020 at 07:28:09PM -0700, James Bottomley wrote:
> The current implementation appends a migratable flag to the end of a
> key, meaning the format isn't exactly interoperable because the using
> party needs to know to strip this extra byte. However, all other
> consumers of TPM sealed blobs expect the unseal to return exactly the
> key. Since TPM2 keys have a key property flag that corresponds to
> migratable, use that flag instead and make the actual key the only
> sealed quantity. This is secure because the key properties are bound
> to a hash in the private part, so if they're altered the key won't
> load.
>
> Backwards compatibility is implemented by detecting whether we're
> loading a new format key or not and correctly setting migratable from
> the last byte of old format keys.
>
> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
> Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Tested-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
➜ tpm2-scripts (master) ✗ sudo keyctl add trusted kmk2 "new 32 blobauth=world keyhandle=80000000 migratable=1" @u
add_key: Invalid argument
➜ tpm2-scripts (master) ✗ sudo keyctl add trusted kmk2 "new 32 blobauth=world keyhandle=80000000 migratable=0" @u
608433517
Showed the -EINVAL example just to point out this:
case Opt_migratable:
if (*args[0].from == '0')
pay->migratable = 0;
else
return -EINVAL;
break;
I think it should just set migratable in both cases even if no-op,
given that it takes the value and also the documentation says that
"migratable=1" is legit:
"migratable= 0|1 indicating permission to reseal to new PCR values,
default 1 (resealing allowed)"
Obviously not a concern of this patch but this is still IMHO a bug.
Would be nce if you could drop a prepending patch to fix this, when you
rebase the series, with this fixes tag:
Fixes: d00a1c72f7f4 ("keys: add new trusted key-type")
BTW, please check my fixes so that I can push them ASAP and you get to
rebase this and we can land it. Now everything is properly tested.
/Jarkko
next prev parent reply other threads:[~2020-09-30 11:24 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-22 2:28 [PATCH v13 0/5] TPM 2.0 trusted key rework James Bottomley
2020-09-22 2:28 ` James Bottomley
2020-09-22 2:28 ` [PATCH v13 1/5] lib: add ASN.1 encoder James Bottomley
2020-09-22 2:28 ` James Bottomley
2020-09-22 2:28 ` [PATCH v13 2/5] oid_registry: Add TCG defined OIDS for TPM keys James Bottomley
2020-09-22 2:28 ` James Bottomley
2020-09-22 2:28 ` [PATCH v13 3/5] security: keys: trusted: fix TPM2 authorizations James Bottomley
2020-09-22 2:28 ` James Bottomley
2020-09-25 7:28 ` Jarkko Sakkinen
2020-09-25 7:28 ` Jarkko Sakkinen
2020-09-25 17:39 ` James Bottomley
2020-09-25 17:39 ` James Bottomley
2020-09-27 23:48 ` Jarkko Sakkinen
2020-09-27 23:48 ` Jarkko Sakkinen
2020-09-30 11:02 ` Jarkko Sakkinen
2020-09-30 11:02 ` Jarkko Sakkinen
2020-09-22 2:28 ` [PATCH v13 4/5] security: keys: trusted: use ASN.1 TPM2 key format for the blobs James Bottomley
2020-09-22 2:28 ` James Bottomley
2020-09-26 11:33 ` kernel test robot
2020-09-26 11:33 ` kernel test robot
2020-09-26 11:33 ` kernel test robot
2020-09-30 11:11 ` Jarkko Sakkinen
2020-09-30 11:11 ` Jarkko Sakkinen
2020-09-30 14:49 ` James Bottomley
2020-09-30 14:49 ` James Bottomley
2020-09-30 15:35 ` Jarkko Sakkinen
2020-09-30 15:35 ` Jarkko Sakkinen
2020-09-22 2:28 ` [PATCH v13 5/5] security: keys: trusted: Make sealed key properly interoperable James Bottomley
2020-09-22 2:28 ` James Bottomley
2020-09-30 11:24 ` Jarkko Sakkinen [this message]
2020-09-30 11:24 ` Jarkko Sakkinen
2020-09-30 3:43 ` [PATCH v13 0/5] TPM 2.0 trusted key rework Jarkko Sakkinen
2020-09-30 3:43 ` 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=20200930112444.GC5145@linux.intel.com \
--to=jarkko.sakkinen@linux.intel.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=dhowells@redhat.com \
--cc=dwmw2@infradead.org \
--cc=keyrings@vger.kernel.org \
--cc=linux-integrity@vger.kernel.org \
--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 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.