Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp87435pxf; Wed, 10 Mar 2021 00:51:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJyxXJdgbXOq7JVtN40oCqDDDLbJgV50HTN0rzB2rUvFO1Z+wYE7xt+wa0fAks06H4Zm11bo X-Received: by 2002:aa7:d294:: with SMTP id w20mr2093831edq.68.1615366275518; Wed, 10 Mar 2021 00:51:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615366275; cv=none; d=google.com; s=arc-20160816; b=QgAeUj8oo26ZdMFz+WvsircGqaGcrfRPhDoUM7Txd/jkp6E6dqF5RD9oJfAZEJJJ6l Xkqd7/+q/L8EaFOOaL+y7JfBlY4yFjrtGUAUWx56A1rq4xybx/XyjXnjHdtMt0yQIuoG 8HjTNl6TDDYq59bz+pBBfkqb3Ll8vMAWprNSqZGabNPmEZPlheXYMuKM5lv6xPo7puwn /tTa5VI1qN0kzMViGjQNv6W7576e8Zt/xwaEh/8FYQK4Tax0003cnJKje9LQaDAVXzgU bhm7/mlOEiJmk+sClEgrND2l+ngkhdrRkbD5fZvvip98xpy2ALpniR7/dKmK84EIcZLq HxrA== 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:subject:from :references:cc:to; bh=zyUbLRdLSL+l9wnvdmT7HNy2aV49CBNCmatJB9o80sk=; b=se+fP0v0My5APSws3ueqr0y1B518yA4WkanU5Bx+7R2psWwdUIUbW7NXhK2cJr83N4 FnOky2ZYfB3nOhPMNK8IZ8mp9gBRuzJ9TIiHXCjswmbv6S1kreuk+YYB7F6tV6XhXNmJ xQn6fsmAmwJiwixn0yBaibtHVYJC2g3gzzvnZ+qBAOp4SjjnORABvLrb8G7W9jTq8XhS qRohNWtIgt0QuyVK7my43bAD5wVGy3bK58J5/gIt3RmKjwL5pdf8i3nKNSQUkrOR/gUO XdLRMMukg2U2SbSaMtwZW65KMVA0Dt4ixeqVQ0QMbZ8XkY0w39swPPBhobqNI4TBUlYr WXJw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=marcan.st Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c1si774678edt.469.2021.03.10.00.50.52; Wed, 10 Mar 2021 00:51:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-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-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=marcan.st Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232414AbhCJIsQ (ORCPT + 99 others); Wed, 10 Mar 2021 03:48:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232336AbhCJIry (ORCPT ); Wed, 10 Mar 2021 03:47:54 -0500 Received: from mail.marcansoft.com (marcansoft.com [IPv6:2a01:298:fe:f::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16C9EC06174A; Wed, 10 Mar 2021 00:47:54 -0800 (PST) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) (Authenticated sender: marcan@marcan.st) by mail.marcansoft.com (Postfix) with ESMTPSA id 138FD3FA1B; Wed, 10 Mar 2021 08:47:46 +0000 (UTC) To: Sumit Garg , Linus Walleij Cc: Arnd Bergmann , "open list:ASYMMETRIC KEYS" , David Howells , Jarkko Sakkinen , Joakim Bech , =?UTF-8?Q?Alex_Benn=c3=a9e?= , "linux-kernel@vger.kernel.org" , Maxim Uvarov , Ilias Apalodimas , Ruchika Gupta , "Winkler, Tomas" , yang.huang@intel.com, bing.zhu@intel.com, Matti.Moell@opensynergy.com, hmo@opensynergy.com, linux-mmc , linux-scsi , linux-nvme@vger.kernel.org, Ulf Hansson , Arnd Bergmann References: <20210303135500.24673-1-alex.bennee@linaro.org> <20210303135500.24673-2-alex.bennee@linaro.org> <20210305075131.GA15940@goby> <6c542548-cc16-af68-c755-df52bd13b209@marcan.st> From: Hector Martin Subject: Re: [RFC PATCH 1/5] rpmb: add Replay Protected Memory Block (RPMB) subsystem Message-ID: Date: Wed, 10 Mar 2021 17:47:45 +0900 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: es-ES Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/03/2021 14.14, Sumit Garg wrote: > On Wed, 10 Mar 2021 at 02:47, Hector Martin wrote: >> >> On 09/03/2021 01.20, Linus Walleij wrote: >>> I suppose it would be a bit brutal if the kernel would just go in and >>> appropriate any empty RPMB it finds, but I suspect it is the right way >>> to make use of this facility given that so many of them are just sitting >>> there unused. Noone will run $CUSTOM_UTILITY any more than they >>> run the current RPMB tools in mmc-tools. >> >> AIUI the entire thing relies on a shared key that is programmed once >> into the RPMB device, which is a permanent operation. This key has to be >> secure, usually stored on CPU fuses or derived based on such a root of >> trust. To me it would seem ill-advised to attempt to automate this >> process and have the kernel do a permanent take-over of any RPMBs it >> finds (with what key, for one?) :) >> > > Wouldn't it be a good idea to use DT here to represent whether a > particular RPMB is used as a TEE backup or is available for normal > kernel usage? > > In case of normal kernel usage, I think the RPMB key can come from > trusted and encrypted keys subsystem. Remember that if the key is ever lost, the RPMB is now completely useless forever. This is why, as far as I know, most sane platforms will use hard fused values to derive this kind of thing, not any kind of key stored in erasable storage. Also, newly provisioned keys are sent in plain text, which means that any kind of "if the RPMB is blank, take it over" automation equates to handing over your key who an attacker who removes the RPMB and replaces it with a blank one, and then they can go access anything they want on the old RPMB device (assuming the key hasn't changed; and if it has changed that's conversely a recipe for data loss if something goes wrong). I really think trying to automate any kind of "default" usage of an RPMB is a terrible idea. It needs to be a conscious decision on a per-platform basis. -- Hector Martin (marcan@marcan.st) Public Key: https://mrcn.st/pub