I read over and over about how
/dev/random gets its entropy from "hardware events." What exactly are these hardware events and how can we be sure that it is random enough?
As @Rook says, a good starting point is the kernel source code itself, precisely the
drivers/char/random.c file. It begins with a long description (as comments), including this passage:
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.
The principal workhorse for the entropy gatherer is the
add_interrupt_randomness() function, that is meant to be invoked for each (or at least most) interrupts. An interrupt is the main method by which a piece of hardware makes it known to the CPU that it has changed state, e.g. that some new data is available, or, similarly, that the hardware is ready to process new data from the CPU. E.g. you will get an interrupt every time you press or release a key, or move the mouse, or receive a network packet. You will also get interrupts from the timer, and from a lot of other sources. "Entropy" is obtained mostly by measuring the exact time at which the interrupt is received: modern CPU have a cycle counter that can be used to get a notion of time down to the nanosecond precision (precision, not accuracy, but that's good enough here). The type of interrupts are also included in the mix, but most of the entropy comes from these cycle counts.
Remember that "entropy" can be defined as "that which the attacker does not know". Through external measures and simulation, the attacker can get some notions of what occurs and when in the kernel, but within some limits. For instance, the attacker may measure the time of arrival of a network packet down to the microsecond; he will still miss 10 bits of entropy if the kernel measures that time down to the nanosecond.
Apart from interrupts, other kernel parts (e.g. device drivers) can push extra data into the pool by calling
add_input_randomness(), in case such drivers have access to data that is considered "random" in some way (precisely, in a way that attackers cannot guess).
From userland, you can also push data manually by writing into
/dev/random. One good source would be pictures from a webcam: that's a lot of data with a lot of thermal noise. Linux distributions use this "external entropy push" possibility to maintain entropy across reboots: when the machine boots, it injects a "seed file" that it then immediately recreates from
/dev/urandom. Therefore, one big source of entropy for
/dev/random is entropy obtained from previous incarnations of
/dev/random (before the last boot).