|
|
Log in / Subscribe / Register

Uniting the Linux random-number devices

Uniting the Linux random-number devices

Posted Feb 19, 2022 14:37 UTC (Sat) by ianmcc (guest, #88379)
In reply to: Uniting the Linux random-number devices by developer122
Parent article: Uniting the Linux random-number devices

Currently /dev/urandom doesn't block. This means there is a window once the machine has booted where you can draw numbers from /dev/urandom and it isn't properly seeded. /dev/random will block until it is properly seeded. Other than that, since 2020 they are equivalent, and /dev/random won't ever block after it has been seeded.

Once /dev/urandom is properly seeded (or you read from /dev/random), if you're an attacker and you draw 1 billion numbers, ... it doesn't help you because you can't crack the crypto in the PRNG. (well, if you *can*, you've made a breakthrough in crypto that will make you as famous as you'll be infamous).

In the old days (well, I think prior to 2020? So not so old), /dev/random would remove N bits of entropy from the pool for every N bits read from /dev/random, and if there isn't N bits of entropy available then it would block until there is. This was based on a misunderstanding that you need to consume entropy to generate cryptographically secure random numbers. But if you use a cryptographically secure PRNG, then you only need enough bits of entropy for the seed of the PRNG, and you can generate as many secure random bits as you like. Predicting the next number in the sequence requires determining the internal state of the PRNG, which isn't possible from examining the prior output (as long as the crypto algorithm doesn't contain any flaws). So there is an assumption that the crypto is strong and won't be broken.


to post comments


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds