From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796422596; b=ehndhWMKXaULGVhgg5RTIR7peOG5xrF6djzJmg+r0RITheGM8CPUGEg77fBjUjdFn6M4 dztk7A85FZwAbkLyY2H1Au4VS75nA793Xfu2Jevezbi1paUmZHCFZa9c6vLNyR8M6YItg jcrFgPvXH/W7l8fT5LkKFmuI/Gv2Tb3YnXO/xTBZi/oAYuZQN9Ui6qYvY6LKXLdqKHMme PHY9JBoy20N+gCiq5O21T7Z6cH9lPROeME/uk9vKaF3jPyEPXxCoweQCSff9Fzap0mMva lGK/8kk3adYjq7yZ9L7AdsE9sa/Na1gFg2C0KAWnUdgz+XwdeOl+wkZpawfzvBOfnSQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796422596; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=EYePW8hNrQeM9oaShPPgeqgrK0QbKqQb8hW/PJ30GWg=; b=c5xuTQPeB+bWDnh1weyMcHvzrbc98p3WKPpRFy5rBnsMoa3G5zpHoFU8c5ZF6xWCsrAj rCYlVoexQEbgh1JPzUb4QTVV2mOLkc5vEpjIWmv1p/iTig7/sZElPIYuwxcLzDRKyUQOm Df2ugJ40MW/9AMHCsE7UovXvTpHt19i6wW1Vslz69WumnaEJh82FraaMdR0M83VtFKA+2 my8ZCTZMZwVIKPRHit9fPUFv+C9TNDyQdjAvEtjSOu7BC7ciG5z+AFpQps5jHPoWCxfHL 7AoLU9zR6AU+9iNn51MGT+C6sqgpeRosqNAIgg5qnUSlZeh6c4qwj40e2wu6kaZwy8w== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=mmhwyGZc; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with UTF8SMTPS id 2B014606A322; Fri, 4 Dec 2026 22:16:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=mmhwyGZc Received: by smtp.kernel.org (Postfix) with UTF8SMTPSA id 13A501F0093B; Fri, 4 Dec 2026 22:16:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796422595; bh=EYePW8hNrQeM9oaShPPgeqgrK0QbKqQb8hW/PJ30GWg=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=mmhwyGZcpsQNlseOSfxGSeRNlWbfiiXkXZLCiBnCwALFl5/AoHpbdR4E32qDcIRwi dFyReKVnwfGLZ2W0TOgdR1ZJ4YjZR0RlKwXpQ0R62uAzCQqzXXkbNu7NBNVuS4mtGI nWoCamVq+I1DN6b7OUmv/qsR2SSRFFgq1O4qNxnPd38ygxBOCRrZHY5mb5ObG+h+Cf 313tWltEUrcoVAHMEZ3TiHVKCS7kTBbB0CI2cyWIbKnWbl7whfSaGJtfFXrwCoA+VH VsUZgC2cQuFlnCQA3oC+tx/SZCpbRZ30ZrwcSrj7znFDmYbtyG/swnJSJVxaS0Xxeb edEH0FtQQrcyw== Date: Sat, 5 Dec 2026 00:16:31 +0200 From: Jarkko Sakkinen To: Eric Biggers Cc: keyrings@vger.kernel.org, dm-devel@lists.linux.dev, linux-crypto@vger.kernel.org, linux-doc@vger.kernel.org, linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, Ahmad Fatoum , Alasdair Kergon , Andrew Morton , Benjamin Marzinski , David Gstir , David Howells , David Laight , "David S. Miller" , David Woodhouse , Herbert Xu , Ignat Korchagin , James Bottomley , James Morris , James Prestwood , Jason Gunthorpe , Jonathan Corbet , Jonathan McDowell , Lukas Wunner , Marek =?iso-8859-1?Q?Beh=FAn?= , Mike Snitzer , Mikulas Patocka , Mimi Zohar , Paul Moore , Peter Huewe , Randy Dunlap , "Serge E. Hallyn" , Shuah Khan , Sumit Garg Subject: Re: [PATCH v6 00/18] KEYS: trusted: asymmetric keys Message-ID: References: <20261128215621.2253928-1-jarkko@kernel.org> <20261129232320.GC2118@sol> X-Mailing-List: linux-doc@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261129232320.GC2118@sol> On Sun, Nov 29, 2026 at 03:23:20PM -0800, Eric Biggers wrote: > On Sat, Nov 28, 2026 at 11:56:02PM +0200, Jarkko Sakkinen wrote: > > OVERVIEW > > ======== > > > > Extend TPM 2.0 trusted keys to load ASN.1 TPMKey [1] asymmetric keys > > (OID_TPMLoadableKey, 2.23.133.10.1.3) for RSA (2048/3072/4096) and ECC > > (NIST P-256/P-384/P-521), and expose keyctl pkey-operations directly on > > key_type_trusted. In addition, extend TPMKey support to derive a > > transient TCG H-2 NIST P-256 primary key on the fly for 0x40 permanent > > hierarchy handles (such as TPM2_RH_OWNER). > > > > This allows provisioning an asymmetric key whose private portion stays > > sealed to the TPM rather than sitting in plaintext on disk or in kernel > > memory, while letting privileged setup load the blob into a keyring and > > grant signing or decryption access via KEYCTL_PKEY_* without exposing > > /dev/tpm0, /dev/tpmrm0, or a userspace PKCS#11 stack. For example, a > > UEFI Secure Boot Machine Owner Key (MOK) used for local module signing > > can have its X.509 certificate enrolled into MokList while its private > > key is wrapped into an OID_TPMLoadableKey blob and shredded from disk; > > network daemons such as iwd can similarly authenticate with TPM-bound > > client keys. > > Though patch 2 is nice, the feature patches 8-18 seem to add a lot of > unprivileged attack surface. Unprivileged processes will be able to do > add_key("trusted", ...), then KEYCTL_PKEY_* to do expensive TPM > operations or attack the new ASN.1 and TPMT_PUBLIC parsers. It's good to have this code and this was my annual update. I agree with you on that it could be that there is not enough weight. However, "KEYS: trusted: Allow ASN.1 TPM2 sealed data shorter than MIN_KEY_SIZE" is something that makes using and writing tools more difficult and is not such big deal to begin with. Also, one thing that I would like to put in place, and which I've successfully implemented at least in Rust (I've made widely used Rust TPM2 protocol stack in the past), is to extend TPMKey loading to interpret TPM Command blob part. So what I'm suggesting is that maybe I'll do that and cherry pick those non-asymmetric related patches to that? It would be nice to be able to anchor keys in a robust manne. Br, Jarkko