All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] hwrng: bcm2835: set quality to 1000
@ 2021-02-20 17:47 ` Álvaro Fernández Rojas
  0 siblings, 0 replies; 24+ messages in thread
From: Álvaro Fernández Rojas @ 2021-02-20 17:47 UTC (permalink / raw)
  To: mpm, herbert, nsaenzjulienne, f.fainelli, rjui, sbranden,
	bcm-kernel-feedback-list, rikard.falkeborn, noltari,
	linux-crypto, linux-rpi-kernel, linux-arm-kernel, linux-kernel,
	stijn, ynezz

This allows devices without a high precission timer to reduce boot from >100s
to <30s.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
---
 drivers/char/hw_random/bcm2835-rng.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/char/hw_random/bcm2835-rng.c b/drivers/char/hw_random/bcm2835-rng.c
index 1a7c43b43c6b..4b48cb7176b0 100644
--- a/drivers/char/hw_random/bcm2835-rng.c
+++ b/drivers/char/hw_random/bcm2835-rng.c
@@ -163,6 +163,7 @@ static int bcm2835_rng_probe(struct platform_device *pdev)
 	priv->rng.init = bcm2835_rng_init;
 	priv->rng.read = bcm2835_rng_read;
 	priv->rng.cleanup = bcm2835_rng_cleanup;
+	priv->rng.quality = 1000;
 
 	if (dev_of_node(dev)) {
 		rng_id = of_match_node(bcm2835_rng_of_match, dev->of_node);
-- 
2.20.1


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

* [PATCH] hwrng: bcm2835: set quality to 1000
@ 2021-02-20 17:47 ` Álvaro Fernández Rojas
  0 siblings, 0 replies; 24+ messages in thread
From: Álvaro Fernández Rojas @ 2021-02-20 17:47 UTC (permalink / raw)
  To: mpm, herbert, nsaenzjulienne, f.fainelli, rjui, sbranden,
	bcm-kernel-feedback-list, rikard.falkeborn, noltari,
	linux-crypto, linux-rpi-kernel, linux-arm-kernel, linux-kernel,
	stijn, ynezz

This allows devices without a high precission timer to reduce boot from >100s
to <30s.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
---
 drivers/char/hw_random/bcm2835-rng.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/char/hw_random/bcm2835-rng.c b/drivers/char/hw_random/bcm2835-rng.c
index 1a7c43b43c6b..4b48cb7176b0 100644
--- a/drivers/char/hw_random/bcm2835-rng.c
+++ b/drivers/char/hw_random/bcm2835-rng.c
@@ -163,6 +163,7 @@ static int bcm2835_rng_probe(struct platform_device *pdev)
 	priv->rng.init = bcm2835_rng_init;
 	priv->rng.read = bcm2835_rng_read;
 	priv->rng.cleanup = bcm2835_rng_cleanup;
+	priv->rng.quality = 1000;
 
 	if (dev_of_node(dev)) {
 		rng_id = of_match_node(bcm2835_rng_of_match, dev->of_node);
-- 
2.20.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] hwrng: bcm2835: set quality to 1000
  2021-02-20 17:47 ` Álvaro Fernández Rojas
@ 2021-02-20 19:09   ` Andrew Lunn
  -1 siblings, 0 replies; 24+ messages in thread
From: Andrew Lunn @ 2021-02-20 19:09 UTC (permalink / raw)
  To: Álvaro Fernández Rojas
  Cc: mpm, herbert, nsaenzjulienne, f.fainelli, rjui, sbranden,
	bcm-kernel-feedback-list, rikard.falkeborn, linux-crypto,
	linux-rpi-kernel, linux-arm-kernel, linux-kernel, stijn, ynezz

On Sat, Feb 20, 2021 at 06:47:40PM +0100, Álvaro Fernández Rojas wrote:
> This allows devices without a high precission timer to reduce boot from >100s
> to <30s.
> diff --git a/drivers/char/hw_random/bcm2835-rng.c b/drivers/char/hw_random/bcm2835-rng.c
> index 1a7c43b43c6b..4b48cb7176b0 100644
> --- a/drivers/char/hw_random/bcm2835-rng.c
> +++ b/drivers/char/hw_random/bcm2835-rng.c
> @@ -163,6 +163,7 @@ static int bcm2835_rng_probe(struct platform_device *pdev)
>  	priv->rng.init = bcm2835_rng_init;
>  	priv->rng.read = bcm2835_rng_read;
>  	priv->rng.cleanup = bcm2835_rng_cleanup;
> +	priv->rng.quality = 1000;

Hi Alvero

 * @quality:		Estimation of true entropy in RNG's bitstream
 *			(in bits of entropy per 1024 bits of input;
 *			valid values: 1 to 1024, or 0 for unknown).

How did you determine this device produces 1000 bits of true entropy
per 1024?

    Andrew

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

* Re: [PATCH] hwrng: bcm2835: set quality to 1000
@ 2021-02-20 19:09   ` Andrew Lunn
  0 siblings, 0 replies; 24+ messages in thread
From: Andrew Lunn @ 2021-02-20 19:09 UTC (permalink / raw)
  To: Álvaro Fernández Rojas
  Cc: linux-arm-kernel, stijn, f.fainelli, herbert, sbranden, rjui,
	linux-kernel, rikard.falkeborn, bcm-kernel-feedback-list,
	linux-crypto, mpm, ynezz, nsaenzjulienne, linux-rpi-kernel

On Sat, Feb 20, 2021 at 06:47:40PM +0100, Álvaro Fernández Rojas wrote:
> This allows devices without a high precission timer to reduce boot from >100s
> to <30s.
> diff --git a/drivers/char/hw_random/bcm2835-rng.c b/drivers/char/hw_random/bcm2835-rng.c
> index 1a7c43b43c6b..4b48cb7176b0 100644
> --- a/drivers/char/hw_random/bcm2835-rng.c
> +++ b/drivers/char/hw_random/bcm2835-rng.c
> @@ -163,6 +163,7 @@ static int bcm2835_rng_probe(struct platform_device *pdev)
>  	priv->rng.init = bcm2835_rng_init;
>  	priv->rng.read = bcm2835_rng_read;
>  	priv->rng.cleanup = bcm2835_rng_cleanup;
> +	priv->rng.quality = 1000;

Hi Alvero

 * @quality:		Estimation of true entropy in RNG's bitstream
 *			(in bits of entropy per 1024 bits of input;
 *			valid values: 1 to 1024, or 0 for unknown).

How did you determine this device produces 1000 bits of true entropy
per 1024?

    Andrew

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] hwrng: bcm2835: set quality to 1000
  2021-02-20 19:09   ` Andrew Lunn
