All of lore.kernel.org
 help / color / mirror / Atom feed
* cortina/gemini: hwrng: what is its quality ?
@ 2021-04-21 20:03 Corentin Labbe
  2021-04-22  0:14 ` Herbert Xu
  0 siblings, 1 reply; 4+ messages in thread
From: Corentin Labbe @ 2021-04-21 20:03 UTC (permalink / raw)
  To: herbert, linux-crypto; +Cc: linus.walleij, linux-kernel

hello

I work on the crypto part of the cortina/gemini SL3516 SoC.
The datasheet mention a HWRNG in its IP but really briefly:
"""
The implementation is a 32-bit Hardware Random Number Generator that has a uniformed
distribution between 0 and 2^32 -1. The hardware randomness is created by sampling data from
different clock domains, and feeding it as input to the 32-bit maximum length LFSR (Linear Feedback
Shift Register)
"""

Piping its output to rngtest give:
dd if=/dev/hwrng count=2000 bs=2048 | rngtest
rngtest 6.11
rngtest: starting FIPS tests...
rngtest: entropy source drained
rngtest: bits received from input: 32768000
rngtest: FIPS 140-2 successes: 1191
rngtest: FIPS 140-2 failures: 447
rngtest: FIPS 140-2(2001-10-10) Monobit: 183
rngtest: FIPS 140-2(2001-10-10) Poker: 116
rngtest: FIPS 140-2(2001-10-10) Runs: 346
2000+0 records in
2000+0 records out
rngtest: FIPS 140-2(2001-10-10) Long run: 0
rngtest: FIPS 140-2(2001-10-10) Continuous run: 0
rngtest: input channel speed: (min=303.606; avg=3143.352; max=9712.208)Kibits/s
rngtest: FIPS tests speed: (min=7.104; avg=10.332; max=10.638)Mibits/s
rngtest: Program run time: 13303224 microseconds

That's a quite number of failure.
Can the hwrng still be used with some "hwrng->quality" setting ?
Or it is just too many failure to be used ?

Regards

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: cortina/gemini: hwrng: what is its quality ?
  2021-04-21 20:03 cortina/gemini: hwrng: what is its quality ? Corentin Labbe
@ 2021-04-22  0:14 ` Herbert Xu
  2021-04-22  6:52   ` Corentin Labbe
  0 siblings, 1 reply; 4+ messages in thread
From: Herbert Xu @ 2021-04-22  0:14 UTC (permalink / raw)
  To: Corentin Labbe; +Cc: linux-crypto, linus.walleij, linux-kernel

On Wed, Apr 21, 2021 at 10:03:17PM +0200, Corentin Labbe wrote:
> hello
> 
> I work on the crypto part of the cortina/gemini SL3516 SoC.
> The datasheet mention a HWRNG in its IP but really briefly:
> """
> The implementation is a 32-bit Hardware Random Number Generator that has a uniformed
> distribution between 0 and 2^32 -1. The hardware randomness is created by sampling data from
> different clock domains, and feeding it as input to the 32-bit maximum length LFSR (Linear Feedback
> Shift Register)
> """
> 
> Piping its output to rngtest give:
> dd if=/dev/hwrng count=2000 bs=2048 | rngtest
> rngtest 6.11
> rngtest: starting FIPS tests...
> rngtest: entropy source drained
> rngtest: bits received from input: 32768000
> rngtest: FIPS 140-2 successes: 1191
> rngtest: FIPS 140-2 failures: 447
> rngtest: FIPS 140-2(2001-10-10) Monobit: 183
> rngtest: FIPS 140-2(2001-10-10) Poker: 116
> rngtest: FIPS 140-2(2001-10-10) Runs: 346
> 2000+0 records in
> 2000+0 records out
> rngtest: FIPS 140-2(2001-10-10) Long run: 0
> rngtest: FIPS 140-2(2001-10-10) Continuous run: 0
> rngtest: input channel speed: (min=303.606; avg=3143.352; max=9712.208)Kibits/s
> rngtest: FIPS tests speed: (min=7.104; avg=10.332; max=10.638)Mibits/s
> rngtest: Program run time: 13303224 microseconds
> 
> That's a quite number of failure.
> Can the hwrng still be used with some "hwrng->quality" setting ?
> Or it is just too many failure to be used ?

If in doubt just leave it zero and the admin can override it if
necessary.

Thanks,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: cortina/gemini: hwrng: what is its quality ?
  2021-04-22  0:14 ` Herbert Xu
