Received: by 2002:a89:2c3:0:b0:1ed:23cc:44d1 with SMTP id d3csp53704lqs; Mon, 4 Mar 2024 14:51:54 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXdDsQjWlcSzRBbCm9byJvFxNq64JDKgUfq+Y1IY8WUBf0TfkmV64TLOhj91biUBH9vTm//w6BW414SFatXRGrF8/g0NDm+B5qpjehf7Q== X-Google-Smtp-Source: AGHT+IGi0589l06KO2u8JJeBwxe/DWuMPNEzKOtKK9LGgo/EYktApz/yJbrFwff9K1rVCIUBcUF8 X-Received: by 2002:a05:6a20:7b1a:b0:1a1:4771:1a7 with SMTP id s26-20020a056a207b1a00b001a1477101a7mr69500pzh.39.1709592714178; Mon, 04 Mar 2024 14:51:54 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709592714; cv=pass; d=google.com; s=arc-20160816; b=JNoV+WCjEdT+IMVLDxIcCR1B0jq0rAkKmo/X1jN6g913xoJI2HrbHqnTslTSICt2nN wXLIl8nSLCmEB5++PpMQ/881rvGig6YtTPp4yLdPN7ie9APW+f1gasNygC6OuJVdm73H pDgEwlkNl/2mu+KNsmq9l0tSOPxcoaMDCvRWKWvkspOEN0XaBLTQgyfhzbV44r9UA8dS 3LcWh1ba9d9UTFDNa/Ers3x8JlJjpgqqocchz5nBWSF0DCNdEFt9geJlsOg6ZO2dvH4x rIksdH9poSHzn9QPFEgLgpeBCtzhlQTLX0AwXprtmWzxVftIZOhWjj3+O4zMcMBMMfaQ FxdA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:references:subject:cc:to:from:message-id:date :content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:dkim-signature; bh=UNh5Nyrzxev7/4OFZJf4SBKI7xSWCO52xbc6W6jRcYU=; fh=qV4l0kzRuTu43u3frUjhbhQvjFVpkR5HSjw90JlgOTE=; b=sDECXFKWz3OMsbYUUhLU9DV850SJPXVrlkTCEjwkyX/GRlE6QVS1LrJBfC1TDXx/gr +hY8UmFhx4pDSTbTO82OnR3B41SLokmf6EByXxwYp+9WUv74IUham+SQD9xLfe8i0rOJ imY9h9I6sKSIyU067YouaNeKEFoeGLTj+PfotsWpWgrA70FfZs44f/LhFLUx2ubdeYez USA+epWBsmQJFMxU26x1KR1Z4ApunooC6EF/VXmabCv6FVLr7q8BtbkTuaY3t1HahRox 7NAmcqHRDlxrICmhW26daZZh9CrYV/5s8MmXShb6BLBJCNDZfZoixx2EHlyFDTHvtJIa xnoA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qH7ghQWU; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-91381-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-91381-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. [139.178.88.99]) by mx.google.com with ESMTPS id j3-20020aa78dc3000000b006e5ce366effsi5844939pfr.357.2024.03.04.14.51.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 14:51:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-91381-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qH7ghQWU; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-91381-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-91381-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 97B182869E5 for ; Mon, 4 Mar 2024 22:51:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7C33F7C092; Mon, 4 Mar 2024 22:51:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="qH7ghQWU" 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 73BDB482DA; Mon, 4 Mar 2024 22:51:41 +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=1709592701; cv=none; b=a36yWANtnKKRftqdLZuu+CJzfnbTZRUAiuFHBEtuRDOiNCnz172Jm7S7MAuk9t472o8BK+ZNvX7LRrXDRuZyh2Siu1O0HHMO5OSDJPoeF4KRXci7JsbYmrxc6sma9Hqz5XzB9O/HtUs+8c2Z+uARQquL0W4eICqExwzLT//JM5c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709592701; c=relaxed/simple; bh=YhKdEjJYfUK5PGnDdyu7Ox1LTeRZMNbyU1Aoe9uCC1k=; h=Mime-Version:Content-Type:Date:Message-Id:From:To:Cc:Subject: References:In-Reply-To; b=fGa1E4wzttQZDHWcN03J8Uv0Kw2GEv39ImjkrIvIihMDEiHb+0Qq/9eRuEPxRy8oVBZoY4kr7Sk/eVhtgAfTFHssQ7NvCmTJKesvQHU9vT8Lo0MyTtCFoLkUn1TRsCqtpDGubdWVwHj+T3yTysmp4G84R3fJtXk+lWW/DgJt138= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=qH7ghQWU; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id DD380C433C7; Mon, 4 Mar 2024 22:51:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709592701; bh=YhKdEjJYfUK5PGnDdyu7Ox1LTeRZMNbyU1Aoe9uCC1k=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=qH7ghQWUmWQSFGS9dlXBIbNWYEOOV2jZSCJ5jRYtKU+tKXVwRV3OzXUDwdQCSfBcu ILXJufnw4gwvdFpU28/Ac0v+55ZUgCnLN5hWfIViC8GuEbcJHk+1n1WNQH1F9ozfck eOYFpNFCdzT4p8oxHi08FIGAODLqPl/HQsDxr51Apj5rdpBtdjjRXT6esVMAVPcbJC N2Mv+13ROf8vZNFvpecIxb3OxpBw7iuSSafDNlQVCRvmBjMlNu9DQ2/ucT98HNiR5g yDDWTIMc4cPTIFkdL1o9fRuyQiBDkdEhahBQtZRB8OyaQAb2z8VmXTSy4DkvZFnuTu aBWa4hCcB5ErA== 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, 05 Mar 2024 00:51:33 +0200 Message-Id: From: "Jarkko Sakkinen" To: "Paul Moore" , "David Gstir" , "Mimi Zohar" , "David Howells" Cc: "James Bottomley" , "Herbert Xu" , "David S. Miller" , "Shawn Guo" , "Jonathan Corbet" , "Sascha Hauer" , "Pengutronix Kernel Team" , "Fabio Estevam" , "NXP Linux Team" , "Ahmad Fatoum" , "sigma star Kernel Team" , "Li Yang" , "James Morris" , "Serge E. Hallyn" , "Paul E. McKenney" , "Randy Dunlap" , "Catalin Marinas" , "Rafael J. Wysocki" , "Tejun Heo" , "Steven Rostedt (Google)" , , , , , , , , Subject: Re: [PATCH v5 0/6] DCP as trusted keys backend X-Mailer: aerc 0.15.2 References: <20231215110639.45522-1-david@sigma-star.at> In-Reply-To: On Tue Dec 19, 2023 at 2:45 AM EET, Paul Moore wrote: > On Fri, Dec 15, 2023 at 6:07=E2=80=AFAM David Gstir = wrote: > > > > This is a revival of the previous patch set submitted by Richard Weinbe= rger: > > https://lore.kernel.org/linux-integrity/20210614201620.30451-1-richard@= nod.at/ > > > > v4 is here: > > https://lore.kernel.org/keyrings/20231024162024.51260-1-david@sigma-sta= r.at/ > > > > v4 -> v5: > > - Make Kconfig for trust source check scalable as suggested by Jarkko S= akkinen > > - Add Acked-By from Herbert Xu to patch #1 - thanks! > > v3 -> v4: > > - Split changes on MAINTAINERS and documentation into dedicated patches > > - Use more concise wording in commit messages as suggested by Jarkko Sa= kkinen > > v2 -> v3: > > - Addressed review comments from Jarkko Sakkinen > > v1 -> v2: > > - Revive and rebase to latest version > > - Include review comments from Ahmad Fatoum > > > > The Data CoProcessor (DCP) is an IP core built into many NXP SoCs such > > as i.mx6ull. > > > > Similar to the CAAM engine used in more powerful SoCs, DCP can AES- > > encrypt/decrypt user data using a unique, never-disclosed, > > device-specific key. Unlike CAAM though, it cannot directly wrap and > > unwrap blobs in hardware. As DCP offers only the bare minimum feature > > set and a blob mechanism needs aid from software. A blob in this case > > is a piece of sensitive data (e.g. a key) that is encrypted and > > authenticated using the device-specific key so that unwrapping can only > > be done on the hardware where the blob was wrapped. > > > > This patch series adds a DCP based, trusted-key backend and is similar > > in spirit to the one by Ahmad Fatoum [0] that does the same for CAAM. > > It is of interest for similar use cases as the CAAM patch set, but for > > lower end devices, where CAAM is not available. > > > > Because constructing and parsing the blob has to happen in software, > > we needed to decide on a blob format and chose the following: > > > > struct dcp_blob_fmt { > > __u8 fmt_version; > > __u8 blob_key[AES_KEYSIZE_128]; > > __u8 nonce[AES_KEYSIZE_128]; > > __le32 payload_len; > > __u8 payload[]; > > } __packed; > > > > The `fmt_version` is currently 1. > > > > The encrypted key is stored in the payload area. It is AES-128-GCM > > encrypted using `blob_key` and `nonce`, GCM auth tag is attached at > > the end of the payload (`payload_len` does not include the size of > > the auth tag). > > > > The `blob_key` itself is encrypted in AES-128-ECB mode by DCP using > > the OTP or UNIQUE device key. A new `blob_key` and `nonce` are generate= d > > randomly, when sealing/exporting the DCP blob. > > > > This patchset was tested with dm-crypt on an i.MX6ULL board. > > > > [0] https://lore.kernel.org/keyrings/20220513145705.2080323-1-a.fatoum@= pengutronix.de/ > > > > David Gstir (6): > > crypto: mxs-dcp: Add support for hardware-bound keys > > KEYS: trusted: improve scalability of trust source config > > KEYS: trusted: Introduce NXP DCP-backed trusted keys > > MAINTAINERS: add entry for DCP-based trusted keys > > docs: document DCP-backed trusted keys kernel params > > docs: trusted-encrypted: add DCP as new trust source > > > > .../admin-guide/kernel-parameters.txt | 13 + > > .../security/keys/trusted-encrypted.rst | 85 +++++ > > MAINTAINERS | 9 + > > drivers/crypto/mxs-dcp.c | 104 +++++- > > include/keys/trusted_dcp.h | 11 + > > include/soc/fsl/dcp.h | 17 + > > security/keys/trusted-keys/Kconfig | 18 +- > > security/keys/trusted-keys/Makefile | 2 + > > security/keys/trusted-keys/trusted_core.c | 6 +- > > security/keys/trusted-keys/trusted_dcp.c | 311 ++++++++++++++++++ > > 10 files changed, 562 insertions(+), 14 deletions(-) > > create mode 100644 include/keys/trusted_dcp.h > > create mode 100644 include/soc/fsl/dcp.h > > create mode 100644 security/keys/trusted-keys/trusted_dcp.c > > Jarkko, Mimi, David - if this patchset isn't already in your review > queue, can you take a look at it from a security/keys perspective? > > Thanks. I gave my 5 cents. I had no intention not to review it, somehow just slipped. I try to do my best but sometimes this still does happen :-) So please ping me if there is radio silence.=20 BR, Jarkko