6 ms·
Uh What? Did they just replace a cryptographically secure random generator with a more deterministic pseudorandom generator??? Granted, blocking on /dev/random
by exabrial 14y ago
Uh What? Did they just replace a cryptographically secure random generator with a more deterministic pseudorandom generator???
Granted, blocking on /dev/random is dumb, but this is ridiculous as well... seems like there should be a way to implement a cache in the kernel.
- Freaky 14y agoFreeBSD, OS X and iOS have non-blocking /dev/random thanks to http://en.wikipedia.org/wiki/Yarrow_algorithm http://en.wikipedia.org/wiki/Yarrow_algorithm
- B-Con 14y agoThose are more or less the equivalent of /dev/urandom, not /dev/random. On Linux, /dev/random is only raw entropy, /dev/urandom is raw entropy plus PRG stretching when raw entropy runs out.
- __alexs 14y ago/dev/random is not "raw entropy" it goes through the exact same mixing and (SHA-1) compression stages that /dev/urandom does. It just happens to block if there's not much entropy in the pool at the start. Source: http://eprint.iacr.org/2012/251.pdf http://eprint.iacr.org/2012/251.pdf also, the kernel source.
- B-Con 14y agoI understand that, my words were not precise. My point in phrasing it that way was that there is no entropy stretching. (You only get to read (about) as much entropy as has been gathered. You don't have to worry about reading 128 bytes and having them be associated with the previously read 128 bytes, because the pools that generated them are distinct.)
- Freaky 14y agoWell, the main distinction of note would be whether or not they're cryptographically secure, which (despite being much slower) Linux /dev/urandom isn't?
- deleted 14y ago[deleted]
- B-Con 14y agoNot sure what you mean, but /dev/random should indeed be a blocking read. The question is whether they should be using /dev/random to begin with.
- marshray 14y agoLinux /dev/random is based on an old design based on obsolete recommendataions. A modern cryptographically-secure properly implemented RNG doesn't need to worry about enropy exhaustion after a good initial seeding. On the contrary, there have been real security problems seen when apps unpredictably get nothing back from the RNG. Exhaustion can also be provoked by a remote attacker.
- andrewcooke 14y agohow does that contradict the person you're replying to? surely it would be a non-blocking read that would return empty. you seem to be saying that apps generally should need /dev/random only rarely. which seems sensible, but is also what the post one up suggested. in short you seem to be in confused and annoyed agreement. [vaguely related interesting post on urandom quality - http://security.stackexchange.com/questions/3936/is-a-rand-from-dev-urandom-secure-for-a-login-key/3939#3939 http://security.stackexchange.com/questions/3936/is-a-rand-f...]
- marshray 14y agoI'm saying that regardless of whether /dev/random is read with a blocking call, it shouldn't ever block. (Except during initial seeding right at startup). +1 on the linked post.
- B-Con 14y agoIt's not outdated. Good quality PRNGs are not that new. But for good reasons, cryptographically sensitive applications do not want to be in a position of relying purely on PRNG stretched output. Reading from urandom, you have no idea how much entropy was used to seed your output. Was it 5 bytes from last week, or 4K from 5 seconds ago? You don't know. The PRNG may be good enough to keep successive reads from being statistically correlated and such, but that is only one concern. Crypto, random number generation, and the practical implementations thereof is much more complicated than just the quality of the primitives. Sometimes you want to know for sure how much entropy is devoted to your read. In such a case, you use random.