From: Jason Cooper <jason@lakedaemon.net>
To: Kees Cook <keescook@chromium.org>
Cc: linux-kernel@vger.kernel.org, Matt Mackall <mpm@selenic.com>,
Herbert Xu <herbert@gondor.apana.org.au>,
Rusty Russell <rusty@rustcorp.com.au>,
Satoru Takeuchi <satoru.takeuchi@gmail.com>,
linux-crypto@vger.kernel.org, "Theodore Ts'o" <tytso@mit.edu>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH][RESEND 3] hwrng: add randomness to system from rng sources
Date: Thu, 6 Mar 2014 07:55:33 -0500 [thread overview]
Message-ID: <20140306125533.GA1872@titan.lakedaemon.net> (raw)
In-Reply-To: <20140303235148.GA7601@www.outflux.net>
On Mon, Mar 03, 2014 at 03:51:48PM -0800, Kees Cook wrote:
> When bringing a new RNG source online, it seems like it would make sense
> to use some of its bytes to make the system entropy pool more random,
> as done with all sorts of other devices that contain per-device or
> per-boot differences.
>
> Signed-off-by: Kees Cook <keescook@chromium.org>
> ---
> drivers/char/hw_random/core.c | 7 +++++++
> 1 file changed, 7 insertions(+)
fwiw,
Reviewed-by: Jason Cooper <jason@lakedaemon.net>
thx,
Jason.
> diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c
> index a0f7724852eb..6e5bb68a708c 100644
> --- a/drivers/char/hw_random/core.c
> +++ b/drivers/char/hw_random/core.c
> @@ -41,6 +41,7 @@
> #include <linux/miscdevice.h>
> #include <linux/delay.h>
> #include <linux/slab.h>
> +#include <linux/random.h>
> #include <asm/uaccess.h>
>
>
> @@ -305,6 +306,8 @@ int hwrng_register(struct hwrng *rng)
> int must_register_misc;
> int err = -EINVAL;
> struct hwrng *old_rng, *tmp;
> + unsigned char bytes[16];
> + int bytes_read;
>
> if (rng->name == NULL ||
> (rng->data_read == NULL && rng->read == NULL))
> @@ -348,6 +351,10 @@ int hwrng_register(struct hwrng *rng)
> }
> INIT_LIST_HEAD(&rng->list);
> list_add_tail(&rng->list, &rng_list);
> +
> + bytes_read = rng_get_data(rng, bytes, sizeof(bytes), 1);
> + if (bytes_read > 0)
> + add_device_randomness(bytes, bytes_read);
> out_unlock:
> mutex_unlock(&rng_mutex);
> out:
> --
> 1.7.9.5
>
>
> --
> Kees Cook
> Chrome OS Security
> --
> To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2014-03-06 12:55 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-03 23:51 Kees Cook
2014-03-04 15:38 ` Jason Cooper
2014-03-04 19:01 ` Kees Cook
2014-03-04 19:53 ` Jason Cooper
2014-03-04 19:59 ` Kees Cook
2014-03-04 22:39 ` Matt Mackall
2014-03-05 21:11 ` Jason Cooper
2014-03-05 21:51 ` Kees Cook
2014-03-06 0:52 ` Matt Mackall
2014-03-06 1:34 ` Kees Cook
2014-03-06 12:54 ` Jason Cooper
2014-03-17 2:12 ` H. Peter Anvin
2014-03-06 12:55 ` Jason Cooper [this message]
2014-03-10 12:22 ` Herbert Xu
2014-03-16 22:56 ` H. Peter Anvin
2014-03-17 11:53 ` Austin S Hemmelgarn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140306125533.GA1872@titan.lakedaemon.net \
--to=jason@lakedaemon.net \
--cc=akpm@linux-foundation.org \
--cc=herbert@gondor.apana.org.au \
--cc=keescook@chromium.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mpm@selenic.com \
--cc=rusty@rustcorp.com.au \
--cc=satoru.takeuchi@gmail.com \
--cc=tytso@mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®