[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <DB6PR0802MB25332C489D7165C8BAC2232FE9F00@DB6PR0802MB2533.eurprd08.prod.outlook.com>
Date: Mon, 23 Mar 2020 19:50:54 +0000
From: Hadar Gat <Hadar.Gat@....com>
To: Rouven Czerwinski <r.czerwinski@...gutronix.de>,
Matt Mackall <mpm@...enic.com>,
Herbert Xu <herbert@...dor.apana.org.au>,
Rob Herring <robh+dt@...nel.org>,
Mark Rutland <Mark.Rutland@....com>,
Arnd Bergmann <arnd@...db.de>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Krzysztof Kozlowski <krzk@...nel.org>,
Florian Fainelli <f.fainelli@...il.com>,
Alexander Sverdlin <alexander.sverdlin@...ia.com>,
Thomas Gleixner <tglx@...utronix.de>,
Tomer Maimon <tmaimon77@...il.com>,
Randy Dunlap <rdunlap@...radead.org>,
Zaibo Xu <xuzaibo@...wei.com>,
Daniel Thompson <daniel.thompson@...aro.org>,
Mauro Carvalho Chehab <mchehab+samsung@...nel.org>,
"David S. Miller" <davem@...emloft.net>,
Jonathan Cameron <Jonathan.Cameron@...wei.com>
CC: "linux-crypto@...r.kernel.org" <linux-crypto@...r.kernel.org>,
"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Gilad Ben-Yossef <gilad@...yossef.com>,
Ofir Drang <Ofir.Drang@....com>, nd <nd@....com>
Subject: RE: [PATCH v5 2/3] hw_random: cctrng: introduce Arm CryptoCell driver
Hi Rouven,
>
> Hello Hadar,
>
> On Sun, 2020-03-22 at 17:31 +0200, Hadar Gat wrote:
> > Introduce low level Arm CryptoCell TRNG HW support.
> >
> > Signed-off-by: Hadar Gat <hadar.gat@....com>
> > ---
> > drivers/char/hw_random/Kconfig | 12 +
> > drivers/char/hw_random/Makefile | 1 +
> > drivers/char/hw_random/cctrng.c | 735
> > ++++++++++++++++++++++++++++++++++++++++
> > drivers/char/hw_random/cctrng.h | 69 ++++
> > 4 files changed, 817 insertions(+)
> > create mode 100644 drivers/char/hw_random/cctrng.c create mode
> > 100644 drivers/char/hw_random/cctrng.h
> >
> > [...]
> > +static int cctrng_probe(struct platform_device *pdev) {
> > + struct resource *req_mem_cc_regs = NULL;
> > + struct cctrng_drvdata *drvdata;
> > + struct device *dev = &pdev->dev;
> > + int rc = 0;
> > + u32 val;
> > + int irq;
> > +
> > + drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL);
> > + if (!drvdata)
> > + return -ENOMEM;
> > +
> > + drvdata->rng.name = devm_kstrdup(dev, dev_name(dev),
> > GFP_KERNEL);
> > + if (!drvdata->rng.name)
> > + return -ENOMEM;
> > +
> > + drvdata->rng.read = cctrng_read;
> > + drvdata->rng.priv = (unsigned long)drvdata;
>
> You are not initializing drvdata->rng.quality to a default value, which results in
> the TRNG not being used by the kernel by default. If its a perfect TRNG this
> should be set to 1024, i.e. 1024 bits of entropy per
> 1024 bits of input.
Thanks for noticing. I'll fix that.
>
> Regards,
> Rouven Czerwinski
Thanks,
Hadar
Powered by blists - more mailing lists