@ 2021-02-20 19:12     ` Álvaro Fernández Rojas
  -1 siblings, 0 replies; 24+ messages in thread
From: Álvaro Fernández Rojas @ 2021-02-20 19:12 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: mpm, herbert, nsaenzjulienne, f.fainelli, rjui, sbranden,
	bcm-kernel-feedback-list, rikard.falkeborn, linux-crypto,
	linux-rpi-kernel, linux-arm-kernel, linux-kernel, stijn, ynezz

Hi Andrew,

I ran rngtest and this is what I got:
root@OpenWrt:/# cat /dev/hwrng | rngtest -c 1000
rngtest 6.10
Copyright (c) 2004 by Henrique de Moraes Holschuh
This is free software; see the source for copying conditions.  There is 
NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR 
PURPOSE.

rngtest: starting FIPS tests...
rngtest: bits received from input: 20000032
rngtest: FIPS 140-2 successes: 996
rngtest: FIPS 140-2 failures: 4
rngtest: FIPS 140-2(2001-10-10) Monobit: 0
rngtest: FIPS 140-2(2001-10-10) Poker: 0
rngtest: FIPS 140-2(2001-10-10) Runs: 1
rngtest: FIPS 140-2(2001-10-10) Long run: 3
rngtest: FIPS 140-2(2001-10-10) Continuous run: 0
rngtest: input channel speed: (min=146.002; avg=349.394; 
max=1302083.333)Kibits/s
rngtest: FIPS tests speed: (min=12.126; avg=22.750; max=23.432)Mibits/s
rngtest: Program run time: 56826982 microseconds

996 successes and 4 failures -> 99.6% success rate
1024 * 99.6% = 1019 (rounded down to 1000)

I'm not sure if I can rely on rngtest for that...

Best regards,
Álvaro.

El 20/02/2021 a las 20:09, Andrew Lunn escribió:
> On Sat, Feb 20, 2021 at 06:47:40PM +0100, Álvaro Fernández Rojas wrote:
>> This allows devices without a high precission timer to reduce boot from >100s
>> to <30s.
>> diff --git a/drivers/char/hw_random/bcm2835-rng.c b/drivers/char/hw_random/bcm2835-rng.c
>> index 1a7c43b43c6b..4b48cb7176b0 100644
>> --- a/drivers/char/hw_random/bcm2835-rng.c
>> +++ b/drivers/char/hw_random/bcm2835-rng.c
>> @@ -163,6 +163,7 @@ static int bcm2835_rng_probe(struct platform_device *pdev)
>>   	priv->rng.init = bcm2835_rng_init;
>>   	priv->rng.read = bcm2835_rng_read;
>>   	priv->rng.cleanup = bcm2835_rng_cleanup;
>> +	priv->rng.quality = 1000;
> 
> Hi Alvero
> 
>   * @quality:		Estimation of true entropy in RNG's bitstream
>   *			(in bits of entropy per 1024 bits of input;
>   *			valid values: 1 to 1024, or 0 for unknown).
> 
> How did you determine this device produces 1000 bits of true entropy
> per 1024?
> 
>      Andrew
> 

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

* Re: [PATCH] hwrng: bcm2835: set quality to 1000
@ 2021-02-20 19:12     ` Álvaro Fernández Rojas
  0 siblings, 0 replies; 24+ messages in thread
From: Álvaro Fernández Rojas @ 2021-02-20 19:12 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: linux-arm-kernel, stijn, f.fainelli, herbert, sbranden, rjui,
	linux-kernel, rikard.falkeborn, bcm-kernel-feedback-list,
	linux-crypto, mpm, ynezz, nsaenzjulienne, linux-rpi-kernel

Hi Andrew,

I ran rngtest and this is what I got:
root@OpenWrt:/# cat /dev/hwrng | rngtest -c 1000
rngtest 6.10
Copyright (c) 2004 by Henrique de Moraes Holschuh
This is free software; see the source for copying conditions.  There is 
NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR 
PURPOSE.

rngtest: starting FIPS tests...
rngtest: bits received from input: 20000032
rngtest: FIPS 140-2 successes: 996
rngtest: FIPS 140-2 failures: 4
rngtest: FIPS 140-2(2001-10-10) Monobit: 0
rngtest: FIPS 140-2(2001-10-10) Poker: 0
rngtest: FIPS 140-2(2001-10-10) Runs: 1
rngtest: FIPS 140-2(2001-10-10) Long run: 3
rngtest: FIPS 140-2(2001-10-10) Continuous run: 0
rngtest: input channel speed: (min=146.002; avg=349.394; 
max=1302083.333)Kibits/s
rngtest: FIPS tests speed: (min=12.126; avg=22.750; max=23.432)Mibits/s
rngtest: Program run time: 56826982 microseconds

996 successes and 4 failures -> 99.6% success rate
1024 * 99.6% = 1019 (rounded down to 1000)

I'm not sure if I can rely on rngtest for that...

Best regards,
Álvaro.

El 20/02/2021 a las 20:09, Andrew Lunn escribió:
> On Sat, Feb 20, 2021 at 06:47:40PM +0100, Álvaro Fernández Rojas wrote:
>> This allows devices without a high precission timer to reduce boot from >100s
>> to <30s.
>> diff --git a/drivers/char/hw_random/bcm2835-rng.c b/drivers/char/hw_random/bcm2835-rng.c
>> index 1a7c43b43c6b..4b48cb7176b0 100644
>> --- a/drivers/char/hw_random/bcm2835-rng.c
>> +++ b/drivers/char/hw_random/bcm2835-rng.c
>> @@ -163,6 +163,7 @@ static int bcm2835_rng_probe(struct platform_device *pdev)
>>   	priv->rng.init = bcm2835_rng_init;
>>   	priv->rng.read = bcm2835_rng_read;
>>   	priv->rng.cleanup = bcm2835_rng_cleanup;
>> +	priv->rng.quality = 1000;
> 
> Hi Alvero
> 
>   * @quality:		Estimation of true entropy in RNG's bitstream
>   *			(in bits of entropy per 1024 bits of input;
>   *			valid values: 1 to 1024, or 0 for unknown).
> 
> How did you determine this device produces 1000 bits of true entropy
> per 1024?
> 
>      Andrew
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] hwrng: bcm2835: set quality to 1000
  2021-02-20 19:12     ` Álvaro Fernández Rojas
@ 2021-02-20 19:40       ` Andrew Lunn
  -1 siblings, 0 replies; 24+ messages in thread
From: Andrew Lunn @ 2021-02-20 19:40 UTC (permalink / raw)
  To: Álvaro Fernández Rojas
  Cc: mpm, herbert, nsaenzjulienne, f.fainelli, rjui, sbranden,
	bcm-kernel-feedback-list, rikard.falkeborn, linux-crypto,
	linux-rpi-kernel, linux-arm-kernel, linux-kernel, stijn, ynezz

On Sat, Feb 20, 2021 at 08:12:45PM +0100, Álvaro Fernández Rojas wrote:
> Hi Andrew,
> 
> I ran rngtest and this is what I got:
> root@OpenWrt:/# cat /dev/hwrng | rngtest -c 1000
> rngtest 6.10
> Copyright (c) 2004 by Henrique de Moraes Holschuh
> This is free software; see the source for copying conditions.  There is NO
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
> 
> rngtest: starting FIPS tests...
> rngtest: bits received from input: 20000032
> rngtest: FIPS 140-2 successes: 996
> rngtest: FIPS 140-2 failures: 4
> rngtest: FIPS 140-2(2001-10-10) Monobit: 0
> rngtest: FIPS 140-2(2001-10-10) Poker: 0
> rngtest: FIPS 140-2(2001-10-10) Runs: 1
> rngtest: FIPS 140-2(2001-10-10) Long run: 3
> rngtest: FIPS 140-2(2001-10-10) Continuous run: 0
> rngtest: input channel speed: (min=146.002; avg=349.394;
> max=1302083.333)Kibits/s
> rngtest: FIPS tests speed: (min=12.126; avg=22.750; max=23.432)Mibits/s
> rngtest: Program run time: 56826982 microseconds
> 
> 996 successes and 4 failures -> 99.6% success rate
> 1024 * 99.6% = 1019 (rounded down to 1000)
> 
> I'm not sure if I can rely on rngtest for that...

Hi Álvaro

You need some sort of justification for setting the quality
value. Please include what you have written above in the commit
message. It then becomes possible for reviewers to say if this
justification is valid or not.

	Andrew

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

* Re: [PATCH] hwrng: bcm2835: set quality to 1000
@ 2021-02-20 19:40       ` Andrew Lunn
  0 siblings, 0 replies; 24+ messages in thread
From: Andrew Lunn @ 2021-02-20 19:40 UTC (permalink / raw)
  To: Álvaro Fernández Rojas
  Cc: linux-arm-kernel, stijn, f.fainelli, herbert, sbranden, rjui,
	linux-kernel, rikard.falkeborn, bcm-kernel-feedback-list,
	linux-crypto, mpm, ynezz, nsaenzjulienne, linux-rpi-kernel

On Sat, Feb 20, 2021 at 08:12:45PM +0100, Álvaro Fernández Rojas wrote:
> Hi Andrew,
> 
> I ran rngtest and this is what I got:
> root@OpenWrt:/# cat /dev/hwrng | rngtest -c 1000
> rngtest 6.10
> Copyright (c) 2004 by Henrique de Moraes Holschuh
> This is free software; see the source for copying conditions.  There is NO
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
> 
> rngtest: starting FIPS tests...
> rngtest: bits received from input: 20000032
> rngtest: FIPS 140-2 successes: 996
> rngtest: FIPS 140-2 failures: 4
> rngtest: FIPS 140-2(2001-10-10) Monobit: 0
> rngtest: FIPS 140-2(2001-10-10) Poker: 0
> rngtest: FIPS 140-2(2001-10-10) Runs: 1
> rngtest: FIPS 140-2(2001-10-10) Long run: 3
> rngtest: FIPS 140-2(2001-10-10) Continuous run: 0
> rngtest: input channel speed: (min=146.002; avg=349.394;
> max=1302083.333)Kibits/s
> rngtest: FIPS tests speed: (min=12.126; avg=22.750; max=23.432)Mibits/s
> rngtest: Program run time: 56826982 microseconds
> 
> 996 successes and 4 failures -> 99.6% success rate
> 1024 * 99.6% = 1019 (rounded down to 1000)
> 
> I'm not sure if I can rely on rngtest for that...

Hi Álvaro

You need some sort of justification for setting the quality
value. Please include what you have written above in the commit
message. It then becomes possible for reviewers to say if this
justification is valid or not.

	Andrew

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v2] hwrng: bcm2835: set quality to 1000
  2021-02-20 17:47 ` Álvaro Fernández Rojas
@ 2021-02-20 19:57   ` Álvaro Fernández Rojas
  -1 siblings, 0 replies; 24+ messages in thread
From: Álvaro Fernández Rojas @ 2021-02-20 19:57 UTC (permalink / raw)
  To: mpm, herbert, nsaenzjulienne, f.fainelli, rjui, sbranden,
	bcm-kernel-feedback-list, rikard.falkeborn, noltari,
	linux-crypto, linux-rpi-kernel, linux-arm-kernel, linux-kernel,
	stijn, ynezz

This allows devices without a high precission timer to speed up boot from
more 100 s to lest than 30s.

Justification:
root@OpenWrt:/# cat /dev/hwrng | rngtest -c 1000
rngtest 6.10
Copyright (c) 2004 by Henrique de Moraes Holschuh
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

rngtest: starting FIPS tests...
rngtest: bits received from input: 20000032
rngtest: FIPS 140-2 successes: 996
rngtest: FIPS 140-2 failures: 4
rngtest: FIPS 140-2(2001-10-10) Monobit: 0
rngtest: FIPS 140-2(2001-10-10) Poker: 0
rngtest: FIPS 140-2(2001-10-10) Runs: 1
rngtest: FIPS 140-2(2001-10-10) Long run: 3
rngtest: FIPS 140-2(2001-10-10) Continuous run: 0
rngtest: input channel speed: (min=146.002; avg=349.394;
max=1302083.333)Kibits/s
rngtest: FIPS tests speed: (min=12.126; avg=22.750; max=23.432)Mibits/s
rngtest: Program run time: 56826982 microseconds

996 successes and 4 failures -> 99.6% success rate
1024 * 99.6% = 1019 (rounded down to 1000)

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
---
 v2: add jusftification

 drivers/char/hw_random/bcm2835-rng.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/char/hw_random/bcm2835-rng.c b/drivers/char/hw_random/bcm2835-rng.c
index 1a7c43b43c6b..4b48cb7176b0 100644
--- a/drivers/char/hw_random/bcm2835-rng.c
+++ b/drivers/char/hw_random/bcm2835-rng.c
@@ -163,6 +163,7 @@ static int bcm2835_rng_probe(struct platform_device *pdev)
 	priv->rng.init = bcm2835_rng_init;
 	priv->rng.read = bcm2835_rng_read;
 	priv->rng.cleanup = bcm2835_rng_cleanup;
+	priv->rng.quality = 1000;
 
 	if (dev_of_node(dev)) {
 		rng_id = of_match_node(bcm2835_rng_of_match, dev->of_node);
-- 
2.20.1


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

* [PATCH v2] hwrng: bcm2835: set quality to 1000
@ 2021-02-20 19:57   ` Álvaro Fernández Rojas
  0 siblings, 0 replies; 24+ messages in thread
