From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E179DC433DB for ; Wed, 10 Mar 2021 08:48:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B8DBC64FEE for ; Wed, 10 Mar 2021 08:48:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232424AbhCJIsQ (ORCPT ); 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