patches/0001-Disable-PRNG-entropy-accounting.patch
changeset 2 d1f6d8b6f81c
equal deleted inserted replaced
1:0056487c491e 2:d1f6d8b6f81c
       
     1 From d8f0df50e5449782d2823ea788fa5e8dc48a4473 Mon Sep 17 00:00:00 2001
       
     2 From: Florian Westphal <fw@strlen.de>
       
     3 Date: Sun, 22 Mar 2009 15:09:07 +0100
       
     4 Subject: [PATCH] Disable PRNG entropy accounting.
       
     5 
       
     6 The real fix is to either completely replace random.c,
       
     7 providing our own implementation using ns-3 rng infrastructure,
       
     8 or feed the prng periodically.
       
     9 ---
       
    10  drivers/char/random.c |   10 +++++++++-
       
    11  1 files changed, 9 insertions(+), 1 deletions(-)
       
    12 
       
    13 diff --git a/drivers/char/random.c b/drivers/char/random.c
       
    14 index 7c13581..1efc24e 100644
       
    15 --- a/drivers/char/random.c
       
    16 +++ b/drivers/char/random.c
       
    17 @@ -766,7 +766,15 @@ static size_t account(struct entropy_store *r, size_t nbytes, int min,
       
    18  		      int reserved)
       
    19  {
       
    20  	unsigned long flags;
       
    21 -
       
    22 +#ifdef CONFIG_NSC
       
    23 +	/*
       
    24 +	 * prevent infinite loop: if a code path calls get_random_bytes
       
    25 +	 * and we've run out of entropy, this calls wake_up_interruptible(),
       
    26 +	 * which calls the code path again, which calls get_random_bytes,
       
    27 +	 * which calls wake_up which...
       
    28 +	 */
       
    29 +	return nbytes;
       
    30 +#endif
       
    31  	/* Hold lock while accounting */
       
    32  	spin_lock_irqsave(&r->lock, flags);
       
    33  
       
    34 -- 
       
    35 1.6.0.6
       
    36