From: Álvaro Fernández Rojas @ 2021-02-20 19:57 UTC (permalink / raw)
  To: mpm, herbert, nsaenzjulienne, f.fainelli, rjui, sbranden,
	bcm-kernel-feedback-list, rikard.falkeborn, noltari,
	linux-crypto, linux-rpi-kernel, linux-arm-kernel, linux-kernel,
	stijn, ynezz

This allows devices without a high precission timer to speed up boot from
more 100 s to lest than 30s.

Justification:
root@OpenWrt:/# cat /dev/hwrng | rngtest -c 1000
rngtest 6.10
Copyright (c) 2004 by Henrique de Moraes Holschuh
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

rngtest: starting FIPS tests...
rngtest: bits received from input: 20000032
rngtest: FIPS 140-2 successes: 996
rngtest: FIPS 140-2 failures: 4
rngtest: FIPS 140-2(2001-10-10) Monobit: 0
rngtest: FIPS 140-2(2001-10-10) Poker: 0
rngtest: FIPS 140-2(2001-10-10) Runs: 1
rngtest: FIPS 140-2(2001-10-10) Long run: 3
rngtest: FIPS 140-2(2001-10-10) Continuous run: 0
rngtest: input channel speed: (min=146.002; avg=349.394;
max=1302083.333)Kibits/s
rngtest: FIPS tests speed: (min=12.126; avg=22.750; max=23.432)Mibits/s
rngtest: Program run time: 56826982 microseconds

996 successes and 4 failures -> 99.6% success rate
1024 * 99.6% = 1019 (rounded down to 1000)

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
---
 v2: add jusftification

 drivers/char/hw_random/bcm2835-rng.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/char/hw_random/bcm2835-rng.c b/drivers/char/hw_random/bcm2835-rng.c
index 1a7c43b43c6b..4b48cb7176b0 100644
--- a/drivers/char/hw_random/bcm2835-rng.c
+++ b/drivers/char/hw_random/bcm2835-rng.c
@@ -163,6 +163,7 @@ static int bcm2835_rng_probe(struct platform_device *pdev)
 	priv->rng.init = bcm2835_rng_init;
 	priv->rng.read = bcm2835_rng_read;
 	priv->rng.cleanup = bcm2835_rng_cleanup;
+	priv->rng.quality = 1000;
 
 	if (dev_of_node(dev)) {
 		rng_id = of_match_node(bcm2835_rng_of_match, dev->of_node);
-- 
2.20.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v3] hwrng: bcm2835: set quality
  2021-02-20 19:57   ` Álvaro Fernández Rojas
@ 2021-02-22 19:50     ` Álvaro Fernández Rojas
  -1 siblings, 0 replies; 24+ messages in thread
From: Álvaro Fernández Rojas @ 2021-02-22 19:50 UTC (permalink / raw)
  To: mpm, herbert, nsaenzjulienne, f.fainelli, rjui, sbranden,
	bcm-kernel-feedback-list, rikard.falkeborn, noltari,
	linux-crypto, linux-rpi-kernel, linux-arm-kernel, linux-kernel,
	stijn, ynezz

This allows devices without a high precission timer to speed up boot from
more than 100s to lest than 30s.

BCM2835 rngtest:
root@OpenWrt:/# cat /dev/hwrng | rngtest -c 1000
rngtest 6.10
Copyright (c) 2004 by Henrique de Moraes Holschuh
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

rngtest: starting FIPS tests...
rngtest: bits received from input: 20000032
rngtest: FIPS 140-2 successes: 996
rngtest: FIPS 140-2 failures: 4
rngtest: FIPS 140-2(2001-10-10) Monobit: 0
rngtest: FIPS 140-2(2001-10-10) Poker: 0
rngtest: FIPS 140-2(2001-10-10) Runs: 1
rngtest: FIPS 140-2(2001-10-10) Long run: 3
rngtest: FIPS 140-2(2001-10-10) Continuous run: 0
rngtest: input channel speed: (min=146.002; avg=349.394;
max=1302083.333)Kibits/s
rngtest: FIPS tests speed: (min=12.126; avg=22.750; max=23.432)Mibits/s
rngtest: Program run time: 56826982 microseconds

996 successes and 4 failures -> 99.6% success rate
1024 * 99.6% = 1019 (rounded down to 1000)

BCM6368 rngtest:
root@OpenWrt:/# root@OpenWrt:/# cat /dev/hwrng | rngtest -c 1000
rngtest 6.10
Copyright (c) 2004 by Henrique de Moraes Holschuh
This is free software; see the source for copying conditions.  There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

rngtest: starting FIPS tests...
rngtest: bits received from input: 20000032
rngtest: FIPS 140-2 successes: 751
rngtest: FIPS 140-2 failures: 249
rngtest: FIPS 140-2(2001-10-10) Monobit: 0
rngtest: FIPS 140-2(2001-10-10) Poker: 34
rngtest: FIPS 140-2(2001-10-10) Runs: 245
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=1.202; avg=16.434; max=1003.868)Mibits/s
rngtest: FIPS tests speed: (min=761.155; avg=8343.383; max=15662.590)Kibits/s
rngtest: Program run time: 3539183 microseconds
cat: write error: Broken pipe

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
---
 v3: set different qualities for each SoC
 v2: add jusftification

 drivers/char/hw_random/bcm2835-rng.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/drivers/char/hw_random/bcm2835-rng.c b/drivers/char/hw_random/bcm2835-rng.c
index 1a7c43b43c6b..a6121a04f624 100644
--- a/drivers/char/hw_random/bcm2835-rng.c
+++ b/drivers/char/hw_random/bcm2835-rng.c
@@ -121,6 +121,15 @@ static void bcm2835_rng_cleanup(struct hwrng *rng)
 
 struct bcm2835_rng_of_data {
 	bool mask_interrupts;
+	unsigned short quality;
+};
+
+static const struct bcm2835_rng_of_data bcm283x_rng_of_data = {
+	.quality = 1000,
+};
+
+static const struct bcm2835_rng_of_data bcm6368_rng_of_data = {
+	.quality = 700,
 };
 
 static const struct bcm2835_rng_of_data nsp_rng_of_data = {
@@ -128,10 +137,10 @@ static const struct bcm2835_rng_of_data nsp_rng_of_data = {
 };
 
 static const struct of_device_id bcm2835_rng_of_match[] = {
-	{ .compatible = "brcm,bcm2835-rng"},
+	{ .compatible = "brcm,bcm2835-rng", .data = &bcm283x_rng_of_data },
 	{ .compatible = "brcm,bcm-nsp-rng", .data = &nsp_rng_of_data },
 	{ .compatible = "brcm,bcm5301x-rng", .data = &nsp_rng_of_data },
-	{ .compatible = "brcm,bcm6368-rng"},
+	{ .compatible = "brcm,bcm6368-rng", .data = &bcm6368_rng_of_data },
 	{},
 };
 
@@ -171,8 +180,10 @@ static int bcm2835_rng_probe(struct platform_device *pdev)
 
 		/* Check for rng init function, execute it */
 		of_data = rng_id->data;
-		if (of_data)
+		if (of_data) {
 			priv->mask_interrupts = of_data->mask_interrupts;
+			priv->rng.quality = of_data->quality;
+		}
 	}
 
 	/* register driver */
