r/linux • u/atoponce • Mar 01 '22
Linux 5.18 will likely have a blocking /dev/urandom such that calls to the RNG will *always* return secure bytes after initial seeding, which takes no more than 1s after boot. After decades of confusion, all random interfaces will finally be identical.
https://git.kernel.org/pub/scm/linux/kernel/git/crng/random.git/commit/?id=2ad310f93ec3d7062bdb73f06743aa56879a0a28
1.5k
Upvotes
20
u/za419 Mar 01 '22
The problem you both have is that you're conceptualizing
/dev/randomas 'the blocking one' - it hasn't been for around two years.Both of them pull data from a CSPRNG that gets seeded with 256 bits of entropy and then proceeds to churn out cryptographically secure randomness for a long while, until the kernel has collected another 256 bits and rekeys it.
So the only difference right now is the behavior before those first 256 bits - urandom gives you subpar data, random blocks. This will eliminate the urandom behavior.
However, 256 bits of entropy appear very quickly after the kernel starts. By the time you're going through system init (be that upstart, SysV, systemd, et cetera), you're going to have so much jitter that the only processor the kernel won't have 256 bits of randomness from is the i486. And even so, that'll seed fairly quickly from interrupts.
On most systems, the blocking window will close within about a second of grub handing control over to the kernel - after that, urandom will never block again.