3 ms·
/dev/random does not block when 'out of entropy'. 'Running out of entropy' isn't something that can happen, and /dev/random will only block if the RNG hasn't be
by jameswryan 3y ago
/dev/random does not block when 'out of entropy'.
'Running out of entropy' isn't something that can happen, and /dev/random will only block if the RNG hasn't been initialized (short enough after boot to not matter).
See Jason Donenfeld's authoritative talk on the Linux RNG for details: https://youtu.be/-_yzaSp2xtY https://youtu.be/-_yzaSp2xtY
- cbsmith 3y agoI'll have to look at the talk, but I've had first hand experience with that behaviour from /dev/random. Perhaps it has changed over time.
- cbsmith 3y agoI just checked the source code, and it appears that the entropy pool is alive and well and that /dev/random still waits for enough entropy to collect in the pool before providing more data for consumption. https://github.com/torvalds/linux/blob/48b1320a674e1ff5de2fad8606bee38f724594dc/drivers/char/random.c#L69 https://github.com/torvalds/linux/blob/48b1320a674e1ff5de2fa... The "wait_for_random_bytes" function is still there: https://github.com/torvalds/linux/blob/48b1320a674e1ff5de2fad8606bee38f724594dc/drivers/char/random.c#L132 https://github.com/torvalds/linux/blob/48b1320a674e1ff5de2fa...