-- 
2.20.1


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

* [PATCH v3] hwrng: bcm2835: set quality
@ 2021-02-22 19:50     ` Álvaro Fernández Rojas
  0 siblings, 0 replies; 24+ messages in thread
From: Álvaro Fernández Rojas @ 2021-02-22 19:50 UTC (permalink / raw)
  To: mpm, herbert, nsaenzjulienne, f.fainelli, rjui, sbranden,
	bcm-kernel-feedback-list, rikard.falkeborn, noltari,
	linux-crypto, linux-rpi-kernel, linux-arm-kernel, linux-kernel,
	stijn, ynezz

This allows devices without a high precission timer to speed up boot from
more than 100s to lest than 30s.

BCM2835 rngtest:
root@OpenWrt:/# cat /dev/hwrng | rngtest -c 1000
rngtest 6.10
Copyright (c) 2004 by Henrique de Moraes Holschuh
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

rngtest: starting FIPS tests...
rngtest: bits received from input: 20000032
rngtest: FIPS 140-2 successes: 996
rngtest: FIPS 140-2 failures: 4
rngtest: FIPS 140-2(2001-10-10) Monobit: 0
rngtest: FIPS 140-2(2001-10-10) Poker: 0
rngtest: FIPS 140-2(2001-10-10) Runs: 1
rngtest: FIPS 140-2(2001-10-10) Long run: 3
rngtest: FIPS 140-2(2001-10-10) Continuous run: 0
rngtest: input channel speed: (min=146.002; avg=349.394;
max=1302083.333)Kibits/s
rngtest: FIPS tests speed: (min=12.126; avg=22.750; max=23.432)Mibits/s
rngtest: Program run time: 56826982 microseconds

996 successes and 4 failures -> 99.6% success rate
1024 * 99.6% = 1019 (rounded down to 1000)

BCM6368 rngtest:
root@OpenWrt:/# root@OpenWrt:/# cat /dev/hwrng | rngtest -c 1000
rngtest 6.10
Copyright (c) 2004 by Henrique de Moraes Holschuh
This is free software; see the source for copying conditions.  There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

rngtest: starting FIPS tests...
rngtest: bits received from input: 20000032
rngtest: FIPS 140-2 successes: 751
rngtest: FIPS 140-2 failures: 249
rngtest: FIPS 140-2(2001-10-10) Monobit: 0
rngtest: FIPS 140-2(2001-10-10) Poker: 34
rngtest: FIPS 140-2(2001-10-10) Runs: 245
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=1.202; avg=16.434; max=1003.868)Mibits/s
rngtest: FIPS tests speed: (min=761.155; avg=8343.383; max=15662.590)Kibits/s
rngtest: Program run time: 3539183 microseconds
cat: write error: Broken pipe

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
---
 v3: set different qualities for each SoC
 v2: add jusftification

 drivers/char/hw_random/bcm2835-rng.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/drivers/char/hw_random/bcm2835-rng.c b/drivers/char/hw_random/bcm2835-rng.c
index 1a7c43b43c6b..a6121a04f624 100644
--- a/drivers/char/hw_random/bcm2835-rng.c
+++ b/drivers/char/hw_random/bcm2835-rng.c
@@ -121,6 +121,15 @@ static void bcm2835_rng_cleanup(struct hwrng *rng)
 
 struct bcm2835_rng_of_data {
 	bool mask_interrupts;
+	unsigned short quality;
+};
+
+static const struct bcm2835_rng_of_data bcm283x_rng_of_data = {
+	.quality = 1000,
+};
+
+static const struct bcm2835_rng_of_data bcm6368_rng_of_data = {
+	.quality = 700,
 };
 
 static const struct bcm2835_rng_of_data nsp_rng_of_data = {
@@ -128,10 +137,10 @@ static const struct bcm2835_rng_of_data nsp_rng_of_data = {
 };
 
 static const struct of_device_id bcm2835_rng_of_match[] = {
-	{ .compatible = "brcm,bcm2835-rng"},
+	{ .compatible = "brcm,bcm2835-rng", .data = &bcm283x_rng_of_data },
 	{ .compatible = "brcm,bcm-nsp-rng", .data = &nsp_rng_of_data },
 	{ .compatible = "brcm,bcm5301x-rng", .data = &nsp_rng_of_data },
-	{ .compatible = "brcm,bcm6368-rng"},
+	{ .compatible = "brcm,bcm6368-rng", .data = &bcm6368_rng_of_data },
 	{},
 };
 
@@ -171,8 +180,10 @@ static int bcm2835_rng_probe(struct platform_device *pdev)
 
 		/* Check for rng init function, execute it */
 		of_data = rng_id->data;
-		if (of_data)
+		if (of_data) {
 			priv->mask_interrupts = of_data->mask_interrupts;
+			priv->rng.quality = of_data->quality;
+		}
 	}
 
 	/* register driver */
-- 
2.20.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] hwrng: bcm2835: set quality to 1000
  2021-02-20 19:12     ` Álvaro Fernández Rojas
@ 2021-03-03  9:20       ` Herbert Xu
  -1 siblings, 0 replies; 24+ messages in thread
From: Herbert Xu @ 2021-03-03  9:20 UTC (permalink / raw)
  To: Álvaro Fernández Rojas
  Cc: Andrew Lunn, mpm, nsaenzjulienne, f.fainelli, rjui, sbranden,
	bcm-kernel-feedback-list, rikard.falkeborn, linux-crypto,
	linux-rpi-kernel, linux-arm-kernel, linux-kernel, stijn, ynezz

On Sat, Feb 20, 2021 at 08:12:45PM +0100, Álvaro Fernández Rojas wrote:
> 
> I ran rngtest and this is what I got:

This is meaningless except for sources that have not been whitened.

Your justification needs to be based on what the hardware does or
is documented to do.

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] 24+ messages in thread

* Re: [PATCH] hwrng: bcm2835: set quality to 1000
@ 2021-03-03  9:20       ` Herbert Xu
  0 siblings, 0 replies; 24+ messages in thread
