I thought using /dev/random was depricated and that you should instead use a getrandom syscall that blocks if you don't have enough entropy.
I thought using /dev/random was depricated and that you should instead use a getrandom syscall that blocks if you don't have enough entropy.
https://www.phoronix.com/scan.php?page=news_item&px=Linux-5....
Note that "if you don't have enough entropy" is not based on any rigorous formal analysis, which is why /dev/urandom has been recommended for a long time, and why the entire concept of blocking randomness syscalls is controversial in kernel-land:
> The /dev/random device is a legacy interface which dates back to a time where the cryptographic primitives used in the implementation of /dev/urandom were not widely trusted. It will return random bytes only within the estimated number of bits of fresh noise in the entropy pool, blocking if necessary. /dev/random is suitable for applications that need high quality randomness, and can afford indeterminate delays.
and recommend:
> Linux 3.17 and later provides the simpler and safer getrandom(2) interface which requires no special files; see the getrandom(2) manual page for details.
Which, in most cases I can think of is a rather undesirable behavior.
I would really be interested to understand which use cases justify using an actual blocking call to retrieve random bits.
I've always been under the impression that the only valid use case for raw entropy bits is regularly seeding crypto-hard RNGs that can generate an endless stream of random bits (à la /dev/urandom).
Looking forward to being educated on the topic.
Correct API: https://fuchsia.dev/fuchsia-src/reference/syscalls/cprng_dra...
”Terminates the calling process”? That sounds different and interesting, do you know more about this aspect of Fuchsia?
The only case I can think of is when you've mass produced a million devices that each need unique certificates that are generated on first boot. If no good source of randomness is available, there's a decent risk you'll have duplicates.