Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp432025lqo; Fri, 10 May 2024 04:36:43 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVyK6/e4CShjsMg7FACSHZcfYUGAcp9erRAl1n+RFW2uG9kUvL1LS8t9ntvMH1hlo2HYorBnfQF/nOuebqtKiu2IsplWb/e/rOPklaKFQ== X-Google-Smtp-Source: AGHT+IHlX8WkhYYi3ltGObIDtGwt0Gp3h03cxKqfhNjqwjFdC7JRe36sTnl/Sy9i0sYe7/gH3h1E X-Received: by 2002:a05:620a:1a87:b0:792:987b:30df with SMTP id af79cd13be357-792c75f5641mr252786285a.56.1715341003334; Fri, 10 May 2024 04:36:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715341003; cv=pass; d=google.com; s=arc-20160816; b=tWxg8tmouzyRfWgNL902jjtUNz1AsD/PgaYgZuObcEnSqCiXTo3j2cYEtjDEjLKuNZ VLjUm7yfRF8m/r9xgowdf+vJeXPLMp/OvUREk0NBtUtDE8oe9ljsvboDcPEbTDXFu7Zd ftXfLVqWAtsLJhNoh/K/6bZKIEG47rcmrvz535HzkHPd+C8qyyWBfu19ytfYktANzvoH 1yp2xXeHB8myyL9zw743T45X3bzPRXXPu1m53/iTcErogyQ95yy09ptVbHQUFVUIu5e8 IOQvW6GRKB3vKEiCJYZ7ZmqBsHuZABa7S1BlUbutGfg4YD6AtlpJ/sCpSfF8rByB0Ajv imPQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=7vC2Tqdfflj1i5KZ7PLOxn1zleKGd6f0z8DCjKohx+E=; fh=zeQTmNR9wYYmyLOjJSpFyhPEg0jcMiQNHi9tzBge3kA=; b=Avo3Ach8cXCq7L27hXW64bitFvbzUQqc2gTBkF97sdzHUowmCWjikc3SMmrSk5rOKz VeTpsvRjBmFavN70EIwgl+4sarmlyw1DiKkyeYo7Q5WyVKI/yMdu/ObRCCR4cYjk1bOo PbAxXEF+ibnZoFrIrLH8cppZRLhWpwu9eGwVKbrm551uc6I1knxcTxuDVAyRphPGEZPk eCmfDHwYTOnqh2kbOKqRFZxW9Ss1bCbc1GvgBxY1mmnYI0iQqDMUI/LuhwLd5XtefOiI PI5JjNSbV5S4EKRdMmKhy5H0OJY/gsb8UQ4O7Ah8mwQPJzWR38xTlZHCUECVRqKqiwSJ JAXg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b=dpOL9w+H; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-crypto+bounces-4105-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-crypto+bounces-4105-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id af79cd13be357-792bf30a951si333922685a.356.2024.05.10.04.36.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 May 2024 04:36:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto+bounces-4105-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b=dpOL9w+H; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-crypto+bounces-4105-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-crypto+bounces-4105-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 452D91C23BA5 for ; Fri, 10 May 2024 11:36:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 46360177990; Fri, 10 May 2024 11:32:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="dpOL9w+H" X-Original-To: linux-crypto@vger.kernel.org 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 012751649A7 for ; Fri, 10 May 2024 11:32:03 +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=1715340724; cv=none; b=tXa49VccLtGiyq1Lx+u/YpxP4wJnWy9+QQfno4ysXQriUsL4q3QJilwMkKne3lFhvn6n/nMR+qz8BatVrQ+w7YC+7BjCuU36NoYWYC1vQluGmS3+mRRPMiHN8lffsgei/YFbPlqjl1+IhkEmcRi4D+GYmrfaMdUVoGA0UlLKlTE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715340724; c=relaxed/simple; bh=drMv/g0jecfbRSv2iSr91jjAR6eQhsu1iQZBbSuv4DU=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Vn+pyWZuC8uOYgpU2vIc0egvJ1OWltMzIC6LeD90zuRLySQTBrdQikQsD3sVxoLrfO9cbDvbPpy9TWrH187mLsAo6tUQ9SGEsIgokBGNB+3z5WmClfmDmyb9JthqmvaFi47quIB9q317urIgBaxIUz9dzHKShGkAw4Z0aFl01cs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=dpOL9w+H; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id BC2C4C113CC; Fri, 10 May 2024 11:32:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715340723; bh=drMv/g0jecfbRSv2iSr91jjAR6eQhsu1iQZBbSuv4DU=; h=Date:From:To:List-Id:Cc:Subject:In-Reply-To:References:From; b=dpOL9w+HELHrktG70FTlpNI9KpzRHbkLPRih1bqkshGUu7VX1Xz017/ZShN9qAvzZ mpYbQFskyWuI9pdL28E0q/0VgpqtmeI5xqq7jr5LeZnMp1f9b0NMQUIED00qmY7Fhx k6mLLdd6uJu9U8OydY+5c5mDtwWeI+BIdNDUNfGLn9Tkd8u+qrQYewV4gNW6hTHfn4 msOVqzOzcUxRNwRsdyqcBGZlmZEHdiB9Bj90/HvAoDz1iSkODhS1p3CSnY+NZgW7yL oTa95jgYfP3Yo6k84gnIY8bWv2mptrU2HHQ7xc7svD8GU71mVi7x0REvXRlcVWIQzb PrE52rtmg1p3w== Date: Fri, 10 May 2024 13:31:58 +0200 From: Marek =?UTF-8?B?QmVow7pu?= To: Greg Kroah-Hartman Cc: Gregory CLEMENT , Arnd Bergmann , soc@kernel.org, arm@kernel.org, Andy Shevchenko , Hans de Goede , Ilpo =?UTF-8?B?SsOkcnZpbmVu?= , linux-crypto@vger.kernel.org, Dan Carpenter Subject: Re: [PATCH v10 7/9] platform: cznic: turris-omnia-mcu: Add support for digital message signing via debugfs Message-ID: <20240510133158.2f40ee55@dellmb> In-Reply-To: <2024051007-rendering-borrowing-ffc5@gregkh> References: <20240510101819.13551-1-kabel@kernel.org> <20240510101819.13551-8-kabel@kernel.org> <2024051007-rendering-borrowing-ffc5@gregkh> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.41; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Fri, 10 May 2024 11:52:56 +0100 Greg Kroah-Hartman wrote: > On Fri, May 10, 2024 at 12:18:17PM +0200, Marek Beh=C3=BAn wrote: > > Add support for digital message signing with private key stored in the > > MCU. Boards with MKL MCUs have a NIST256p ECDSA private key created > > when manufactured. The private key is not readable from the MCU, but > > MCU allows for signing messages with it and retrieving the public key. > >=20 > > As described in a similar commit 50524d787de3 ("firmware: > > turris-mox-rwtm: support ECDSA signatures via debugfs"): > > The optimal solution would be to register an akcipher provider via > > kernel's crypto API, but crypto API does not yet support accessing > > akcipher API from userspace (and probably won't for some time, see > > https://www.spinics.net/lists/linux-crypto/msg38388.html). > >=20 > > Therefore we add support for accessing this signature generation > > mechanism via debugfs for now, so that userspace can access it. =20 >=20 > Having a "real" user/kernel api in debugfs feels wrong here, why would > you not do this properly? On most, if not all, systems, debugfs is > locked down so you do not have access to it, as it is only there for > debugging. So how is a user supposed to use this feature if they can't > get access to it? >=20 > And debugfs files can be changed at any time, so how can you ensure that > your new api will always be there? >=20 > In other words, please solve this properly, do not just add a hack into > debugfs that no one can use as that is not a good idea. Hi Greg, this is the same thing we discussed 5 years ago, I wanted to implement it via crypto's akcipher, but was refused due to https://www.spinics.net/lists/linux-crypto/msg38388.html I've then exposed this via debugfs in the turris-mox-rwtm driver 4 years ago, and we have supported this in our utility scripts, with the plan that to reimplement it in the kernel via the correct ABI once akcipher (or other ABI) is available to userspace, but AFAIK after 5 years this is still not the case :-( If not debugfs and not akcipher, another option is to expose this via sysfs, but that also doesn't seem right, and if I recall correctly you also disapproved of this 5 years ago. The last option would be to create another device, something like /dev/turris-crypto for this. I wanted to avoid that and wait for akcipher to be exposed do crypto since another /dev device must be supported forever, while debugfs implementation can be removed once this is supported via standardized ABI. Do you have any suggestions? Marek