From: Herbert Xu @ 2021-03-03  9:20 UTC (permalink / raw)
  To: Álvaro Fernández Rojas
  Cc: Andrew Lunn, mpm, nsaenzjulienne, f.fainelli, rjui, sbranden,
	bcm-kernel-feedback-list, rikard.falkeborn, linux-crypto,
	linux-rpi-kernel, linux-arm-kernel, linux-kernel, stijn, ynezz

On Sat, Feb 20, 2021 at 08:12:45PM +0100, Álvaro Fernández Rojas wrote:
> 
> I ran rngtest and this is what I got:

This is meaningless except for sources that have not been whitened.

Your justification needs to be based on what the hardware does or
is documented to do.

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

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] hwrng: bcm2835: set quality to 1000
  2021-03-03  9:20       ` Herbert Xu
@ 2021-03-03  9:29         ` Álvaro Fernández Rojas
  -1 siblings, 0 replies; 24+ messages in thread
From: Álvaro Fernández Rojas @ 2021-03-03  9:29 UTC (permalink / raw)
  To: Herbert Xu
  Cc: Andrew Lunn, Matt Mackall, Nicolas Saenz Julienne,
	Florian Fainelli, Ray Jui, Scott Branden,
	bcm-kernel-feedback-list, Rikard Falkeborn, linux-crypto,
	linux-rpi-kernel, linux-arm-kernel, linux-kernel, stijn, ynezz

Hi Herbert,

> El 3 mar 2021, a las 10:20, Herbert Xu <herbert@gondor.apana.org.au> escribió:
> 
> On Sat, Feb 20, 2021 at 08:12:45PM +0100, Álvaro Fernández Rojas wrote:
>> 
>> I ran rngtest and this is what I got:
> 
> This is meaningless except for sources that have not been whitened.
> 
> Your justification needs to be based on what the hardware does or
> is documented to do.

Ok, so I guess that we’re never setting that value to anything since there’s no public documentation about that ¯\_(ツ)_/¯.

> 
> 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

Best regards,
Álvaro.

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

* Re: [PATCH] hwrng: bcm2835: set quality to 1000
@ 2021-03-03  9:29         ` Álvaro Fernández Rojas
  0 siblings, 0 replies; 24+ messages in thread
From: Álvaro Fernández Rojas @ 2021-03-03  9:29 UTC (permalink / raw)
  To: Herbert Xu
  Cc: Andrew Lunn, Matt Mackall, Nicolas Saenz Julienne,
	Florian Fainelli, Ray Jui, Scott Branden,
	bcm-kernel-feedback-list, Rikard Falkeborn, linux-crypto,
	linux-rpi-kernel, linux-arm-kernel, linux-kernel, stijn, ynezz

Hi Herbert,

> El 3 mar 2021, a las 10:20, Herbert Xu <herbert@gondor.apana.org.au> escribió:
> 
> On Sat, Feb 20, 2021 at 08:12:45PM +0100, Álvaro Fernández Rojas wrote:
>> 
>> I ran rngtest and this is what I got:
> 
> This is meaningless except for sources that have not been whitened.
> 
> Your justification needs to be based on what the hardware does or
> is documented to do.

Ok, so I guess that we’re never setting that value to anything since there’s no public documentation about that ¯\_(ツ)_/¯.

> 
> 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

Best regards,
Álvaro.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] hwrng: bcm2835: set quality to 1000
  2021-03-03  9:29         ` Álvaro Fernández Rojas
@ 2021-03-04 15:11           ` Nicolas Saenz Julienne
  -1 siblings, 0 replies; 24+ messages in thread
From: Nicolas Saenz Julienne @ 2021-03-04 15:11 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: Álvaro Fernández Rojas, Herbert Xu, Andrew Lunn,
	Matt Mackall, Ray Jui, Scott Branden, bcm-kernel-feedback-list,
	Rikard Falkeborn, linux-crypto, linux-rpi-kernel,
	linux-arm-kernel, linux-kernel, stijn, ynezz

[-- Attachment #1: Type: text/plain, Size: 731 bytes --]

On Wed, 2021-03-03 at 10:29 +0100, Álvaro Fernández Rojas wrote:
> Hi Herbert,
> 
> > El 3 mar 2021, a las 10:20, Herbert Xu <herbert@gondor.apana.org.au> escribió:
> > 
> > On Sat, Feb 20, 2021 at 08:12:45PM +0100, Álvaro Fernández Rojas wrote:
> > > 
> > > I ran rngtest and this is what I got:
> > 
> > This is meaningless except for sources that have not been whitened.
> > 
> > Your justification needs to be based on what the hardware does or
> > is documented to do.
> 
> Ok, so I guess that we’re never setting that value to anything since there’s
> no public documentation about that ¯\_(ツ)_/¯.

@Florian, is there a way you might be able to get the official value?

Regards,
Nicolas



[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH] hwrng: bcm2835: set quality to 1000
@ 2021-03-04 15:11           ` Nicolas Saenz Julienne
  0 siblings, 0 replies; 24+ messages in thread
From: Nicolas Saenz Julienne @ 2021-03-04 15:11 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: Álvaro Fernández Rojas, Herbert Xu, Andrew Lunn,
	Matt Mackall, Ray Jui, Scott Branden, bcm-kernel-feedback-list,
	Rikard Falkeborn, linux-crypto, linux-rpi-kernel,
	linux-arm-kernel, linux-kernel, stijn, ynezz


