Linux – What entropy sources are used by the Linux kernel

linuxlinux-kernelrandom

man 4 random has a very vague description of Linux kernel entropy sources:

The random number generator gathers environmental noise from device drivers and other sources into an entropy pool.

The paper Entropy transfers in the Linux Random Number Generator isn't much more specific, either. It lists:

  • add_disk_randomness(),
  • add_input_randomness(), and
  • add_interrupt_randomness().

These functinos are from random.c, which includes following comment:

Sources of randomness from the environment include inter-keyboard
timings, inter-interrupt timings from some interrupts, and other
events which are both (a) non-deterministic and (b) hard for an
outside observer to measure.

Further down, there is a function add_hwgenerator_randomness(...) indicating support for hardware random number generators.

All those information are rather vague (or, in the case of the source code, require deep knowledge of the Linux kernel to understand). What are the actual entropy sources used, and does the Linux kernel support any hardware random number generators out-of-the-box?

Best Answer

Most commodity PC hardware has a random number generator these days. VIA Semiconductor has put them in their processors for many years; the Linux kernel has the via-rng driver for that. I count 34 source modules in the drivers/char/hw_random/ directory in the latest source tree, including drivers for Intel and AMD hardware, and for systems that have a TPM device. You can run the rng daemon (rngd) to push random data to the kernel entropy pool.

Related Question