DESCRIPTION
The random device returns an endless supply of random bytes when read. It also accepts and reads data as any ordinary (and willing) file, but discards data written to it. The device will probe for certain hardware entropy sources, and use these in preference to the fallback, which is a generator implemented in software. If the device is using the software generator, writing data to random would perturb the internal state. This perturbation of the internal state is the only userland method of introducing extra entropy into the device. If the writer has superuser privilege, then closing the device after writing will make the software generator reseed itself. This can be used for extra security, as it immediately introduces any/all new entropy into the PRNG. The hardware generators will generate sufficient quantities of entropy, and will therefore ignore user-supplied input. The software random device may be controlled with sysctl(8).
To see the current settings of the software random device, use the command line:
sysctl kern.random
which results in something like:
kern.random.sys.seeded: 1
kern.random.sys.burst: 20
kern.random.sys.harvest.ethernet: 0
kern.random.sys.harvest.point_to_point: 0
kern.random.sys.harvest.interrupt: 0
kern.random.yarrow.gengateinterval: 10
kern.random.yarrow.bins: 10
kern.random.yarrow.fastthresh: 100
kern.random.yarrow.slowthresh: 160
kern.random.yarrow.slowoverthresh: 2
(These would not be seen if a hardware generator is present.)
All settings are read/write.
The kern.random.sys.seeded variable indicates whether or not the random device is in an acceptably secure state as a result of reseeding. If set to 0, the device will block (on read) until the next reseed (which can be from an explicit write, or as a result of entropy harvesting). A reseed will set the value to 1 (non-blocking).
The kern.random.sys.burst variable instructs the kernel thread that processes the harvest queue to tsleep(9) briefly after that many events have been processed. This helps prevent the random device from being so compute-bound that it takes over all processing ability. A value of 0 (zero) is treated as infinity, and will only allow the kernel to pause if the queue is empty. Only values in the range [0..20] are accepted.
The kern.random.sys.harvest.ethernet variable is used to select LAN traffic as an entropy source. A 0 (zero) value means that LAN traffic is not considered as an entropy source. Set the variable to 1 (one) if you wish to use LAN traffic for entropy harvesting.
The kern.random.sys.harvest.point_to_point variable is used to select serial line traffic as an entropy source. (Serial line traffic includes PPP, SLIP and all tun0 traffic.) A 0 (zero) value means such traffic is not considered as an entropy source. Set the variable to 1 (one) if you wish to use it for entropy harvesting.
The kern.random.sys.harvest.interrupt variable is used to select hardware interrupts as an entropy source. A 0 (zero) value means interrupts are not considered as an entropy source. Set the variable to 1 (one) if you wish to use them for entropy harvesting. All interrupt harvesting is setup by the individual device drivers.
The other variables are explained in the paper describing the Yarrow algorithm at http://www.counterpane.com/yarrow.html.
These variables are all limited in terms of the values they may contain: