Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp2798189lqo; Tue, 14 May 2024 09:22:44 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUH2ExuD9oPueJmaBWufim6VojdeLjKf/hMCgbN/h0i+y/EbOKZjEQGelfJ4WPuaS3RYvSzTBYHvKNQFllodLEx/azpF8ImRYyzz58fOA== X-Google-Smtp-Source: AGHT+IHre5a8Eunix1WmDXC4fRYT6Yn6j5sOhAxS+C7x/N77A9cgV8JSkHGnFXYsObv+bXXMoAIo X-Received: by 2002:a17:907:7f94:b0:a59:ab57:741e with SMTP id a640c23a62f3a-a5a2d675779mr1197726266b.76.1715703764366; Tue, 14 May 2024 09:22:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715703764; cv=pass; d=google.com; s=arc-20160816; b=0ln31W6YEtxWDLvV53+DVxGIPGJIxAg0s7wXb6p7UQDjwRkNrawP661qMT9YVh2I9J zOp8MkTJBwYppvq+3878nWwArIzTUhD3gSGyD8cnWq0FA13xhtqhE8WfTtA+jF9716cn iWPW1ZysulBXwCA1G8KegMffxvUp53iBQMemloWXSgpCeRMoC0a8GQ8eIdzv9Cg1bOCC 0vrNZ7K3v/1sxvAySclP2LJKvdevAx2q/rDsDr3I/MbUoYvvaJbeOwTAGInmOJeuTVe3 UhtONgbIJTG8BiSkZTALZhbptF9sS1KfajoB/kWSVxV3WVWymuU7krF+FTVllCP97DE2 GEJg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:references:cc:to:from:subject:message-id:date :content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:dkim-signature; bh=qWNfmwrAJYS9+/veIvgJMsKkBw5mZMtY6XlrZ+mVQtk=; fh=JOXoJCFOnH/EacbfzPVrl8i9q9RZc3qRJzkZLynG3dA=; b=fwA24oehxVSq85cFEy43BOmr7QdqsebVFfgSeXu9bOiEPiF5iB61vDfC7al41qbgvQ 0yn0nSXSpd3UFLF1cgWp4nQI/LsciUs4pcSsCYthtU3TvDA7GjNJkGiyWWekpchl4L/a Lwj2yAi2fsYviBsuJF/AaO2Z0LRqqQbwJ6oK4IEnGBd1i45UGArJVKFoEhqPtYeM+56K kFURLDwkQjhoWz2/73mtn7NKDTBA4gK5OowKSIAmwyg8uOxq1ZeBD/XXAakbKgaZIsi/ zsNBTzp3/mlV5ltWqIrOKfi3cco+mT1nhDmtnkpvx9cDIHWPRIBANWW5M4XM4da3WqW+ FEzQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=peUIeD6F; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-178950-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-178950-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a5a17946206si645863466b.59.2024.05.14.09.22.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 May 2024 09:22:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-178950-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=peUIeD6F; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-178950-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-178950-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id E25671F21811 for ; Tue, 14 May 2024 16:22:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0B86A17F383; Tue, 14 May 2024 16:22:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="peUIeD6F" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 15DA72E644; Tue, 14 May 2024 16:22:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715703757; cv=none; b=NX2fl588dZdvWx6kvGrLzqIKIA1LHwDY9Wz1hYyF2tssaZTArjrD7GmxezvuOADLmH+fW6QqtJfH97zrck4Dw5Rn20+H8rna8yxwTxrevq+6uXxZz/If7qTBq8MvNgEHrtFjzprCDVVxL98McG6jQVvSurlz3TlRL+gLbZ464Iw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715703757; c=relaxed/simple; bh=c1D5oPweUPm1QJ+Le24bvk/5IJRPjpfVxwksA/GvpoM=; h=Mime-Version:Content-Type:Date:Message-Id:Subject:From:To:Cc: References:In-Reply-To; b=Bqlxm3KniHF2BkTAyhcd/h3hs2gPYiIlL14dGZTgRJB0HbUJRanTW4Vb+oylCEhVM7JbS2s5GIg6ZlkLXYzEEWykiHf4qXuux6+xhwQAVGk49suEeJ6/whZGrANRa9xCx4q9c7mkHViuJ1UiRW93ZiMd+jmcgOoWl0mV9izztwk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=peUIeD6F; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 961EEC2BD10; Tue, 14 May 2024 16:22:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715703756; bh=c1D5oPweUPm1QJ+Le24bvk/5IJRPjpfVxwksA/GvpoM=; h=Date:Subject:From:To:Cc:References:In-Reply-To:From; b=peUIeD6F6fjG1+0+vQ451kilofzGPLYKZ1lfae89jLvCXonvc40lDCP9daAfJ1Qrp 1fKKYGkqXPUaWkLQzF8M3BoshSYjw4dFnUwKQQyK8fHmjxuHg8Gqpmj0SAcITGIZgJ LQpS5veRcA7n94ER2XA1K2J0vV58I7o/vJbfO1CPZUfpu92jEteRF7Pi948ZLFtE4o WodY0vikN4K1XMcgmpN0Hjh9A+RtLk26o224r7wRj8xc3z17LDmyo6teKQ2KJG+r+q 7M5tJt9jmLfRCsMfI0vlU6nPbitq+7j0PyFi1nAErDGTG7cgDbL9hZDa6q2M8h93Sa cONwTIZ8GLHMQ== Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Tue, 14 May 2024 19:22:32 +0300 Message-Id: Subject: Re: [RFC PATCH 0/2] TPM derived keys From: "Jarkko Sakkinen" To: "Ignat Korchagin" Cc: "James Bottomley" , "Mimi Zohar" , "David Howells" , "Paul Moore" , "James Morris" , , , , , X-Mailer: aerc 0.17.0 References: <20240503221634.44274-1-ignat@cloudflare.com> In-Reply-To: On Tue May 14, 2024 at 7:08 PM EEST, Ignat Korchagin wrote: > On Tue, May 14, 2024 at 4:43=E2=80=AFPM Jarkko Sakkinen wrote: > > > > On Tue May 14, 2024 at 6:30 PM EEST, Ignat Korchagin wrote: > > > On Tue, May 14, 2024 at 4:26=E2=80=AFPM Jarkko Sakkinen wrote: > > > > > > > > On Tue May 14, 2024 at 6:21 PM EEST, Jarkko Sakkinen wrote: > > > > > On Tue May 14, 2024 at 5:30 PM EEST, Jarkko Sakkinen wrote: > > > > > > On Tue May 14, 2024 at 5:00 PM EEST, Jarkko Sakkinen wrote: > > > > > > > On Tue May 14, 2024 at 4:11 PM EEST, Ignat Korchagin wrote: > > > > > > > > For example, a cheap NAS box with no internal storage (disk= s connected > > > > > > > > externally via USB). We want: > > > > > > > > * disks to be encrypted and decryptable only by this NAS = box > > > > > > > > > > > > > > So how this differs from LUKS2 style, which also systemd supp= orts where > > > > > > > the encryption key is anchored to PCR's? If I took hard drive= out of my > > > > > > > Linux box, I could not decrypt it in another machine because = of this. > > > > > > > > > > > > Maybe you could replace the real LUKS2 header with a dummy LUKS= 2 > > > > > > header, which would need to be able the describe "do not use th= is" and > > > > > > e.g. SHA256 of the actual header. And then treat the looked up = header as > > > > > > the header when the drive is mounted. > > > > > > > > > > > > LUKS2 would also need to be able to have pre-defined (e.g. kern= el > > > > > > command-line or bootconfig) small internal storage, which would= be > > > > > > also encrypted with TPM's PRCs containing an array of LUKS2 hea= der > > > > > > and then look up that with SHA256 as the key. > > > > > > > > > > > > Without knowing LUKS2 implementation to me these do not sound r= eaching > > > > > > the impossible engineer problems so maybe this would be worth o= f > > > > > > investigating... > > > > > > > > > > Or why you could not just encrypt the whole header with another k= ey > > > > > that is only in that device? Then it would appear as random full > > > > > length. > > > > > > > > > > I.e. unsealing > > > > > > > > > > 1. Decrypt LUKS2 header with TPM2 key > > > > > 2. Use the new resulting header as it was in the place of encrypt= ed > > > > > stored to the external drive. > > > > > 3. Decrypt key from the LUK2S header etc. > > > > > > > > Maybe something like: > > > > > > > > 1. Asymmetric for LUKS2 (just like it is) > > > > 2. Additional symmetric key, which is created as non-migratable and= stored > > > > to the TPM2 chip. This deciphers the header, i.e. takes the rand= om > > > > away. > > > > > > This could work, but you still have the problem of - if the header > > > gets wiped, all the data is lost. > > > As for storing things on the TPM chip - that doesn't scale. Today you > > > only think about disk encryption, tomorrow there is a new application= , > > > which wants to do the same thing and so on. One of the features of > > > derived keys - you don't store anything, just recreate/derive when > > > needed and it scales infinitely. > > > > OK, so now I know the problem at least and that is probably the > > most important thing in this discussion, right? > > Yes, I think so. > > > So make a better story, now you also probably have better idea, > > also split the patch properly by subsystem, send the patch set, > > I'm actually not super clear on this part - I have two patches: one > for TPM header definitions and another one for the keyring subsystem? > Any other subsystems in play here? You're absolutely right the split is fine. I look patches every day so that must have stuck me somewhere else (sometimes does happen). Sorry. > > and I'll promise to revisit. > > Thanks. Would probably take some time as I want to think more on the > open questions I raised in the description, try to address some > comments from James B from other replies (key rotation for example) > and rebase on recently merged TPM encrypted sessions. But since this > is an RFC I would like to continue the discussion and gather opinions > from folks here, if there are any more concerns. Yeah, not trying to argue of anything. Just have shoot with stupid questions until it gets through, and not pretending of understanding if I actually do not :-) So I'll be ready once the next version is out. > > > Fair enough? :-) > > > > BR, Jarkko BR, Jarkko