[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <VI1PR0401MB25917848BA4AF6626E8DF1AD98A60@VI1PR0401MB2591.eurprd04.prod.outlook.com>
Date: Wed, 19 Jul 2017 16:53:21 +0000
From: Horia Geantă <horia.geanta@....com>
To: Oleksij Rempel <ore@...gutronix.de>
CC: Oleksij Rempel <o.rempel@...gutronix.de>,
"kernel@...gutronix.de" <kernel@...gutronix.de>,
Dan Douglass <dan.douglass@....com>,
Herbert Xu <herbert@...dor.apana.org.au>,
"David S. Miller" <davem@...emloft.net>,
"linux-crypto@...r.kernel.org" <linux-crypto@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"Harald Freudenberger" <freude@...ux.vnet.ibm.com>,
Martin Schwidefsky <schwidefsky@...ibm.com>
Subject: Re: [PATCH v1] crypto: caam - set hwrng quality level
On 7/19/2017 7:32 PM, Oleksij Rempel wrote:
> On Wed, Jul 19, 2017 at 12:49:47PM +0000, Horia Geantă wrote:
>> On 7/19/2017 10:45 AM, Oleksij Rempel wrote:
>>> According documentation, it is NIST certified TRNG.
>>> So, set high quality to let the HWRNG framework automatically use it.
>>>
>>> Signed-off-by: Oleksij Rempel <o.rempel@...gutronix.de>
>>> ---
>>> drivers/crypto/caam/caamrng.c | 6 ++++++
>>> 1 file changed, 6 insertions(+)
>>>
>>> diff --git a/drivers/crypto/caam/caamrng.c b/drivers/crypto/caam/caamrng.c
>>> index 41398da3edf4..684c0bc88dfd 100644
>>> --- a/drivers/crypto/caam/caamrng.c
>>> +++ b/drivers/crypto/caam/caamrng.c
>>> @@ -292,10 +292,16 @@ static int caam_init_rng(struct caam_rng_ctx *ctx, struct device *jrdev)
>>> return 0;
>>> }
>>>
>>> +/*
>>> + * hwrng register struct
>>> + * The trng is suppost to have 100% entropy, and thus
>>> + * we register with a very high quality value.
>>> + */
>>> static struct hwrng caam_rng = {
>>> .name = "rng-caam",
>>> .cleanup = caam_cleanup,
>>> .read = caam_read,
>>> + .quality = 999,
>>
>> Why not 1024, i.e. where is 999 coming from?
>
> It comes from s390-trng.c driver.
> Should I use 1024 instead?
>
AFAICT the range for quality is from 0 to 1024 (no entropy -> perfect
entropy).
1024 should be used since I'd expect a HW TRNG to provide perfect
entropy unless otherwise stated.
[Cc-ing Harald and Martin for awareness wrt. s390/trng.]
Thanks,
Horia
Powered by blists - more mailing lists