Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1575644pxb; Fri, 20 Aug 2021 08:42:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy0oJqnhOPSPb7zsCayWBneM8n0fDV48WA/NPdu4WHcjZ+gRUd3MuQFY3HfGoDzroqUDqkL X-Received: by 2002:a17:906:c316:: with SMTP id s22mr22667407ejz.39.1629474143277; Fri, 20 Aug 2021 08:42:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629474143; cv=none; d=google.com; s=arc-20160816; b=BKqgcBxY77++ve/DZYymQ+mNo5YDh4YWAEPNgs1yIY/m0FeBUgcOsJM0ELLOspex/n bFqfsCIipdvcNIyAC91y919mrKU5rttnQOlfY4gCogVkkwx3wXUe1/zek+EPOzLgyU3z gMvhFwEQOA11qmNRwK9XPQiwUwWbEGZjySgz/qeOtSyawr1Sx+jwwUVVV1/q3YnBIsZK x0C7zDC5Gmj0gSwNAs7kaGLWdz17cHbtANI+b/bJImFQs/RB1qLjQiCQM9hus3Xud8NJ SRs61sne2xNx/DZU6Kq9tH/W4h6FsgOPd23JF7qvkKAXKVm68xkA6mTbjZ2YKgPeYvs2 s8yQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=wlO9V7SW6IaHABLwjO77mIay7x3gK+WvBoJlACtqQcs=; b=dBIowhambeoi51NSGk4Plcoz7jv03gOgPxU6XVR4PQ9/sLRb4VFZEM8HJy6vAozwYV sJrG2/VhQMgH2pcb3KHw5tV4dw++5EuRxQcHehvfsqmOMJU3tnYX96QQC21dlTTitrAt gf3nIWFjHWbkyXuzFCwRL2YfRhdGLiQ2fc05uYvxfwV0mHBphV0l0djmv2/god5x2QGN pdPQCRGtvny10H+CnuxoAmOkeQpXm5fckxXK4Cp8hL3bN3Qtt54z4+9TKUvoYskfWgBZ 6eimnCPCM2BNI9dQ7ZbbTuAH95ZKnjhrRVn+8OZNo9zm1tO6cqDLj0//jqPLKtpTJp1h JcQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gateworks-com.20150623.gappssmtp.com header.s=20150623 header.b=MzBRXyj8; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cw2si3418663ejc.730.2021.08.20.08.41.35; Fri, 20 Aug 2021 08:42:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gateworks-com.20150623.gappssmtp.com header.s=20150623 header.b=MzBRXyj8; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241143AbhHTPkq (ORCPT + 99 others); Fri, 20 Aug 2021 11:40:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240966AbhHTPkq (ORCPT ); Fri, 20 Aug 2021 11:40:46 -0400 Received: from mail-pg1-x533.google.com (mail-pg1-x533.google.com [IPv6:2607:f8b0:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2801C061575 for ; Fri, 20 Aug 2021 08:40:08 -0700 (PDT) Received: by mail-pg1-x533.google.com with SMTP id x4so9541521pgh.1 for ; Fri, 20 Aug 2021 08:40:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gateworks-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=wlO9V7SW6IaHABLwjO77mIay7x3gK+WvBoJlACtqQcs=; b=MzBRXyj8R7rO3qa70MpA+P3PfcCaftOw9fTjTOSOjEwYSvywE2HHn4B7//MSzI9+Hb jtEje4snibiPQvD5QeY6B1a0hIvrq6ea4ImRq/fjDYxGcCgwujami7Zs5AvczNb/FmGn acXSOgZIjvetkAlkZm15Ba11Y7d8lE0JzjAWI/V8p4nhI5W1/Vgek4yALB5nFKB2zkW2 +eP+wVJViLOABkEzVUZYDil3HkPvcC9s3DW7dUZo/WSIQo55pFWq+8lDtaSNfHwnnNqh 2k+C9PJoqm9bfg3feQENeY2vURgzqCRN9UbkWwZRbXJmueIIho2XN+FTSkn+bPBg2kyc TG3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=wlO9V7SW6IaHABLwjO77mIay7x3gK+WvBoJlACtqQcs=; b=sy0o/gbOKy8vTpF1ngQ0+vPP9YKppOVIgf261XQpIhKtiN/DFa+aH/sQyNYaN1ow+n D9smAJPaz8nsoiQOhpqHVeY6JEDCcQY5b5QNlT+531Hap1ryj/iHdbBYZC1+cFH7fdtX 9XUp+U0sTy+UU/dirLOECSuzE7Xr1BXNUTkcTwYZYYMuNemIPLVn7ovXCiKMIS9nSYvo QkxK/DetRuD+rH5M+2+kL3gaGFRGKnYwc29unc7/EAZ8cKdeltrc4KSyNdC7SUhuXesK mRyYwaHIf68b9wvmhLH9ZABmt+sS9VLVNqoMR19t5Rg3ArnnLJd0eVGY6CDIU7PVAOhw xbyw== X-Gm-Message-State: AOAM532A7IcFt/2uso+9nS8JGaoVIOiy44j5yXsF/nBzPQuaFQX7BlWA GwJ32whC6d/9vEdaVMCsxv2kq6DW9jW4KSFfXA2AZw== X-Received: by 2002:a63:150e:: with SMTP id v14mr19464945pgl.126.1629474007964; Fri, 20 Aug 2021 08:40:07 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Tim Harvey Date: Fri, 20 Aug 2021 08:39:56 -0700 Message-ID: Subject: Re: [PATCH 0/4] KEYS: trusted: Introduce support for NXP CAAM-based trusted keys To: Ahmad Fatoum Cc: Jarkko Sakkinen , =?UTF-8?Q?Horia_Geant=C4=83?= , Mimi Zohar , Aymen Sghaier , Herbert Xu , "David S. Miller" , James Bottomley , Sascha Hauer , David Howells , James Morris , "Serge E. Hallyn" , Steffen Trumtrar , Udit Agarwal , Jan Luebbe , David Gstir , Eric Biggers , Richard Weinberger , Franck LENORMAND , Sumit Garg , linux-integrity@vger.kernel.org, keyrings@vger.kernel.org, linux-crypto@vger.kernel.org, open list , linux-security-module@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Wed, Jul 21, 2021 at 9:49 AM Ahmad Fatoum wrot= e: > > Series applies on top of > https://lore.kernel.org/linux-integrity/20210721160258.7024-1-a.fatoum@pe= ngutronix.de/T/#u > > v2 -> v3: > - Split off first Kconfig preparation patch. It fixes a regression, > so sent that out, so it can be applied separately (Sumit) > - Split off second key import patch. I'll send that out separately > as it's a development aid and not required within the CAAM series > - add MAINTAINERS entry > > v1 -> v2: > - Added new commit to make trusted key Kconfig option independent > of TPM and added new Kconfig file for trusted keys > - Add new commit for importing existing key material > - Allow users to force use of kernel RNG (Jarkko) > - Enforce maximum keymod size (Horia) > - Use append_seq_(in|out)_ptr_intlen instead of append_seq_(in|out)_ptr > (Horia) > - Make blobifier handle private to CAAM glue code file (Horia) > - Extend trusted keys documentation for CAAM > - Rebased and updated original cover letter: > > The Cryptographic Acceleration and Assurance Module (CAAM) is an IP core > built into many newer i.MX and QorIQ SoCs by NXP. > > Its blob mechanism can AES encrypt/decrypt user data using a unique > never-disclosed device-specific key. > > There has been multiple discussions on how to represent this within the k= ernel: > > The Cryptographic Acceleration and Assurance Module (CAAM) is an IP core > built into many newer i.MX and QorIQ SoCs by NXP. > > Its blob mechanism can AES encrypt/decrypt user data using a unique > never-disclosed device-specific key. There has been multiple > discussions on how to represent this within the kernel: > > - [RFC] crypto: caam - add red blobifier > Steffen implemented[1] a PoC sysfs driver to start a discussion on how= to > best integrate the blob mechanism. > Mimi suggested that it could be used to implement trusted keys. > Trusted keys back then were a TPM-only feature. > > - security/keys/secure_key: Adds the secure key support based on CAAM. > Udit added[2] a new "secure" key type with the CAAM as backend. The ke= y > material stays within the kernel only. > Mimi and James agreed that this needs a generic interface, not specifi= c > to CAAM. Mimi suggested trusted keys. Jan noted that this could serve = as > basis for TEE-backed keys. > > - [RFC] drivers: crypto: caam: key: Add caam_tk key type > Franck added[3] a new "caam_tk" key type based on Udit's work. This ti= me > it uses CAAM "black blobs" instead of "red blobs", so key material sta= ys > within the CAAM and isn't exposed to kernel in plaintext. > James voiced the opinion that there should be just one user-facing gen= eric > wrap/unwrap key type with multiple possible handlers. > David suggested trusted keys. > > - Introduce TEE based Trusted Keys support > Sumit reworked[4] trusted keys to support multiple possible backends w= ith > one chosen at boot time and added a new TEE backend along with TPM. > This now sits in Jarkko's master branch to be sent out for v5.13 > > This patch series builds on top of Sumit's rework to have the CAAM as yet= another > trusted key backend. > > The CAAM bits are based on Steffen's initial patch from 2015. His work ha= d been > used in the field for some years now, so I preferred not to deviate too m= uch from it. > > This series has been tested with dmcrypt[5] on an i.MX6DL. > > Looking forward to your feedback. > > Cheers, > Ahmad > > [1]: https://lore.kernel.org/linux-crypto/1447082306-19946-2-git-send-em= ail-s.trumtrar@pengutronix.de/ > [2]: https://lore.kernel.org/linux-integrity/20180723111432.26830-1-udit= .agarwal@nxp.com/ > [3]: https://lore.kernel.org/lkml/1551456599-10603-2-git-send-email-fran= ck.lenormand@nxp.com/ > [4]: https://lore.kernel.org/lkml/1604419306-26105-1-git-send-email-sumi= t.garg@linaro.org/ > [5]: https://lore.kernel.org/linux-integrity/20210122084321.24012-2-a.fa= toum@pengutronix.de/ > > --- > To: Jarkko Sakkinen > To: "Horia Geant=C4=83" > To: Mimi Zohar > To: Aymen Sghaier > To: Herbert Xu > To: "David S. Miller" > To: James Bottomley > Cc: David Howells > Cc: James Morris > Cc: "Serge E. Hallyn" > Cc: Steffen Trumtrar > Cc: Udit Agarwal > Cc: Jan Luebbe > Cc: David Gstir > Cc: Eric Biggers > Cc: Richard Weinberger > Cc: Franck LENORMAND > Cc: Sumit Garg > Cc: linux-integrity@vger.kernel.org > Cc: keyrings@vger.kernel.org > Cc: linux-crypto@vger.kernel.org > Cc: linux-kernel@vger.kernel.org > Cc: linux-security-module@vger.kernel.org > > Ahmad Fatoum (4): > KEYS: trusted: allow users to use kernel RNG for key material > KEYS: trusted: allow trust sources to use kernel RNG for key material > crypto: caam - add in-kernel interface for blob generator > KEYS: trusted: Introduce support for NXP CAAM-based trusted keys > > Documentation/admin-guide/kernel-parameters.txt | 8 +- > Documentation/security/keys/trusted-encrypted.rst | 60 +++- > MAINTAINERS | 9 +- > drivers/crypto/caam/Kconfig | 3 +- > drivers/crypto/caam/Makefile | 1 +- > drivers/crypto/caam/blob_gen.c | 230 +++++++++++++++- > include/keys/trusted-type.h | 2 +- > include/keys/trusted_caam.h | 11 +- > include/soc/fsl/caam-blob.h | 56 ++++- > security/keys/trusted-keys/Kconfig | 11 +- > security/keys/trusted-keys/Makefile | 2 +- > security/keys/trusted-keys/trusted_caam.c | 74 +++++- > security/keys/trusted-keys/trusted_core.c | 23 +- > 13 files changed, 477 insertions(+), 13 deletions(-) > create mode 100644 drivers/crypto/caam/blob_gen.c > create mode 100644 include/keys/trusted_caam.h > create mode 100644 include/soc/fsl/caam-blob.h > create mode 100644 security/keys/trusted-keys/trusted_caam.c > > base-commit: 97408d81ed533b953326c580ff2c3f1948b3fcee > -- > git-series 0.9.1 Ahmad, Thanks for your work! I've been asked to integrate the capability of using CAAM to blob/deblob data to an older 5.4 kernel such as NXP's downstream vendor kernel does [1] and I'm trying to understand how your series works. I'm not at all familiar with the Linux Key Management API's or trusted keys. Can you provide an example of how this can be used for such a thing? Best regards, Tim [1] https://source.codeaurora.org/external/imxsupport/imx_sec_apps/tree/dem= o-caam-blobs/README.txt