Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4931012yba; Mon, 13 May 2019 02:14:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqyVkUIJT8GNt8XQAJpiXhWS+beZwtrQKotm29nQrGyGBle4T9oLTFgJEsiTijy2/fQZI60p X-Received: by 2002:a17:902:9a9:: with SMTP id 38mr29591563pln.10.1557738894446; Mon, 13 May 2019 02:14:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557738894; cv=none; d=google.com; s=arc-20160816; b=VJ4q5KLgWfQ+ZA6ChWJI6KugdCxsePPL7QtBTs/nQ/9ZvO2m8lOfvYAqALWrJi7xkn PWF+4oefGIVx6cEKCHb81IOPp+vB6H3CAoowqnnY0Rl70k8nVxkd7gtw3TNxZUqXxG/V BZ29avmB+s22ckcrVK0gXlr+68j/EVcJDECpg1ok/eMsZKJYZliYhej+729WA+iOujCS 5bqe7CCKNn7D4fOIINuvFUVrLhIuoDwOQdUL5JDRlhr7t5K92J5by4rEKUH72gwigqV2 eJ3QSbujyATZxwGHSxzpjYkjPsZVrVBGyWkEKBpnP4JXaDSM5gjoAmbmkD4iXvnhPq8D i22g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:user-agent:in-reply-to :content-disposition:mime-version:references:subject:cc:to:from:date; bh=yYKzvavMVoaxjZLCO67nE0ftJAiGR7ZsJMnqP8gzszU=; b=iS9UEVXGfI/cLaIK4pI30c2J9eS9Kskz9GBkFrdtxK7ap6mcGdLwPMGQ5pHFGojO0x y+qjbBYxFxxEuD9/m1kqhrmTHMM5mWLhu1IRTIL5WInTwipUQJnbmT8THV+3icJJJRir Bzryu5Ow3O+oT/bBjXBOTITAWEN0qDLoJx45jtrhw3xCtA6GhD6NINs3hYZatbxkYGqq wizuUBI/XEHkeV18GmjCcw/bjEjW3L46US+1k0Y3KIktnyhW2CTO8aYpbyCqDUpYjvag 64g7VQCCCV51OZCF2XEae0WXhpwtGvRIft6U7WRsLV5nD9AXQLjcabdpOTOMQF/J5sqR Vl8w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l190si2088270pga.255.2019.05.13.02.14.37; Mon, 13 May 2019 02:14:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728306AbfEMIm0 (ORCPT + 99 others); Mon, 13 May 2019 04:42:26 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:38486 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727589AbfEMImZ (ORCPT ); Mon, 13 May 2019 04:42:25 -0400 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x4D8gMdC105466 for ; Mon, 13 May 2019 04:42:24 -0400 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0b-001b2d01.pphosted.com with ESMTP id 2sf55rraj3-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 13 May 2019 04:42:23 -0400 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 13 May 2019 09:42:12 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp01.uk.ibm.com (192.168.101.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Mon, 13 May 2019 09:42:07 +0100 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x4D8g6bD45220054 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 May 2019 08:42:06 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2DE954C063; Mon, 13 May 2019 08:42:06 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 819424C046; Mon, 13 May 2019 08:42:04 +0000 (GMT) Received: from rapoport-lnx (unknown [9.148.207.235]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Mon, 13 May 2019 08:42:04 +0000 (GMT) Date: Mon, 13 May 2019 11:42:02 +0300 From: Mike Rapoport To: Hsin-Yi Wang Cc: linux-arm-kernel@lists.infradead.org, Rob Herring , Mark Rutland , Frank Rowand , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Stephen Boyd , Kees Cook , Rasmus Villemoes , boot-architecture@lists.linaro.org, Catalin Marinas , Will Deacon , Andrew Morton , Michal Hocko , Ard Biesheuvel , Miles Chen , James Morse , Andrew Murray Subject: Re: [PATCH v2 1/2] fdt: add support for rng-seed References: <20190513003819.356-1-hsinyi@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190513003819.356-1-hsinyi@chromium.org> User-Agent: Mutt/1.5.24 (2015-08-30) X-TM-AS-GCONF: 00 x-cbid: 19051308-4275-0000-0000-00000334205C X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19051308-4276-0000-0000-000038439B18 Message-Id: <20190513084201.GA9271@rapoport-lnx> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-05-13_05:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1905130063 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 13, 2019 at 08:38:18AM +0800, Hsin-Yi Wang wrote: > Introducing a chosen node, rng-seed, which is an entropy that can be > passed to kernel called very early to increase initial device > randomness. Bootloader should provide this entropy and the value is > read from /chosen/rng-seed in DT. > > Signed-off-by: Hsin-Yi Wang > --- > change log: > v1->v2: > * call function in early_init_dt_scan_chosen > * will add doc to devicetree-org/dt-schema on github if this is accepted > --- > Documentation/devicetree/bindings/chosen.txt | 14 ++++++++++++++ > drivers/of/fdt.c | 11 +++++++++++ > 2 files changed, 25 insertions(+) > > diff --git a/Documentation/devicetree/bindings/chosen.txt b/Documentation/devicetree/bindings/chosen.txt > index 45e79172a646..fef5c82672dc 100644 > --- a/Documentation/devicetree/bindings/chosen.txt > +++ b/Documentation/devicetree/bindings/chosen.txt > @@ -28,6 +28,20 @@ mode) when EFI_RNG_PROTOCOL is supported, it will be overwritten by > the Linux EFI stub (which will populate the property itself, using > EFI_RNG_PROTOCOL). > > +rng-seed > +----------- > + > +This property served as an entropy to add device randomness. It is parsed > +as a byte array, e.g. > + > +/ { > + chosen { > + rng-seed = <0x31 0x95 0x1b 0x3c 0xc9 0xfa 0xb3 ...>; > + }; > +}; > + > +This random value should be provided by bootloader. > + > stdout-path > ----------- > > diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c > index de893c9616a1..96ea5eba9dd5 100644 > --- a/drivers/of/fdt.c > +++ b/drivers/of/fdt.c > @@ -24,6 +24,7 @@ > #include > #include > #include > +#include > > #include /* for COMMAND_LINE_SIZE */ > #include > @@ -1079,6 +1080,7 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname, > { > int l; > const char *p; > + const void *rng_seed; > > pr_debug("search \"chosen\", depth: %d, uname: %s\n", depth, uname); > > @@ -1113,6 +1115,15 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname, > > pr_debug("Command line is: %s\n", (char*)data); > > + rng_seed = of_get_flat_dt_prop(node, "rng-seed", &l); > + if (!rng_seed || l == 0) > + return 1; > + > + /* try to clear seed so it won't be found. */ > + fdt_nop_property(initial_boot_params, node, "rng-seed"); > + > + add_device_randomness(rng_seed, l); Please fix the indentation. > + > /* break now */ > return 1; > } > -- > 2.20.1 > -- Sincerely yours, Mike.