Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp4979965imm; Tue, 16 Oct 2018 03:18:53 -0700 (PDT) X-Google-Smtp-Source: ACcGV60BuY5QeKCD59F/mMTUHp+xbRfVV58II6RjwNIA5jOIWpadzm8ZX7/okSU61gQAYnBzMWNu X-Received: by 2002:a65:609a:: with SMTP id t26-v6mr19472705pgu.41.1539685133049; Tue, 16 Oct 2018 03:18:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539685133; cv=none; d=google.com; s=arc-20160816; b=XCmLPxpWppXzjtYF5UY1zILb4uVxopJsxMWc0gCdx8BoSo9Y9jhECcNce2uSzTJFGG Lo7k9L9fEHMB/O52MYEuMm79OBv4oCruaq0jbRDKpM8IUxt/e7JwiDbJCbkA/GRPY9bu 63hcHe/SXREAFm5EzS8nt+WxXsxW8/njESyfyhkvoORKh2B8NgGWIdtWyYlPoO9tFCnz X779moWZC528iCu5coKiV7Np8rVpGkK4OlET3RPSgHynvArK2rdiAll15ZMrNOh/TbtX uHOX3gFmoyeSjD/Dc6NIZVFBG47+KKq+1PDs1xLwgIs7n6JxMe0D5KTzlkriF7NLKtHs Asuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version; bh=hh+fKvLg/JzngdOHw3nz1bfbNv2icP0aeG1DcTnDDK0=; b=0rfvGfUXBKOQDyUvpmqfCiNDzumpVmJRyVTIdiVWV8dFhKsBCzynWADjyZSxunXvFE 5LB/XzpvikPupCEIu7ZiwItF4NNNrKg2oFbICzr7691BGlGTaOIwvE/qVe2nJCzcgLq6 X6ve5xdqgSF1kk4ZG8W6YVYQ8SV5+K+GwyLR4mAypTN/WHmljO8UKRQqyAHwjXMcLezB T4kHnQmK9sGEvZlWUI9Bm95Z8bXfuJlUQ7OoTf0kVAgUTUoJs5g+OBsUyarqR3LeySyV M327BhgetggPtNvt3kwbC1GJwcQcocLpGq6bgSpiUMhiFeSuAkH4uWBwdjTJhwyrNZ+e I5vw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n12-v6si12122249pgl.136.2018.10.16.03.18.37; Tue, 16 Oct 2018 03:18:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727463AbeJPSGG convert rfc822-to-8bit (ORCPT + 99 others); Tue, 16 Oct 2018 14:06:06 -0400 Received: from lilium.sigma-star.at ([109.75.188.150]:54228 "EHLO lilium.sigma-star.at" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726553AbeJPSGG (ORCPT ); Tue, 16 Oct 2018 14:06:06 -0400 Received: from localhost (localhost [127.0.0.1]) by lilium.sigma-star.at (Postfix) with ESMTP id 4ED27180230B6; Tue, 16 Oct 2018 12:16:20 +0200 (CEST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 11.5 \(3445.9.1\)) Subject: Re: [PATCH v2 1/2] security/keys/secure_key: Adds the secure key support based on CAAM. From: David Gstir In-Reply-To: <1533320921.4337.479.camel@linux.ibm.com> Date: Tue, 16 Oct 2018 12:16:15 +0200 Cc: James Bottomley , David Howells , Udit Agarwal , zohar@linux.vnet.ibm.com, jmorris@namei.org, serge@hallyn.com, denkenz@gmail.com, linux-integrity@vger.kernel.org, keyrings@vger.kernel.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, sahil.malhotra@nxp.com, ruchika.gupta@nxp.com, Horia Geanta , aymen.sghaier@nxp.com, Richard Weinberger Content-Transfer-Encoding: 8BIT Message-Id: References: <20180723111432.26830-1-udit.agarwal@nxp.com> <8060.1533226481@warthog.procyon.org.uk> <1533297482.4337.373.camel@linux.ibm.com> <1533306238.4140.1.camel@HansenPartnership.com> <1533307535.4337.415.camel@linux.ibm.com> <1533311338.4140.3.camel@HansenPartnership.com> <1533320921.4337.479.camel@linux.ibm.com> To: Mimi Zohar X-Mailer: Apple Mail (2.3445.9.1) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi! > On 03.08.2018, at 20:28, Mimi Zohar wrote: > >>>>> If they have symmetric key support, there would be no need for >>>>> the >>>>> symmetric key ever to leave the device in the clear. The device >>>>> would unseal/decrypt data, such as an encrypted key. >>>>> >>>>> The "symmetric" key type would be a generic interface for >>>>> different >>>>> devices. >>>> >>>> It's possible, but it would only work for a non-bulk use case; do >>>> we >>>> have one of those? >>> >>> "trusted" keys are currently being used to decrypt other keys (eg. >>> encrypted, ecryptfs, ...). >> >> Yes, but that's just double encryption: it serves no real security >> purpose because at the end of the chain, the symmetric key is released >> into kernel memory to use in software crypto. Unless you're using a >> high speed (and high cost) crypto accelerator with HSA, this will >> always be the case for bulk crypto. >> >> The other slight problem with this chain of crypto is that I can impose >> conditions on the key release from the TPM (well TPM2, since TPM1.2 has >> a very weak policy engine) but if we use intermediate steps, those >> conditions might not be preserved, so I think the ideal would be a >> trusted key being released directly to LUKS or ecryptfs because the TPM >> can then verify the policy at actual unseal time. I get that for the >> ecryptfs case you might want one key per file for sharding and sharing, >> and that's more like a bulk case because the TPM isn't going to keep up >> with the number of unseal operations required. > > Agreed. Yet there are a couple of reasons for having this sort of > indirection. By having the "encrypted" key encrypted/decrypted by a > "trusted" key, the "trusted" key could be updated without impacting > the "encrypted" key. This could be used, for example, for key > migration. Another reason would be to define a single "trusted" key > sealed to a set of PCRs, which could be used to encrypt/decrypt > multiple symmetric keys. > > Nothing is preventing these subsystems from directly using a "trusted" > key. > > This discussion is the result of Udit Agarwal's posting a "secure" key > patch. Before defining a new key type, whether it is called "secure" > or "symmetric", we need to understand how the this new key type is > going to be used. Will it have a similar ability to impose conditions > on the key release as the TPM? Will it have symmetric key support, so > that the symmetric key never needs to be released from the HW? I'm looking into mainline support for CAAM-protected keys. I currently have hacky patches that duplicate trusted keys, and use CAAM instead of TPM to seal/unseal keys and make them available to other kernel features like fscrypt. This patch by Udit Agarwal looks like an interesting base for my code. However, AFAICT there has been no progress for some time now. Is anybody still working on this? If not, I'm happy to help out! :) Regarding the new key type: In addition to unsealing a key/data into kernel memory, CAAM also supports unsealing a symmetric key directly into a key register of CAAM's crypto acceleration engine. This is something I'd like to have, but it will surely require changes the the CAAM crypto driver as well. Jan Lübbe already mentioned he is interested in this too: https://www.spinics.net/lists/keyrings/msg03919.html AFAIK, CAAM does not have fine-grained key release restrictions like TPM. IMHO such a new key type should provide a generic interface with backends for CAAM, TPM and possibly others to seal/unseal arbitrary data. As for supporting keys that only reside in the HW, I'm not yet sure what the best approach would be. It should probably tie into the crypto API to be usable throughout the kernel... Thanks! David