@ 2021-04-22  6:52   ` Corentin Labbe
  2021-04-22  7:21     ` Herbert Xu
  0 siblings, 1 reply; 4+ messages in thread
From: Corentin Labbe @ 2021-04-22  6:52 UTC (permalink / raw)
  To: Herbert Xu; +Cc: linux-crypto, linus.walleij, linux-kernel

Le Thu, Apr 22, 2021 at 10:14:30AM +1000, Herbert Xu a écrit :
> On Wed, Apr 21, 2021 at 10:03:17PM +0200, Corentin Labbe wrote:
> > hello
> > 
> > I work on the crypto part of the cortina/gemini SL3516 SoC.
> > The datasheet mention a HWRNG in its IP but really briefly:
> > """
> > The implementation is a 32-bit Hardware Random Number Generator that has a uniformed
> > distribution between 0 and 2^32 -1. The hardware randomness is created by sampling data from
> > different clock domains, and feeding it as input to the 32-bit maximum length LFSR (Linear Feedback
> > Shift Register)
> > """
> > 
> > Piping its output to rngtest give:
> > dd if=/dev/hwrng count=2000 bs=2048 | rngtest
> > rngtest 6.11
> > rngtest: starting FIPS tests...
> > rngtest: entropy source drained
> > rngtest: bits received from input: 32768000
> > rngtest: FIPS 140-2 successes: 1191
> > rngtest: FIPS 140-2 failures: 447
> > rngtest: FIPS 140-2(2001-10-10) Monobit: 183
> > rngtest: FIPS 140-2(2001-10-10) Poker: 116
> > rngtest: FIPS 140-2(2001-10-10) Runs: 346
> > 2000+0 records in
> > 2000+0 records out
> > rngtest: FIPS 140-2(2001-10-10) Long run: 0
> > rngtest: FIPS 140-2(2001-10-10) Continuous run: 0
> > rngtest: input channel speed: (min=303.606; avg=3143.352; max=9712.208)Kibits/s
> > rngtest: FIPS tests speed: (min=7.104; avg=10.332; max=10.638)Mibits/s
> > rngtest: Program run time: 13303224 microseconds
> > 
> > That's a quite number of failure.
> > Can the hwrng still be used with some "hwrng->quality" setting ?
> > Or it is just too many failure to be used ?
> 
> If in doubt just leave it zero and the admin can override it if
> necessary.
> 

But as an admin, what value I can set ?
If I do a rule-of-3, success rate is 73%.
So does a quality of 730 is ok ?


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: cortina/gemini: hwrng: what is its quality ?
  2021-04-22  6:52   ` Corentin Labbe
@ 2021-04-22  7:21     ` Herbert Xu
  0 siblings, 0 replies; 4+ messages in thread
From: Herbert Xu @ 2021-04-22  7:21 UTC (permalink / raw)
  To: Corentin Labbe; +Cc: linux-crypto, linus.walleij, linux-kernel

On Thu, Apr 22, 2021 at 08:52:23AM +0200, Corentin Labbe wrote:
>
> But as an admin, what value I can set ?
> If I do a rule-of-3, success rate is 73%.
> So does a quality of 730 is ok ?

This is not hard science, the admin can choose whatever value they
like.

Cheers,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-04-22  7:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-21 20:03 cortina/gemini: hwrng: what is its quality ? Corentin Labbe
2021-04-22  0:14 ` Herbert Xu
2021-04-22  6:52   ` Corentin Labbe
2021-04-22  7:21     ` Herbert Xu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.