Re: /dev/random -- can I enlarge the `randomness stock'?

From: Lucca (sdlucca@mindspring.com)
Date: Sun May 21 2000 - 15:52:47 EST


> For an application, I need a random seed with about 25000 bits
> of randomness from time to time. Unfortunately, /dev/random in
> the standard kernel only stocks 512 bytes of randomness. Can I
> enlarge it with no ill effect merely by changing one variable
> in the kernel's random.c? [Here core memory is no problem.] I
> have read the source but am loathe to try anything on a running
> machine with a duty. Thanks.

Yes.

/usr/src/linux/drivers/char/random.c, line 263 or so.

#define POOLWORDS 128

This is the number of 32 bit words that make up the entropy pool. As long
as you set it to a power of two between 128 and 2048 you'll be ok. The
limit is the "stirring operations" have only been defined for that range.

2048 words will give you 65536 bits of entropy at peak. Note that it will
take quite a bit longer to get there. Also, if you have startup/shutdown
scripts that save/load data from /dev/(u)random, you will want to modify
them for the new size.

Practically speaking however, this problem is better solved by a userspace
daemon that continuously reads /dev/random into a larger buffer, which
could be sent to clients needing large bursts of entropy on request.

For any large-scale use, however, you'll need a hardware random number
generator. Depending on where you live, they are more troublesome to
purchase legally that heavy munitions.

lucca@acm.org

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



This archive was generated by hypermail 2b29 : Tue May 23 2000 - 21:00:20 EST