From 9caead04e2ddf52a6f18539c339cd270d5a94ff4 Mon Sep 17 00:00:00 2001 From: Miloslav Trmač Date: Wed, 21 Jul 2010 16:15:52 +0200 Subject: Panic if FIPS rng test can't be set up If in FIPS mode, failure to allocate a buffer for the continuous test would silently disable the test. Panic instead. This is originally a hunk from From: Neil Horman Date: Sat, 13 Jun 2009 14:19:10 -0400 Subject: [crypto] add continuous test to hw rng in FIPS mode Message-id: 20090613181910.GB24861@localhost.localdomain --- drivers/char/random.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/char/random.c b/drivers/char/random.c index 2849713d223..d702a6ab083 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -952,8 +952,11 @@ static void init_std_data(struct entropy_store *r) mix_pool_bytes(r, &now, sizeof(now)); mix_pool_bytes(r, utsname(), sizeof(*(utsname()))); /* Enable continuous test in fips mode */ - if (fips_enabled) + if (fips_enabled) { r->last_data = kmalloc(EXTRACT_SIZE, GFP_KERNEL); + if (!r->last_data) + panic("RNG self test failed to init!\n"); + } } static int rand_initialize(void) -- cgit