Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp2762793lqo; Tue, 14 May 2024 08:26:25 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUu1u5paUHKhHWEtXJZsCVe78eVxxMmmb8wxew5YZ4MVz8EzD4fgnPIIxgnG6xI9M1R/6gi022/izyeNOUtBI9Yr82YAj6Q0tqskuqQmg== X-Google-Smtp-Source: AGHT+IFWeLaqwWp0ZBc7bqSrDwhOSLHEXkSazfWbkM1ZhdPgbTEiuLnsnURTgWhNAyy0V8GmaBGv X-Received: by 2002:a05:6358:2825:b0:185:feb9:7dc2 with SMTP id e5c5f4694b2df-193bb63ad76mr1236799555d.16.1715700384828; Tue, 14 May 2024 08:26:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715700384; cv=pass; d=google.com; s=arc-20160816; b=nfntXv0dhVx1CF474PZylrIm7a1UTiwrSu2ZoM2SGPLmvnoh3KsMtNIqaDhxmMOsMn Frp0yzYuqr3yGFfllKM+aFoVWoxZgCQ9AX53gMjjkbVii4JuDXzYeMxUyC+102DYHe49 DO1jkX8/W0FNKvZhL3mu38b98KlGh/0wfgoqu2XzSwQtTxAQi191gLavCkFGQCaik4Qp vKlXt8PPM8W7THiwpQGE7cb1nZVmGkg/IPofLgjDUqXQcQ+E/RcGo0fzWPq+2X2U3zx4 ry6d7gYeNB10BYrQWuCSbFrRoMYCWe5/DoBVjYncu3TJIzPVXOK5WlxwSY5jJzWfRKhU IP7A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:dkim-signature; bh=XjdkmUK5FHIy+76wKlCpht0TBEvkIczOsE69/Y7T6nc=; fh=yS9NQ6daWbjuzbtfIsHfh8xgCZ7azL6I4SVox6zKglI=; b=GZPEkvnqFXp6pDCD1hPFOXh5fqIH41hzCQH+9ebhHXK/idezLXhJTo/yfvyDSzF4dF Ab8/MYj4a44rPJz6++YhiZusBcFYBFF5I48HyjbWJnORSc+Z1aMlUBC+HwbQ0wOTqVEL 3Vvy3eMyUBv3YwTzZVsL9sHKDuzj/6qQ/g4aMimzkafDWMoD1gvMy8c3zH4SEwksW1Xt vANhAIDKmv1x1ukNcy/pB/E6/XWUlrtADSvOVj/SfYxY5aXJB9KfDF57WZvRkQfX+tEn B+ufH9INFgOYIvMve8bnn3V9mzwK2qrwVSb6xBxPKx1jLT/0qf7hnfDiF8g5LIBE1O8I 1bwQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bZSQRfD3; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-178856-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-178856-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-6341180dc93si11866940a12.542.2024.05.14.08.26.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 May 2024 08:26:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-178856-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bZSQRfD3; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-178856-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-178856-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 6A5BA28208F for ; Tue, 14 May 2024 15:26:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7031017EBA4; Tue, 14 May 2024 15:26:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="bZSQRfD3" 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 932681459E4; Tue, 14 May 2024 15:26:18 +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=1715700378; cv=none; b=nj98AyK7LkRpZwvoLw7h5AS6Vetldb4AuNBr0wLsrV4YWzpuDE3lh9DXYhSRuktPV95OWNph4mqKAqMSTndi0X47DnUZIqF33jxMa/rBEvGD2SoSih4nWwg/yJwLnJTejJPX5qywxaPZIDigxmVEmTb5kJgnu9SLCGKGqixXwD0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715700378; c=relaxed/simple; bh=9KMbCQl0+iQEOyt5weo+F3V77somwAtxeW8gev83MFI=; h=Mime-Version:Content-Type:Date:Message-Id:Cc:Subject:From:To: References:In-Reply-To; b=ZaKwx6+KBmBQ709PkE+SBmV+Uzr3Wyz/bnIsQD4ViiHh7qLdHPENJle2z3Hy/PzGCgCe9T4aRKBtR6GmqUCKtMJCWP8t0Y+uGZUQIzWjP3oL8QZxJhoFoi1YS/aDomZPh9791QiiLPB5OYNdKHxu20B/XKPmhxIfQwI+55+8YQQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=bZSQRfD3; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id D816FC32781; Tue, 14 May 2024 15:26:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715700378; bh=9KMbCQl0+iQEOyt5weo+F3V77somwAtxeW8gev83MFI=; h=Date:Cc:Subject:From:To:References:In-Reply-To:From; b=bZSQRfD3b3TmCGmAoNlZP5Z+ti6zRY1bqgMeBI/7dcb1Vkxn0iM8re+TS+Y6IAB4e YsufHqfDR3/7v+GtCiiZxlY0QN7/ZmTHR0AheCQAX9/sOMwyIFcE7oIuiw9buZy0Ah qFDwoRQNjXJ7sDKot19XBwyO8RxEufqGNWrocmxJ8Nsxz37SGuRyhKcLKuMXB8hEuc Pj+747hIVMeDxN2+1JyI/zWLmZW8BzjRVONbq8VZlhBU7VLGAJi9VhNbHptRwmASUC C86rnMhHXjFIC+QTKvnzESbG1WVTFnxejqvfDeo5D0s9sO3Wt1j95TEUGCJnBoyHns FCgnCFifkMHQQ== 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 18:26:14 +0300 Message-Id: Cc: "James Bottomley" , "Mimi Zohar" , "David Howells" , "Paul Moore" , "James Morris" , , , , , Subject: Re: [RFC PATCH 0/2] TPM derived keys From: "Jarkko Sakkinen" To: "Jarkko Sakkinen" , "Ignat Korchagin" X-Mailer: aerc 0.17.0 References: <20240503221634.44274-1-ignat@cloudflare.com> In-Reply-To: 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 (disks connec= ted > > > > 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 supports whe= re > > > 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 LUKS2 > > header, which would need to be able the describe "do not use this" and > > e.g. SHA256 of the actual header. And then treat the looked up header a= s > > the header when the drive is mounted. > > > > LUKS2 would also need to be able to have pre-defined (e.g. kernel > > command-line or bootconfig) small internal storage, which would be > > also encrypted with TPM's PRCs containing an array of LUKS2 header > > and then look up that with SHA256 as the key. > > > > Without knowing LUKS2 implementation to me these do not sound reaching > > the impossible engineer problems so maybe this would be worth of > > investigating... > > Or why you could not just encrypt the whole header with another key > 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 encrypted > 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 random away. BR, Jarkko