[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1341709606.25597.182.camel@deadeye.wl.decadent.org.uk>
Date: Sun, 08 Jul 2012 02:06:46 +0100
From: Ben Hutchings <ben@...adent.org.uk>
To: Theodore Ts'o <tytso@....edu>
Cc: Linux Kernel Developers List <linux-kernel@...r.kernel.org>,
ewust@...ch.edu, zakir@...ch.edu, nadiah@...ucsd.edu,
jhalderm@...ch.edu, stable@...r.kernel.org
Subject: Re: [PATCH 07/12] random: use the arch-specific rng in
xfer_secondary_pool
On Fri, 2012-07-06 at 18:44 -0400, Theodore Ts'o wrote:
> If the CPU supports a hardware random number generator, use it in
> xfer_secondary_pool(), where it will significantly improve things and
> where we can afford it.
>
> Also, remove the use of the arch-specific rng in
> add_timer_randomness(), since the call is significantly slower than
> get_cycles(), and we're much better off using it in
> xfer_secondary_pool() anyway.
[...]
> @@ -838,7 +834,11 @@ static ssize_t extract_entropy(struct entropy_store *r, void *buf,
> */
> static void xfer_secondary_pool(struct entropy_store *r, size_t nbytes)
> {
> - __u32 tmp[OUTPUT_POOL_WORDS];
> + union {
> + __u32 tmp[OUTPUT_POOL_WORDS];
> + long hwrand[4];
> + } u;
> + int i;
[...]
> + for (i = 0; i < 4; i++)
> + if (arch_get_random_long(&u.hwrand[i]))
> + break;
> + if (i)
> + mix_pool_bytes(r, &u.hwrand, sizeof(u.hwrand), 0);
[...]
Surely the number of random bytes being added is i * sizeof(long), not
sizeof(u.hwrand)?
Ben.
--
Ben Hutchings
Life would be so much easier if we could look at the source code.
Download attachment "signature.asc" of type "application/pgp-signature" (829 bytes)
Powered by blists - more mailing lists