linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mimi Zohar <zohar@linux.ibm.com>
To: "Jan Lübbe" <jlu@pengutronix.de>,
	"Jarkko Sakkinen" <jarkko@kernel.org>,
	"Ahmad Fatoum" <a.fatoum@pengutronix.de>,
	"James Bottomley" <jejb@linux.ibm.com>,
	"David Howells" <dhowells@redhat.com>,
	keyrings@vger.kernel.org, "Sumit Garg" <sumit.garg@linaro.org>
Cc: linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-security-module@vger.kernel.org, kernel@pengutronix.de
Subject: Re: Migration to trusted keys: sealing user-provided key?
Date: Mon, 01 Feb 2021 11:11:34 -0500	[thread overview]
Message-ID: <bd3246ebb4eae526c84efe2d27c6fadff662b0c8.camel@linux.ibm.com> (raw)
In-Reply-To: <64472434a367060ddce6e03425156b8312a5ad6c.camel@pengutronix.de>

On Mon, 2021-02-01 at 16:31 +0100, Jan Lübbe wrote:
> On Sun, 2021-01-31 at 09:29 -0500, Mimi Zohar wrote:
> > On Sun, 2021-01-31 at 15:14 +0100, Jan Lübbe wrote:
> > > On Sun, 2021-01-31 at 07:09 -0500, Mimi Zohar wrote:
> > 
> > <snip>
> > 
> > > > 
> > > > [1] The ima-evm-utils README contains EVM examples of "trusted" and
> > > > "user" based "encrypted" keys.
> > > 
> > > I assume you refer to
> > > https://sourceforge.net/p/linux-ima/ima-evm-utils/ci/master/tree/README#l143
> > > "Generate EVM encrypted keys" and "Generate EVM trusted keys (TPM based)"?
> > > 
> > > In both cases, the key used by EVM is a *newly generated* random key. The only
> > > difference is whether it's encrypted to a user key or a (random) trusted key.
> > 
> > The "encrypted" asymmetric key data doesn't change, "update" just
> > changes the key under which it is encrypted/decrypted.
> > 
> > Usage::
> > 
> >     keyctl add encrypted name "new [format] key-type:master-key-name keylen"
> >         ring
> >     keyctl add encrypted name "load hex_blob" ring
> 
> 'load' (as I understand the code) only accepts an encrypted blob.
> 
> So the only way I see to have an encrypted key with a non-random key data would
> be:
> - create a random temporary master key and load a copy as a user key
> - encrypt the chosen key data with the temporary master key (using a new
> userspace reimplementation of the kernel encrypted key blob format)
> - use keyctl add encrypted dmcrypt "load <encrypted blob>" <keyring>
> - create new trusted master key (OP-TEE or CAAM in our case) as 
> - use keyctl update to switch to the new trusted master key
> - use keyctl pipe on the trusted and encrypted keys and store both for loading
> on later boots
> 
> If we'd support importing a pre-existing key into a trusted or encrypted key,
> we'd do instead:
> - use keyctl add trusted dmcrypt "import <unencrypted key data>"
> - use keyctl pipe on the trusted key and store it for loading on later boots
> 
> This way, users wouldn't need to care which backend is used by trusted keys
> (TPM/OP-TEE/CAAM/...). That would make use-cases where a random key is not
> suitable as straight-forward as the those where a random key is OK.

As I said above, the "encrypted" key update doesn't change the key data
used for encrypting/decrypting storage in the dm-crypt case, it just
updates the key under which it is encrypted/signed.

Yes, the reason for using an encrypted "trusted" key, as opposed to an
encrypted "user" key, is that the "trusted" key is encrypted/decrypted
by the TPM and never exposed to userspace in the clear.

It doesn't sound like you're wanting to update the storage key in the
field, just the key used to encrypt/decrypt that key.  So I'm still not
clear as to why you would want an initial non-random encrypted key. 
Providing that key on the command line certaining isn't a good idea.

Mimi


  reply	other threads:[~2021-02-01 16:13 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-28 17:31 Migration to trusted keys: sealing user-provided key? Ahmad Fatoum
2021-01-30 17:53 ` Jarkko Sakkinen
2021-01-30 18:07   ` James Bottomley
     [not found]   ` <d1bed49f89495ceb529355cb41655a208fdb2197.camel@linux.ibm.com>
2021-01-31 14:14     ` Jan Lübbe
2021-01-31 18:09       ` James Bottomley
2021-02-02 12:15         ` Sumit Garg
2021-02-02 12:34           ` Jan Lübbe
2021-02-03 11:50             ` Sumit Garg
2021-02-03 13:46               ` Jan Lübbe
2021-02-04  5:30                 ` Sumit Garg
     [not found]       ` <d4eeefa0c13395e91850630e22d0d9e3690f43ac.camel@linux.ibm.com>
2021-02-01 15:31         ` Jan Lübbe
2021-02-01 16:11           ` Mimi Zohar [this message]
2021-02-01 16:38             ` Jan Lübbe
2021-02-01 19:46               ` Mimi Zohar
2021-02-08 14:38                 ` Jan Lübbe
2021-02-08 21:50                   ` Mimi Zohar
2021-02-09  7:16                     ` Jan Lübbe
2021-02-01 11:36     ` David Howells
2021-02-01 15:50       ` Jan Lübbe
2021-02-01 17:04       ` David Howells

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=bd3246ebb4eae526c84efe2d27c6fadff662b0c8.camel@linux.ibm.com \
    --to=zohar@linux.ibm.com \
    --cc=a.fatoum@pengutronix.de \
    --cc=dhowells@redhat.com \
    --cc=jarkko@kernel.org \
    --cc=jejb@linux.ibm.com \
    --cc=jlu@pengutronix.de \
    --cc=kernel@pengutronix.de \
    --cc=keyrings@vger.kernel.org \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=sumit.garg@linaro.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).