Re:BoringSSL
by oconnor663 on Tuesday October 20, 2015 @04:44PM
(#10421692)
Linux is one of the cases where the difference matters a lot, because /dev/random is blocking. I think it's BSD where the two devices are the same.
[ Parent
| on HN ]
The difference matters, but on Linux, the difference means that you need to avoid /dev/random, because the blocking behavior virtually never helps security but always reduces reliability.
Re:BoringSSL
by nickpsecurity on Tuesday October 20, 2015 @08:02PM
(#10422731)
"because the blocking behavior virtually never helps security but always reduces reliability."
I like how you put that. Best way to because infrastructure reliability is way too important to sacrifice over questionable security gains. Puts a QED on the whole discussion.
Of course you probably already know this, but I think the root problem that OP is driving at here is that if you use /dev/urandom then you risk getting predictable values from /dev/urandom at startup[1], e.g. when initializing your server's SSH keys (or whatever). I seem to recall this being the root cause of thousands upon thousands of home routers being having weak keys. As such, it's important to point out.
[1] That is, before enough external entropy has been gathered.
Re:BoringSSL
by oconnor663 on Wednesday October 21, 2015 @11:11AM
(#10425964)
I think the new `getrandom` interface fixes that, by blocking until /dev/urandom is initialized.
Yes. Yes, it does... but it's not transparent to userspace, which I think is what tptacek was alluding to. (And, frankly, is how it should be. However, the Linux kernel maintainers are absolutely fanatical about backward compatibility for userspace, so here we are with a new syscall.)
Re:BoringSSL
by binarycrusader on Tuesday October 20, 2015 @10:28PM
(#10423299)
If your cryptography requirements require high entropy for the random numbers generated, then blocking is the right answer.
In practice, that's rare, but some consumers have strict, hard requirements that can't be ignored.
Once your CSPRNG has enough entropy in its internal state it has got this entropy.
Retrieving output bytes doesn't change anything.
The view "take three bytes output, lose three bytes entropy" is simply not correct.
Re:BoringSSL
by binarycrusader on Tuesday October 20, 2015 @05:24PM
(#10421913)
That doesn't match the repeated assertions of many posters here. I can only speak for Solaris knowledge-wise.
Re:BoringSSL
by keeperofdakeys on Tuesday October 20, 2015 @06:21PM
(#10422231)
Here is a rough diagram which demonstrates it http://www.2uo.de/myths-about-urandom/structure-yes.png (from the detailed page http://www.2uo.de/myths-about-urandom/). /dev/random will block when the entropy estimate in low, but in a practical sense, the output of /dev/urandom and /dev/random are both random.
Re:BoringSSL
by ghshephard on Tuesday October 20, 2015 @05:39PM
(#10421995)
"That doesn't match the repeated assertions of many posters here" - I'm curious, what doesn't match?
Better to block than spit out low entropy data.
Re:BoringSSL
by oconnor663 on Wednesday October 28, 2015 @05:43PM
(#10467644)
That's true the way you say it, and that's definitely the problem that `getrandom()` solves by blocking if the random pool isn't initialized yet. But a lot of people take that to mean "you should never get more than N random bytes from a pool that has N bytes of entropy", and that part is wrong.
All of crypto relies on being able to generate an arbitrary amount of good random bytes from a single 256-or-whatever-byte seed. Otherwise it wouldn't be safe to encrypt a long message with a short key.