by tptacek · 10y ago · 0 comments
1. Ensuring that it's adequately seeded before anyone can use it.
2. Providing forward secrecy by periodically rekeying ("refreshing the entropy pool", but we should do away with that terminology).
3. Carrying over state across reboots.
(There are four problems if you consider "being performant" a problem on the scale of fundamental design, but it's mostly not).
You wouldn't think CSPRNGs are this simple by reading either the literature on things like Fortuna and Yarrow or by reading the LKML and patch proposals for the LRNG. You'd think it was super tricky to collect "enough entropy" from enough "decorrelated sources", you'd think you'd have to deal with "depletion", you'd think about "high quality" versus "low quality" entropy, and the like. But these issues aren't just not important: they are mostly folkloric.
Generating a practically limitless stream of random bits isn't a hard cryptographic problem. It is an elementary problem. It's the problem that every stream encryption scheme solves. You can simply use stream encryption schemes, like stream ciphers or block ciphers and hashes in CTR mode, as CSPRNGs.
The problem we need to solve isn't upgrading the LRNG or getting everyone to use Schneier's favorite CSPRNG design (the section on this in Cryptography Engineering is one of the book's few warts). It's getting everyone to use the kernel RNG to the exclusion of all else. That's because those 3 problems I listed up there are easy to solve if you're using /dev/urandom (or the getrandom system call), but extremely tricky otherwise.
This manifests in issues like scalability: some patches were merged to (slightly) improve scalable performance of /dev/urandom...and these were phrased as "Sure, we can do this, because idiots might want that and it costs us little--but we should emphasize this sort of thing isn't an actual supported feature!"
The people who maintain /dev/urandom aren't stupid, but for some reason they really don't seem to get (or agree with at least) your argument. I'd really like to understand why; I don't.
(I am technically a linux developer--I work on the kernel we use internally, and have actual patches to my name upstream--but am not a deep part of the external community.)
Meanwhile, teams of people who are cryptographers of world renown, such as the Bernstein, Lange, and Schwabe team that designed and implemented Nacl, just use urandom.
This case is closed. Use the system call interface by all means if it's available to you! But don't use userspace RNGs, like OpenSSL and GPG do, and don't use /dev/random.
Every software developer needs to print out this sentence and stick it above their kanban board (or equivalent).
https://sites.google.com/site/astudyofentropy/project-defini...
EDIT: Secondly
This "Furthermore, the flaw makes a part of the PRNG output completely predictable"
= Predict the random number generator no matter what it is seeded with.
Dear God.
On the plus side, these games have given the Russians near total access to all the important US systems, while they feed disinformation into their non hardened systems. So at least we can laugh at the irony.