[-- Attachment #1.1: Type: text/plain, Size: 731 bytes --]

On Wed, 2021-03-03 at 10:29 +0100, Álvaro Fernández Rojas wrote:
> Hi Herbert,
> 
> > El 3 mar 2021, a las 10:20, Herbert Xu <herbert@gondor.apana.org.au> escribió:
> > 
> > On Sat, Feb 20, 2021 at 08:12:45PM +0100, Álvaro Fernández Rojas wrote:
> > > 
> > > I ran rngtest and this is what I got:
> > 
> > This is meaningless except for sources that have not been whitened.
> > 
> > Your justification needs to be based on what the hardware does or
> > is documented to do.
> 
> Ok, so I guess that we’re never setting that value to anything since there’s
> no public documentation about that ¯\_(ツ)_/¯.

@Florian, is there a way you might be able to get the official value?

Regards,
Nicolas



[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] hwrng: bcm2835: set quality to 1000
  2021-03-04 15:11           ` Nicolas Saenz Julienne
@ 2021-03-04 22:28             ` Florian Fainelli
  -1 siblings, 0 replies; 24+ messages in thread
From: Florian Fainelli @ 2021-03-04 22:28 UTC (permalink / raw)
  To: Nicolas Saenz Julienne, Florian Fainelli
  Cc: Álvaro Fernández Rojas, Herbert Xu, Andrew Lunn,
	Matt Mackall, Ray Jui, Scott Branden, bcm-kernel-feedback-list,
	Rikard Falkeborn, linux-crypto, linux-rpi-kernel,
	linux-arm-kernel, linux-kernel, stijn, ynezz

On 3/4/21 7:11 AM, Nicolas Saenz Julienne wrote:
> On Wed, 2021-03-03 at 10:29 +0100, Álvaro Fernández Rojas wrote:
>> Hi Herbert,
>>
>>> El 3 mar 2021, a las 10:20, Herbert Xu <herbert@gondor.apana.org.au> escribió:
>>>
>>> On Sat, Feb 20, 2021 at 08:12:45PM +0100, Álvaro Fernández Rojas wrote:
>>>>
>>>> I ran rngtest and this is what I got:
>>>
>>> This is meaningless except for sources that have not been whitened.
>>>
>>> Your justification needs to be based on what the hardware does or
>>> is documented to do.
>>
>> Ok, so I guess that we’re never setting that value to anything since there’s
>> no public documentation about that ¯\_(ツ)_/¯.
> 
> @Florian, is there a way you might be able to get the official value?

I will be looking into the documentation this weekend and let you know
whether we can change the driver's quality accordingly.
-- 
Florian

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

* Re: [PATCH] hwrng: bcm2835: set quality to 1000
@ 2021-03-04 22:28             ` Florian Fainelli
  0 siblings, 0 replies; 24+ messages in thread
From: Florian Fainelli @ 2021-03-04 22:28 UTC (permalink / raw)
  To: Nicolas Saenz Julienne, Florian Fainelli
  Cc: Álvaro Fernández Rojas, Herbert Xu, Andrew Lunn,
	Matt Mackall, Ray Jui, Scott Branden, bcm-kernel-feedback-list,
	Rikard Falkeborn, linux-crypto, linux-rpi-kernel,
	linux-arm-kernel, linux-kernel, stijn, ynezz

On 3/4/21 7:11 AM, Nicolas Saenz Julienne wrote:
> On Wed, 2021-03-03 at 10:29 +0100, Álvaro Fernández Rojas wrote:
>> Hi Herbert,
>>
>>> El 3 mar 2021, a las 10:20, Herbert Xu <herbert@gondor.apana.org.au> escribió:
>>>
>>> On Sat, Feb 20, 2021 at 08:12:45PM +0100, Álvaro Fernández Rojas wrote:
>>>>
>>>> I ran rngtest and this is what I got:
>>>
>>> This is meaningless except for sources that have not been whitened.
>>>
>>> Your justification needs to be based on what the hardware does or
>>> is documented to do.
>>
>> Ok, so I guess that we’re never setting that value to anything since there’s
>> no public documentation about that ¯\_(ツ)_/¯.
> 
> @Florian, is there a way you might be able to get the official value?

I will be looking into the documentation this weekend and let you know
whether we can change the driver's quality accordingly.
-- 
Florian

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] hwrng: bcm2835: set quality to 1000
  2021-03-04 22:28             ` Florian Fainelli
@ 2021-03-05  6:26               ` Álvaro Fernández Rojas
  -1 siblings, 0 replies; 24+ messages in thread
From: Álvaro Fernández Rojas @ 2021-03-05  6:26 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: Nicolas Saenz Julienne, Herbert Xu, Andrew Lunn, Matt Mackall,
	Ray Jui, Scott Branden, bcm-kernel-feedback-list,
	Rikard Falkeborn, linux-crypto, linux-rpi-kernel,
	linux-arm-kernel, linux-kernel, Stijn Tintel, ynezz

Hi Florian,

> El 4 mar 2021, a las 23:28, Florian Fainelli <f.fainelli@gmail.com> escribió:
> 
> On 3/4/21 7:11 AM, Nicolas Saenz Julienne wrote:
>> On Wed, 2021-03-03 at 10:29 +0100, Álvaro Fernández Rojas wrote:
>>> Hi Herbert,
>>> 
>>>> El 3 mar 2021, a las 10:20, Herbert Xu <herbert@gondor.apana.org.au> escribió:
>>>> 
>>>> On Sat, Feb 20, 2021 at 08:12:45PM +0100, Álvaro Fernández Rojas wrote:
>>>>> 
>>>>> I ran rngtest and this is what I got:
>>>> 
>>>> This is meaningless except for sources that have not been whitened.
>>>> 
>>>> Your justification needs to be based on what the hardware does or
>>>> is documented to do.
>>> 
>>> Ok, so I guess that we’re never setting that value to anything since there’s
>>> no public documentation about that ¯\_(ツ)_/¯.
>> 
>> @Florian, is there a way you might be able to get the official value?
> 
> I will be looking into the documentation this weekend and let you know
> whether we can change the driver's quality accordingly.

Could you do that for iproc-rng200.c too?

> -- 
> Florian

Best regards,
Álvaro.

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

* Re: [PATCH] hwrng: bcm2835: set quality to 1000
@ 2021-03-05  6:26               ` Álvaro Fernández Rojas
  0 siblings, 0 replies; 24+ messages in thread
From: Álvaro Fernández Rojas @ 2021-03-05  6:26 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: Nicolas Saenz Julienne, Herbert Xu, Andrew Lunn, Matt Mackall,
	Ray Jui, Scott Branden, bcm-kernel-feedback-list,
	Rikard Falkeborn, linux-crypto, linux-rpi-kernel,
	linux-arm-kernel, linux-kernel, Stijn Tintel, ynezz

Hi Florian,

> El 4 mar 2021, a las 23:28, Florian Fainelli <f.fainelli@gmail.com> escribió:
> 
> On 3/4/21 7:11 AM, Nicolas Saenz Julienne wrote:
>> On Wed, 2021-03-03 at 10:29 +0100, Álvaro Fernández Rojas wrote:
>>> Hi Herbert,
>>> 
>>>> El 3 mar 2021, a las 10:20, Herbert Xu <herbert@gondor.apana.org.au> escribió:
>>>> 
>>>> On Sat, Feb 20, 2021 at 08:12:45PM +0100, Álvaro Fernández Rojas wrote:
>>>>> 
>>>>> I ran rngtest and this is what I got:
>>>> 
>>>> This is meaningless except for sources that have not been whitened.
>>>> 
>>>> Your justification needs to be based on what the hardware does or
>>>> is documented to do.
>>> 
>>> Ok, so I guess that we’re never setting that value to anything since there’s
>>> no public documentation about that ¯\_(ツ)_/¯.
>> 
>> @Florian, is there a way you might be able to get the official value?
> 
> I will be looking into the documentation this weekend and let you know
> whether we can change the driver's quality accordingly.

Could you do that for iproc-rng200.c too?

> -- 
> Florian

Best regards,
Álvaro.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] hwrng: bcm2835: set quality to 1000
  2021-03-05  6:26               ` Álvaro Fernández Rojas
@ 2021-03-12  4:52                 ` Florian Fainelli
  -1 siblings, 0 replies; 24+ messages in thread
