public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] hwrng: core - allow perfect entropy from hardware devices
@ 2015-03-18  5:13 Keith Packard
  2015-03-18  5:18 ` Herbert Xu
  0 siblings, 1 reply; 4+ messages in thread
From: Keith Packard @ 2015-03-18  5:13 UTC (permalink / raw)
  To: Matt Mackall, Herbert Xu; +Cc: linux-kernel, Keith Packard

Hardware random number quality is measured from 0 (no entropy) to 1024
(perfect entropy). Allow hardware devices to assert the full range by
truncating the device-provided value at 1024 instead of 1023.

Signed-off-by: Keith Packard <keithp@keithp.com>
---
 drivers/char/hw_random/core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c
index 1500cfd..b726683 100644
--- a/drivers/char/hw_random/core.c
+++ b/drivers/char/hw_random/core.c
@@ -98,7 +98,8 @@ static inline int hwrng_init(struct hwrng *rng)
 	add_early_randomness(rng);
 
 	current_quality = rng->quality ? : default_quality;
-	current_quality &= 1023;
+	if (current_quality > 1024)
+		current_quality = 1024;
 
 	if (current_quality == 0 && hwrng_fill)
 		kthread_stop(hwrng_fill);
-- 
2.1.4


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

* Re: [PATCH] hwrng: core - allow perfect entropy from hardware devices
  2015-03-18  5:13 [PATCH] hwrng: core - allow perfect entropy from hardware devices Keith Packard
@ 2015-03-18  5:18 ` Herbert Xu
  2015-03-18  7:15   ` Keith Packard
  0 siblings, 1 reply; 4+ messages in thread
From: Herbert Xu @ 2015-03-18  5:18 UTC (permalink / raw)
  To: Keith Packard; +Cc: Matt Mackall, linux-kernel

On Tue, Mar 17, 2015 at 10:13:28PM -0700, Keith Packard wrote:
> Hardware random number quality is measured from 0 (no entropy) to 1024
> (perfect entropy). Allow hardware devices to assert the full range by
> truncating the device-provided value at 1024 instead of 1023.
> 
> Signed-off-by: Keith Packard <keithp@keithp.com>

Please cc all hwrng patches to linux-crypto@vger.kernel.org so that
it gets picked up by patchworks.  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: [PATCH] hwrng: core - allow perfect entropy from hardware devices
  2015-03-18  5:18 ` Herbert Xu
@ 2015-03-18  7:15   ` Keith Packard
  2015-03-18  8:58     ` Herbert Xu
  0 siblings, 1 reply; 4+ messages in thread
From: Keith Packard @ 2015-03-18  7:15 UTC (permalink / raw)
  To: Herbert Xu; +Cc: Matt Mackall, linux-kernel

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

Herbert Xu <herbert@gondor.apana.org.au> writes:

> Please cc all hwrng patches to linux-crypto@vger.kernel.org so that
> it gets picked up by patchworks.  Thanks!

Thanks! I didn't catch that in the MAINTAINERS file. Might be a good
thing to add?

-- 
-keith

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 810 bytes --]

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

* Re: [PATCH] hwrng: core - allow perfect entropy from hardware devices
  2015-03-18  7:15   ` Keith Packard
@ 2015-03-18  8:58     ` Herbert Xu
  0 siblings, 0 replies; 4+ messages in thread
From: Herbert Xu @ 2015-03-18  8:58 UTC (permalink / raw)
  To: Keith Packard; +Cc: Matt Mackall, linux-kernel

On Wed, Mar 18, 2015 at 12:15:49AM -0700, Keith Packard wrote:
> Herbert Xu <herbert@gondor.apana.org.au> writes:
> 
> > Please cc all hwrng patches to linux-crypto@vger.kernel.org so that
> > it gets picked up by patchworks.  Thanks!
> 
> Thanks! I didn't catch that in the MAINTAINERS file. Might be a good
> thing to add?

I think we've already added this to the MAINTAINERS file but it was
done fairly recently.

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:[~2015-03-18  8:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-18  5:13 [PATCH] hwrng: core - allow perfect entropy from hardware devices Keith Packard
2015-03-18  5:18 ` Herbert Xu
2015-03-18  7:15   ` Keith Packard
2015-03-18  8:58     ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox