random
Source of secure random data
Syntax:
random [-hpt] [-i #] [-U user_name | uid[:gid[,sup_gid]*]]]
Options:
- -h
- Show the usage message.
- -i#
- Use interrupt number # as a source for collecting random data. You may specify more than one interrupt, to a maximum of 32.
- -p
- Poll system information from /proc for random data.
- -t
- Use the high-performance clock as a random data source.
- -U user_name
- -U uid[:gid[,sup_gid]*]]
-
Once running, run as the specified user, so that the program doesn't need to run as root:
- In the first form, the service sets itself to be the named user and uses that user's groups. This form depends on the /etc/passwd and /etc/group files.
- In the second form, the service sets its user ID, and optionally its group ID and supplementary groups, to the values provided.
Description:
The random service runs in the background providing a source of secure, random data suitable for encryption and security. The service builds its internal pool of random data from sources specified when it is started. These sources may include timers, interrupts, and detailed system runtime information. The service makes this random data available by providing device entries that any application can read:
- /dev/random
- A source of high-quality random numbers.
- /dev/urandom
- An unlocked random source that reuses the internal pool to produce more pseudo-random bits. This means that the call won't block, but the output may contain less entropy than a corresponding read from /dev/random.
The user controls all of the sources to be used to collect random data by specifying source options on the command line.
Examples:
Start the random service using three PC interrupts as sources:
random -i12 -i14 -i15
From an application, read 4 bytes of random data like this:
int data; int fd; fd = open( "/dev/random", O_RDWR ); if( fd == -1 ) exit( 1 ); read( fd, &data, sizeof( data ) ); close( fd );
Exit status:
- 0
- The random data is available from /dev/random and /dev/urandom.
- Any other value
- An error occurred; /dev/random and /dev/urandom aren't created.
Errors:
If an error occurs, random sends a description of the error to slogger and doesn't create /dev/random or /dev/urandom.
Contributing author:
The random service uses the core algorithm from the copyright-free Yarrow pseudo-random number generator (PRNG) from Counterpane Security (http://www.counterpane.com/yarrow.html). Bruce Schneier and John Kelsey designed the Yarrow PRNG.
Caveats:
The random service will not work unless you specify at least one source of random data (options -p, -t, or -i).