From: Florian Fainelli @ 2021-03-12  4:52 UTC (permalink / raw)
  To: Álvaro Fernández Rojas, Florian Fainelli, Stephan Mueller
  Cc: Nicolas Saenz Julienne, Herbert Xu, Andrew Lunn, Matt Mackall,
	Ray Jui, Scott Branden, bcm-kernel-feedback-list,
	Rikard Falkeborn, linux-crypto, linux-rpi-kernel,
	linux-arm-kernel, linux-kernel, Stijn Tintel, ynezz



On 3/4/2021 10:26 PM, Álvaro Fernández Rojas wrote:
> Hi Florian,
> 
>> El 4 mar 2021, a las 23:28, Florian Fainelli <f.fainelli@gmail.com> escribió:
>>
>> On 3/4/21 7:11 AM, Nicolas Saenz Julienne wrote:
>>> On Wed, 2021-03-03 at 10:29 +0100, Álvaro Fernández Rojas wrote:
>>>> Hi Herbert,
>>>>
>>>>> El 3 mar 2021, a las 10:20, Herbert Xu <herbert@gondor.apana.org.au> escribió:
>>>>>
>>>>> On Sat, Feb 20, 2021 at 08:12:45PM +0100, Álvaro Fernández Rojas wrote:
>>>>>>
>>>>>> I ran rngtest and this is what I got:
>>>>>
>>>>> This is meaningless except for sources that have not been whitened.
>>>>>
>>>>> Your justification needs to be based on what the hardware does or
>>>>> is documented to do.
>>>>
>>>> Ok, so I guess that we’re never setting that value to anything since there’s
>>>> no public documentation about that ¯\_(ツ)_/¯.
>>>
>>> @Florian, is there a way you might be able to get the official value?
>>
>> I will be looking into the documentation this weekend and let you know
>> whether we can change the driver's quality accordingly.
> 
> Could you do that for iproc-rng200.c too?

From looking at some documentation and the design of the 6368 RNG which
is supposedly the same as the Raspberry Pi 1/2/3 RNG, this appears to be
a random number generator that does not go through any post-processing
and just collects random bits into a FIFO.

The rbg200 is also similar except that it is integrated into a wrapper
called the rng200 which supposedly only accepts data that has passed
"NIST industry standard random data quality algorithm" without being
specific. So it seems to me you may be able to set the quality field for
bcm2835-rng, but not for iproc-rng200.

Stephan does that sound right?
-- 
Florian

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

* Re: [PATCH] hwrng: bcm2835: set quality to 1000
@ 2021-03-12  4:52                 ` Florian Fainelli
  0 siblings, 0 replies; 24+ messages in thread
From: Florian Fainelli @ 2021-03-12  4:52 UTC (permalink / raw)
  To: Álvaro Fernández Rojas, Florian Fainelli, Stephan Mueller
  Cc: Nicolas Saenz Julienne, Herbert Xu, Andrew Lunn, Matt Mackall,
	Ray Jui, Scott Branden, bcm-kernel-feedback-list,
	Rikard Falkeborn, linux-crypto, linux-rpi-kernel,
	linux-arm-kernel, linux-kernel, Stijn Tintel, ynezz



On 3/4/2021 10:26 PM, Álvaro Fernández Rojas wrote:
> Hi Florian,
> 
>> El 4 mar 2021, a las 23:28, Florian Fainelli <f.fainelli@gmail.com> escribió:
>>
>> On 3/4/21 7:11 AM, Nicolas Saenz Julienne wrote:
>>> On Wed, 2021-03-03 at 10:29 +0100, Álvaro Fernández Rojas wrote:
>>>> Hi Herbert,
>>>>
>>>>> El 3 mar 2021, a las 10:20, Herbert Xu <herbert@gondor.apana.org.au> escribió:
>>>>>
>>>>> On Sat, Feb 20, 2021 at 08:12:45PM +0100, Álvaro Fernández Rojas wrote:
>>>>>>
>>>>>> I ran rngtest and this is what I got:
>>>>>
>>>>> This is meaningless except for sources that have not been whitened.
>>>>>
>>>>> Your justification needs to be based on what the hardware does or
>>>>> is documented to do.
>>>>
>>>> Ok, so I guess that we’re never setting that value to anything since there’s
>>>> no public documentation about that ¯\_(ツ)_/¯.
>>>
>>> @Florian, is there a way you might be able to get the official value?
>>
>> I will be looking into the documentation this weekend and let you know
>> whether we can change the driver's quality accordingly.
> 
> Could you do that for iproc-rng200.c too?

From looking at some documentation and the design of the 6368 RNG which
is supposedly the same as the Raspberry Pi 1/2/3 RNG, this appears to be
a random number generator that does not go through any post-processing
and just collects random bits into a FIFO.

The rbg200 is also similar except that it is integrated into a wrapper
called the rng200 which supposedly only accepts data that has passed
"NIST industry standard random data quality algorithm" without being
specific. So it seems to me you may be able to set the quality field for
bcm2835-rng, but not for iproc-rng200.

Stephan does that sound right?
-- 
Florian

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2021-03-12  4:54 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-20 17:47 [PATCH] hwrng: bcm2835: set quality to 1000 Álvaro Fernández Rojas
2021-02-20 17:47 ` Álvaro Fernández Rojas
2021-02-20 19:09 ` Andrew Lunn
2021-02-20 19:09   ` Andrew Lunn
2021-02-20 19:12   ` Álvaro Fernández Rojas
2021-02-20 19:12     ` Álvaro Fernández Rojas
2021-02-20 19:40     ` Andrew Lunn
2021-02-20 19:40       ` Andrew Lunn
2021-03-03  9:20     ` Herbert Xu
2021-03-03  9:20       ` Herbert Xu
2021-03-03  9:29       ` Álvaro Fernández Rojas
2021-03-03  9:29         ` Álvaro Fernández Rojas
2021-03-04 15:11         ` Nicolas Saenz Julienne
2021-03-04 15:11           ` Nicolas Saenz Julienne
2021-03-04 22:28           ` Florian Fainelli
2021-03-04 22:28             ` Florian Fainelli
2021-03-05  6:26             ` Álvaro Fernández Rojas
2021-03-05  6:26               ` Álvaro Fernández Rojas
2021-03-12  4:52               ` Florian Fainelli
2021-03-12  4:52                 ` Florian Fainelli
2021-02-20 19:57 ` [PATCH v2] " Álvaro Fernández Rojas
2021-02-20 19:57   ` Álvaro Fernández Rojas
2021-02-22 19:50   ` [PATCH v3] hwrng: bcm2835: set quality Álvaro Fernández Rojas
2021-02-22 19:50     ` Álvaro Fernández Rojas

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.