From: Eric Biggers <firstname.lastname@example.org> To: Ahmad Fatoum <email@example.com> Cc: "Theodore Y. Ts'o" <firstname.lastname@example.org>, Jaegeuk Kim <email@example.com>, Jarkko Sakkinen <firstname.lastname@example.org>, James Morris <email@example.com>, "Serge E. Hallyn" <firstname.lastname@example.org>, James Bottomley <email@example.com>, Mimi Zohar <firstname.lastname@example.org>, Sumit Garg <email@example.com>, David Howells <firstname.lastname@example.org>, email@example.com, firstname.lastname@example.org, email@example.com, firstname.lastname@example.org, email@example.com, firstname.lastname@example.org, email@example.com, Omar Sandoval <firstname.lastname@example.org>, Pengutronix Kernel Team <email@example.com> Subject: Re: [RFC PATCH v1] fscrypt: support encrypted and trusted keys Date: Wed, 28 Jul 2021 09:05:13 -0700 [thread overview] Message-ID: <YQGAOTdQRHFv9rlr@gmail.com> (raw) In-Reply-To: <firstname.lastname@example.org> On Wed, Jul 28, 2021 at 10:50:42AM +0200, Ahmad Fatoum wrote: > Hello Eric, > > On 27.07.21 18:38, Eric Biggers wrote: > > On Tue, Jul 27, 2021 at 04:43:49PM +0200, Ahmad Fatoum wrote: > >> For both v1 and v2 key setup mechanisms, userspace supplies the raw key > >> material to the kernel after which it is never again disclosed to > >> userspace. > >> > >> Use of encrypted and trusted keys offers stronger guarantees: > >> The key material is generated within the kernel and is never disclosed to > >> userspace in clear text and, in the case of trusted keys, can be > >> directly rooted to a trust source like a TPM chip. > > > > Please include a proper justification for this feature > > I've patches pending for extending trusted keys to wrap the key sealing > functionality of the CAAM IP on NXP SoCs. I want the kernel to > generate key material in the factory, have the CAAM encrypt it using its > undisclosed unique key and pass it to userspace as encrypted blob that is > persisted to an unencrypted volume. The intention is to thwart offline > decryption of an encrypted file system in an embedded system, where a > passphrase can't be supplied by an end user. > > Employing TPM and TEE trusted keys with this is already possible with > dm-crypt, but I'd like this to be possible out-of-the-box with > ubifs + fscrypt as well. Why not do the key management in userspace, like tpm-tools (https://github.com/tpm2-software/tpm2-tools)? There are a lot of uses for this type of hardware besides in-kernel crypto. See https://wiki.archlinux.org/title/Trusted_Platform_Module for all the things you can do with the TPM on Linux, including LUKS encryption; this is all with userspace key management. Wouldn't the CAAM hardware be useful for similar purposes and thus need a similar design as well, e.g. with functionality exposed through some /dev node for userspace to use? Or are you saying it will only ever be useful for in-kernel crypto? > > Note that there are several design flaws with the encrypted and trusted key > > types: > > > > - By default, trusted keys are generated using the TPM's RNG rather than the > > kernel's RNG, which places all trust in an unauditable black box. > > Patch to fix that awaits feedback on linux-integrity. It does *not* fix it, as your patch only provides an option to use the kernel's RNG whereas the default is still the TPM's RNG. Most people don't change defaults. Essentially your same argument was used for Dual_EC_DRBG; people argued it was okay to standardize because people had the option to choose their own constants if they felt the default constants were backdoored. That didn't really matter, though, since in practice everyone just used the default constants. > > > - trusted and encrypted keys aren't restricted to specific uses in the kernel > > (like the fscrypt-provisioning key type is) but rather are general-purpose. > > Hence, it may be possible to leak their contents to userspace by requesting > > their use for certain algorithms/features, e.g. to encrypt a dm-crypt target > > using a weak cipher that is vulnerable to key recovery attacks. > > The footgun is already there by allowing users to specify their own > > raw key. Users can already use $keyid for dm-crypt and then do > > $ keyctl pipe $keyid | fscryptctl add_key /mnt > > The responsibility to not reuse key material already lies with the users, > regardless if they handle the raw key material directly or indirectly via > a trusted key description/ID. Elsewhere you are claiming that "trusted" keys can never be disclosed to userspace. So you can't rely on userspace cooperating, right? - Eric
next prev parent reply other threads:[~2021-07-28 16:08 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-07-27 14:43 Ahmad Fatoum 2021-07-27 16:38 ` Eric Biggers 2021-07-28 8:50 ` Ahmad Fatoum 2021-07-28 16:05 ` Eric Biggers [this message] 2021-07-29 5:56 ` Sumit Garg 2021-07-29 9:07 ` Ahmad Fatoum 2021-07-29 18:28 ` Eric Biggers 2021-07-28 22:22 ` Jarkko Sakkinen 2021-07-28 22:27 ` Ahmad Fatoum
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=YQGAOTdQRHFv9rlr@gmail.com \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --subject='Re: [RFC PATCH v1] fscrypt: support encrypted and trusted keys' \ /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
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).