aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-05-21 17:46:51 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-05-21 17:46:51 -0400
commit2a8ba8f032160552a3beffab8aae9019ff477504 (patch)
treeb50f70a3c8f7c2e179e1587d33ea3542d68525f9 /drivers/char
parentec2a7587e0a91d5c1afe23a0a73edfce06c5e4e0 (diff)
parente954bc91bdd4bb08b8325478c5004b24a23a3522 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: (46 commits) random: simplify fips mode crypto: authenc - Fix cryptlen calculation crypto: talitos - add support for sha224 crypto: talitos - add hash algorithms crypto: talitos - second prepare step for adding ahash algorithms crypto: talitos - prepare for adding ahash algorithms crypto: n2 - Add Niagara2 crypto driver crypto: skcipher - Add ablkcipher_walk interfaces crypto: testmgr - Add testing for async hashing and update/final crypto: tcrypt - Add speed tests for async hashing crypto: scatterwalk - Fix scatterwalk_done() test crypto: hifn_795x - Rename ablkcipher_walk to hifn_cipher_walk padata: Use get_online_cpus/put_online_cpus in padata_free padata: Add some code comments padata: Flush the padata queues actively padata: Use a timer to handle remaining objects in the reorder queues crypto: shash - Remove usage of CRYPTO_MINALIGN crypto: mv_cesa - Use resource_size crypto: omap - OMAP macros corrected padata: Use get_online_cpus/put_online_cpus ... Fix up conflicts in arch/arm/mach-omap2/devices.c
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/random.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/drivers/char/random.c b/drivers/char/random.c
index 2fd3d39995d5..8d85587b6d4f 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -257,6 +257,7 @@
257#define INPUT_POOL_WORDS 128 257#define INPUT_POOL_WORDS 128
258#define OUTPUT_POOL_WORDS 32 258#define OUTPUT_POOL_WORDS 32
259#define SEC_XFER_SIZE 512 259#define SEC_XFER_SIZE 512
260#define EXTRACT_SIZE 10
260 261
261/* 262/*
262 * The minimum number of bits of entropy before we wake up a read on 263 * The minimum number of bits of entropy before we wake up a read on
@@ -414,7 +415,7 @@ struct entropy_store {
414 unsigned add_ptr; 415 unsigned add_ptr;
415 int entropy_count; 416 int entropy_count;
416 int input_rotate; 417 int input_rotate;
417 __u8 *last_data; 418 __u8 last_data[EXTRACT_SIZE];
418}; 419};
419 420
420static __u32 input_pool_data[INPUT_POOL_WORDS]; 421static __u32 input_pool_data[INPUT_POOL_WORDS];
@@ -714,8 +715,6 @@ void add_disk_randomness(struct gendisk *disk)
714} 715}
715#endif 716#endif
716 717
717#define EXTRACT_SIZE 10
718
719/********************************************************************* 718/*********************************************************************
720 * 719 *
721 * Entropy extraction routines 720 * Entropy extraction routines
@@ -862,7 +861,7 @@ static ssize_t extract_entropy(struct entropy_store *r, void *buf,
862 while (nbytes) { 861 while (nbytes) {
863 extract_buf(r, tmp); 862 extract_buf(r, tmp);
864 863
865 if (r->last_data) { 864 if (fips_enabled) {
866 spin_lock_irqsave(&r->lock, flags); 865 spin_lock_irqsave(&r->lock, flags);
867 if (!memcmp(tmp, r->last_data, EXTRACT_SIZE)) 866 if (!memcmp(tmp, r->last_data, EXTRACT_SIZE))
868 panic("Hardware RNG duplicated output!\n"); 867 panic("Hardware RNG duplicated output!\n");
@@ -951,9 +950,6 @@ static void init_std_data(struct entropy_store *r)
951 now = ktime_get_real(); 950 now = ktime_get_real();
952 mix_pool_bytes(r, &now, sizeof(now)); 951 mix_pool_bytes(r, &now, sizeof(now));
953 mix_pool_bytes(r, utsname(), sizeof(*(utsname()))); 952 mix_pool_bytes(r, utsname(), sizeof(*(utsname())));
954 /* Enable continuous test in fips mode */
955 if (fips_enabled)
956 r->last_data = kmalloc(EXTRACT_SIZE, GFP_KERNEL);
957} 953}
958 954
959static int rand_initialize(void) 955static int rand_initialize(void)