Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp1246750ybg; Tue, 2 Jun 2020 05:15:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyfSLb6ELwHtHqDnGVwCD2Ig2JLr+GhUnMvuF2QjfcSwm32xTYeTVa2mMDXQkdrgC4IIdLb X-Received: by 2002:a17:906:2610:: with SMTP id h16mr24887515ejc.423.1591100127886; Tue, 02 Jun 2020 05:15:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591100127; cv=none; d=google.com; s=arc-20160816; b=lon+FRA5Yqd95CS//jjwfReUOdRqiPrwk+xL7Xo2YyR+qhD9duQOlZHYiD3kcSALxp yGXy3dPtY3Y2XMubUXGYTBUqOdBjHUENRI7+lnV37kilJo3O65BdxeWy4qwER2RBThDt U4K0KrBkoWmGaTd/yuTt08xKf7dnukENl3sKQ1VnFNkHxUv0k2OzukyMQH+SUNyh3rxA +bpd9TQaRNaJLFxRxRWC2/ZIaKRRrj8c5FcbXvTDYpHKAjRab/Bc2OoyvnZ1jgyhMklq t6Zzi+eQ3loJ3C+sjeQKEbh1RhvPuYe8jCXUqyarH3JJGBB4KDkA9GyKaU/5KZMGO59i xfRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=FW9iC8OKMFpyRv/koB4LU96EXZHr7BXpw3GIUlrhhSs=; b=LDcL3FVAoor2Fm/S7JzQ8ryrLrr9UWjnJLa8/R+SvHCS/CAMdFdDDhbOPZLMwsApWA JYG2AlVxBhsvOWc5CpzcgHEAig++eG/2S4SRG5kHjvWEMvjWqmu2q7YKM/oSRDhx5caU srXo/MYhnS4CQr4GBtmQ9GlgqBbN2OF8jq4YX+IKqO1vSiy5fCvYSKtVfEuhfhw9eFAy 7qzzztZz/v/4kCVFtdUaHnJNNL41EK6DDIL93ythHKckGNZnJqwOEeavWytajCla5f5k KrfYc9PfL0Ifp4NPxz8ZJ1TgFc+GRa5dqng81pVhJahnxV53W9vOatqsVTvx27aTA6qa qKGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="yl/i7Qiq"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n21si1338145eju.448.2020.06.02.05.14.58; Tue, 02 Jun 2020 05:15:27 -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; dkim=pass header.i=@kernel.org header.s=default header.b="yl/i7Qiq"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725940AbgFBMOq (ORCPT + 99 others); Tue, 2 Jun 2020 08:14:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:55142 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725921AbgFBMOq (ORCPT ); Tue, 2 Jun 2020 08:14:46 -0400 Received: from mail-oi1-f169.google.com (mail-oi1-f169.google.com [209.85.167.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8BE6A2068D; Tue, 2 Jun 2020 12:14:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591100085; bh=hS7g9g/aSqZzPJBPg66kKL88fBvDX9aRfUs29YzvkBs=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=yl/i7Qiqq7UoiHmOVqVo+SEn4KgETDEedHdFCdNCuS9f2E2SQng2voWzPfHPcO6YE 8CF1FQSd08KxkT7RlTX59097gDyqNuMBxG3McsUgXYZn1n9qp24KE+RNxGUKVpsrLE /QrUIwIAtq/wHHtTJJMYo7XfANI0AplH+lQth1YE= Received: by mail-oi1-f169.google.com with SMTP id c194so7020383oig.5; Tue, 02 Jun 2020 05:14:45 -0700 (PDT) X-Gm-Message-State: AOAM532rmY1+BQ9CYyDuFLCE6cBO2lFp6FW3CClAI+rFysYQbJT/FXPy M54+9xkJyfwX2roPJdU0xR9VP8/LUClsqFo7BaQ= X-Received: by 2002:aca:b707:: with SMTP id h7mr2899814oif.174.1591100084934; Tue, 02 Jun 2020 05:14:44 -0700 (PDT) MIME-Version: 1.0 References: <1591085678-22764-1-git-send-email-neal.liu@mediatek.com> In-Reply-To: <1591085678-22764-1-git-send-email-neal.liu@mediatek.com> From: Ard Biesheuvel Date: Tue, 2 Jun 2020 14:14:33 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Security Random Number Generator support To: Neal Liu Cc: Matt Mackall , Herbert Xu , Rob Herring , Matthias Brugger , Sean Wang , Arnd Bergmann , Greg Kroah-Hartman , Linux Crypto Mailing List , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Linux ARM , linux-mediatek@lists.infradead.org, lkml , wsd_upstream@mediatek.com, Crystal Guo Content-Type: text/plain; charset="UTF-8" Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Tue, 2 Jun 2020 at 10:15, Neal Liu wrote: > > These patch series introduce a security random number generator > which provides a generic interface to get hardware rnd from Secure > state. The Secure state can be Arm Trusted Firmware(ATF), Trusted > Execution Environment(TEE), or even EL2 hypervisor. > > Patch #1..2 adds sec-rng kernel driver for Trustzone based SoCs. > For security awareness SoCs on ARMv8 with TrustZone enabled, > peripherals like entropy sources is not accessible from normal world > (linux) and rather accessible from secure world (HYP/ATF/TEE) only. > This driver aims to provide a generic interface to Arm Trusted > Firmware or Hypervisor rng service. > > > changes since v1: > - rename mt67xx-rng to mtk-sec-rng since all MediaTek ARMv8 SoCs can reuse > this driver. > - refine coding style and unnecessary check. > > changes since v2: > - remove unused comments. > - remove redundant variable. > > changes since v3: > - add dt-bindings for MediaTek rng with TrustZone enabled. > - revise HWRNG SMC call fid. > > changes since v4: > - move bindings to the arm/firmware directory. > - revise driver init flow to check more property. > > changes since v5: > - refactor to more generic security rng driver which > is not platform specific. > > *** BLURB HERE *** > > Neal Liu (2): > dt-bindings: rng: add bindings for sec-rng > hwrng: add sec-rng driver > There is no reason to model a SMC call as a driver, and represent it via a DT node like this. It would be much better if this SMC interface is made truly generic, and wired into the arch_get_random() interface, which can be used much earlier. > .../devicetree/bindings/rng/sec-rng.yaml | 53 ++++++ > drivers/char/hw_random/Kconfig | 13 ++ > drivers/char/hw_random/Makefile | 1 + > drivers/char/hw_random/sec-rng.c | 155 ++++++++++++++++++ > 4 files changed, 222 insertions(+) > create mode 100644 Documentation/devicetree/bindings/rng/sec-rng.yaml > create mode 100644 drivers/char/hw_random/sec-rng.c > > -- > 2.18.0