[GIT PULL] x86/rdrand additional for v3.3-rc1

From: H. Peter Anvin
Date: Mon Jan 16 2012 - 14:47:44 EST


Hi Linus,

The following changes since commit 53999bf34d55981328f8ba9def558d3e104d6e36:

error: implicit declaration of function 'module_flags_taint' (2012-01-15 16:21:07 -0800)

are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/rdrand

The head of this tree is 2dac8e54f988ab58525505d7ef982493374433c3.

This is simply Ted's patch to use RDRAND for initializing the random
number pools, when available, with an additional patch to make it run
the exact number of times needed; as written it would run twice the
necessary number of iterations on 64-bit platforms.

H. Peter Anvin (1):
random: Adjust the number of loops when initializing

Theodore Ts'o (1):
random: Use arch-specific RNG to initialize the entropy store

drivers/char/random.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/drivers/char/random.c b/drivers/char/random.c
index 732215b..54ca8b2 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -965,6 +965,7 @@ EXPORT_SYMBOL(get_random_bytes);
*/
static void init_std_data(struct entropy_store *r)
{
+ int i;
ktime_t now;
unsigned long flags;

@@ -974,6 +975,11 @@ static void init_std_data(struct entropy_store *r)

now = ktime_get_real();
mix_pool_bytes(r, &now, sizeof(now));
+ for (i = r->poolinfo->POOLBYTES; i > 0; i -= sizeof flags) {
+ if (!arch_get_random_long(&flags))
+ break;
+ mix_pool_bytes(r, &flags, sizeof(flags));
+ }
mix_pool_bytes(r, utsname(), sizeof(*(utsname())));
}

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/