enable use of the hwrng for kernel entropy pool

Today I learned that the hardware rng, even though its driver was loaded, wasn’t being used at all other than to create /dev/hwrng which isn’t used by anything. The problem is that the driver neglects to declare a “quality” parameter that indicates the quality of the entropy it generates, which causes it to be ignored for the purposes of filling the kernel’s entropy pool.

The fix was easy: add rng_core.default_quality=1024 to the kernel parameters (“cmdline” variable in /boot/uEnv.txt) and reboot. Voila, you can now read more than 100 KB/s from /dev/random. (But note that you shouldn’t be reading from /dev/random in the first place, use /dev/urandom or the getrandom() system call instead.)

If you don’t fully trust the hwrng and want to be paranoid, you can set the quality parameter to a lower value. For example setting it to 100 will cause ten times as much data to be drawn from the hwrng and hashed together.

Matthijs