Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp262612pxb; Wed, 25 Aug 2021 02:35:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxqLf4O98SyRWSOWweMEannxi1M7PSVDiE11+pFZPdbsO8dq9PhwcidvgmiwTrq0Pdgbq0Z X-Received: by 2002:a05:6638:1504:: with SMTP id b4mr36498765jat.144.1629884115486; Wed, 25 Aug 2021 02:35:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629884115; cv=none; d=google.com; s=arc-20160816; b=w7AKVjrhPCx9xSeCAl/FiCUvIIt8WnRSn0X8YJkMVwgTZw4p12IfNW9PoXVNTMtj3H ZvyucFFe0/wD1fMv2pk28OtEKjEjP6y7UcqD/7Xuq84lNQ7lxhIqE0XQQTgvCMWJYaH6 FfMRIuVhRuex5iQnXMIenwOK5ZoN5ixZTXHRUa4w8dnfWpAbJHAQF6QYNRTrp2QZy7F+ cweH6wx5J+8wHHYP/QLoJe8Fi8Pm47osi7iymukvqdKey69TFOwz9RcaoZsFIA5Nto6d S8WWhnSDu6VHMiwHl0oC+gTuAab05XXXeWv51qxSBggvlizUur1/MoPQCH/TYc4VtmZA jwcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=aCOz80xapTNl7fpknbEB0iDMKM2u4fTH4m/Suq0S+OY=; b=UUYq1ovUwtCgfFGjD1kcUfvnaWKEUHk//9x4PU8pU8uxn8DAwsU7D8pTNBDDFRn2rS Ijbx8Qy7vcACv+IKIzbe4wYLve3x8rJRY/lTwMa3kuDuC9SjYmePy0hq/kpG41Fcv1DY LsJhIBkx3GVHb2SHIT6kF34DJsywQlk6O+4NEzXyoTRlV3XJL1s/xkG9pn94oKHVsXW5 e8UbsYcApBJc2N1xq8uxQ2cj80FAmQ9gI6OOCkB+TstOMpEmwbyDmWt9IR6PFfpp8UzX KRT1VnRYgbP8LS3Q824zGA+TL/TXH7MKL6YQ9a8AQ2PVMmuL52kLKJoDGvDIQs4mgDw0 rSnQ== ARC-Authentication-Results: i=1; mx.google.com; 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 k17si13049813iow.29.2021.08.25.02.34.52; Wed, 25 Aug 2021 02:35:15 -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; 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 S239663AbhHYJez (ORCPT + 99 others); Wed, 25 Aug 2021 05:34:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237008AbhHYJez (ORCPT ); Wed, 25 Aug 2021 05:34:55 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C312EC061757 for ; Wed, 25 Aug 2021 02:34:09 -0700 (PDT) Received: from gallifrey.ext.pengutronix.de ([2001:67c:670:201:5054:ff:fe8d:eefb] helo=[IPv6:::1]) by metis.ext.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1mIpIL-0003oy-7B; Wed, 25 Aug 2021 11:34:05 +0200 Subject: Re: [PATCH 0/4] KEYS: trusted: Introduce support for NXP CAAM-based trusted keys To: Tim Harvey Cc: David Gstir , Aymen Sghaier , Mimi Zohar , Jan Luebbe , keyrings@vger.kernel.org, Steffen Trumtrar , linux-security-module@vger.kernel.org, Udit Agarwal , Herbert Xu , =?UTF-8?Q?Horia_Geant=c4=83?= , Richard Weinberger , James Morris , Eric Biggers , "Serge E. Hallyn" , Sumit Garg , James Bottomley , Franck LENORMAND , David Howells , open list , Jarkko Sakkinen , linux-crypto@vger.kernel.org, Sascha Hauer , linux-integrity@vger.kernel.org, "David S. Miller" References: <2b48a848-d70b-9c43-5ca0-9ab72622ed12@pengutronix.de> <9200d46d-94a2-befd-e9b0-93036e56eb8a@pengutronix.de> <8b559c9c-a4c0-d335-5e54-40b9acc08707@pengutronix.de> From: Ahmad Fatoum Message-ID: <2b5b1722-7934-045e-1807-075278041ae7@pengutronix.de> Date: Wed, 25 Aug 2021 11:34:00 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 2001:67c:670:201:5054:ff:fe8d:eefb X-SA-Exim-Mail-From: a.fatoum@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-crypto@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On 24.08.21 17:23, Tim Harvey wrote: > On Tue, Aug 24, 2021 at 12:33 AM Ahmad Fatoum wrote: >> >> On 23.08.21 19:50, Tim Harvey wrote: >>> On Mon, Aug 23, 2021 at 6:29 AM Ahmad Fatoum wrote: >>>> On 20.08.21 23:19, Tim Harvey wrote: >>>>> On Fri, Aug 20, 2021 at 1:36 PM Ahmad Fatoum wrote: >>>>>> On 20.08.21 22:20, Tim Harvey wrote: >>>>> It works for a user keyring but not a session keyring... does that >>>>> explain anything? >>>>> # keyctl add trusted mykey 'new 32' @u >>>>> 941210782 >>>>> # keyctl print 941210782 >>>>> 83b7845cb45216496aead9ee2c6a406f587d64aad47bddc539d8947a247e618798d9306b36398b5dc2722a4c3f220a3a763ee175f6bd64758fdd49ca4db597e8ce328121b60edbba9b8d8d55056be896 >>>>> # keyctl add trusted mykey 'new 32' @s >>>>> 310571960 >>>>> # keyctl print 310571960 >>>>> keyctl_read_alloc: Unknown error 126 >>>> >>>> Both sequences work for me. >>>> >>>> My getty is started by systemd. I think systemd allocates a new session >>>> keyring for the getty that's inherited by the shell and the commands I run >>>> it in. If you don't do that, each command will get its own session key. >>>> >>>>> Sorry, I'm still trying to wrap my head around the differences in >>>>> keyrings and trusted vs user keys. >>>> >>>> No problem. HTH. >>> >>> Ahmad, >>> >>> Ok that explains it - my testing is using a very basic buildroot >>> ramdisk rootfs. If I do a 'keyctl new_session' first I can use the >>> system keyring fine as well. >> >> Great. Does this mean I can get your Tested-by: ? :) >> > > Absolutely, > > For the series: > > I tested this series on top of v5.14.rc-7 on a Gateworks > imx8mm-venice-gw73xx board with kernel param trusted.source=caam and > keyutils-1.6: > # keyctl new_session > 22544757 > # keyctl add trusted mykey 'new 32' @s > 160701809 > # keyctl print 160701809 > 990e03aa4515aee420eede17e26a58d0c5568c8bd2c9c2ee2f22a0583181d20d4f65cf9cb1f944a3cc92c0e3184a44a29a7e511f0a55a6af11a70ac2b2924514002475e73ae09820042896b9ee00a5ec > > Tested-By: Tim Harvey Thanks. I'll apply it to the whole series then. > One more question: I've got a user that wants to blob/deblob generic > data. They can use the caam_encap_blob/caam_decap_blob functions in > kernel code but could you give me a suggestion for how they could use > this in: > a) userspace code (using the keyctl syscall I assume) > b) userspace cmdline (via keyutils I assume) Trusted keys aren't disclosed to userspace in plain text, only in sealed form (bar vulnerabilities of course). Cheers, Ahmad > > Many thanks, > > Tim > -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |