News for hackers. Stuff that matters.
Re:Google confirms Java and OpenSSL crypto PRNG on Android a... by glurgh on Thursday August 15, 2013 @04:10AM (#6216666)
I think this is fundamentally wrong, in the way 'secure programs should do their own crypto' is wrong. Secure programs should be able to rely on the platform provider's API to provide a CSPRNG. If the platform doesn't, it's the platform's fault and let's all go yell at them. It seems odd to put this at the doorstep of app developers. Android app developers should reasonably expect that SecureRandom does what it says on the tin as should consumers of similar apis in iOS, .net, OS X, Windows, you name it. "I'm a Java app, but really, in fact, I happen to know underneath it all it's Linux thus I will read some random file descriptor". It's a Chewbacca defense, it makes no sense!
Re:Google confirms Java and OpenSSL crypto PRNG on Android a... by tptacek on Thursday August 15, 2013 @11:24AM (#6218358)
Would that every platform had done what Golang did and simply wrap /dev/random. In the meantime, you have to make a choice: do you trust your language designer's CSPRNG AND the OS CSPRNG on which it (and the rest of the system) doubtless depends, or instead trust only the OS CSPRNG?
Re:Google confirms Java and OpenSSL crypto PRNG on Android a... by glurgh on Thursday August 15, 2013 @04:52PM (#6220524)
Sure but down that path lies 'did Intel and the NSA backdoor my CPU' tinfoilhattery. If you're an app developer, rather than implementor of original crypto from dry sticks and a bit of flint, you have to trust something and the platform API is a sane place to start. Google, who have specialists on staff, seems to have got this wrong at least twice. It seems unreasonable to expect a person who's simply looking for a nonce to do better or to keep careful track of how to do better because the APIs at hand just don't do what they claim they do.
Re:Google confirms Java and OpenSSL crypto PRNG on Android a... by tptacek on Thursday August 15, 2013 @06:08PM (#6220911)
This comment appears to be animated by a belief that the NSA backdoors the Linux source code.
Re:Google confirms Java and OpenSSL crypto PRNG on Android a... by glurgh on Thursday August 15, 2013 @06:26PM (#6220991)
Wait, wat? I thought we were talking about 'What is the reasonable line that cryptography API users should assume is secure'. Which is something sensible people can disagree on.

I just happen to think you're wrong (and the NaCl paper you mention actually provides advice to crypto library writers, not users, for the question at hand). I'm not animated by anything any more than you're in the secret employ of the cartesian product of all possible three letters.

Re:Google confirms Java and OpenSSL crypto PRNG on Android a... by tptacek on Thursday August 15, 2013 @07:17PM (#6221208)
I'm just not following why you think the NSA makes /dev/random risky. /dev/random is not an interface to hardware random numbers; it's the logical interface to the OS's own CSPRNG, which uses multiple sources of entropy.
Re:Google confirms Java and OpenSSL crypto PRNG on Android a... by glurgh on Thursday August 15, 2013 @07:46PM (#6221334)
I don't think that at all, I'm sorry a dumb NSA joke confused the issue. I think app writers should be calling SecureRandom (or platform equivalents) and expect secure results. Just like app writers should use TLS, despite its faults. My argument is that reading '/dev/urandom' is akin to opening a raw socket and hand-crafting packet headers because you don't trust TLS.
Re:Google confirms Java and OpenSSL crypto PRNG on Android a... by tptacek on Thursday August 15, 2013 @08:45PM (#6221544)
I'll stop harping on the backdoor point. What kinds of things do you think developers can do wrong reading from urandom? There are a lot of things you can get wrong using raw sockets instead of TLS; a universe of them.

My real issue isn't that devs use SecureRandom. Use it by default; it's not like we'd doc a bug on you for doing that.

My real issue is that the library developers who expose SecureRandom don't themselves simply pull the random bytes from urandom.

Re:Google confirms Java and OpenSSL crypto PRNG on Android a... by glurgh on Thursday August 15, 2013 @09:31PM (#6221704)
I'll stop harping on the backdoor point.

I never even made such a point! At all! If anything, I'd like to know how I gave you that impression so I can avoid it in the future.

What kinds of things do you think developers can do wrong reading from urandom?

Well for one thing it's entirely unportable. I think cperciva pointed out some difference on how it behaves on FreeBSD vs Linux. How does it behave on OS X? On Windows? What are the failure modes?

My real issue is that the library developers who expose SecureRandom don't themselves simply pull the random bytes from urandom.

I'm in 74211004% agreement with you there, as is the NaCl paper. Centralize randomness, ensure that it's reviewable and done right. In fact, the NaCl paper suggests:

"A structural deficiency in the /dev/urandom API provided by Linux, BSD, etc. is that using it can fail, for example because the system has no available file descriptors. In this case NaCl waits and tries again. We recommend that operating systems add a reliable urandom(x,xlen) system call."

Again, my stipulation is that this is very much not the job of app developers. The Android bitcoin wallet developers seem to be a case in point - they don't seem to have done anything particularly wrong at all. The platform failed them. So should we be berating platform providers or should we insist app-writers keep close track of various security developments? I think it's very much the former.

Re:Google confirms Java and OpenSSL crypto PRNG on Android a... by tptacek on Thursday August 15, 2013 @10:35PM (#6221908)
Sorry, I was trying to concede that you weren't making that point, but did it clumsily.

So here is the interesting question as I see it:

What's safer for developers, reading from /dev/urandom, or calling the platform CSPRNG when the platform CSPRNG does something other than reading from /dev/urandom?

I think the answer might be /dev/urandom. A Debian maintainer is not going to accidentally comment the randomness out of the Linux kernel CSPRNG. Nobody is going to miss the logic bug that causes the Linux kernel random number generator to not even try to seed itself.

Re:Google confirms Java and OpenSSL crypto PRNG on Android a... by glurgh on Friday August 16, 2013 @04:53AM (#6222882)
What's safer for developers, reading from /dev/urandom, or calling the platform CSPRNG when the platform CSPRNG does something other than reading from /dev/urandom?

I think you're right about this and the (rather fiddly and nerdy) point where we disagree is on where the line of abstraction lies. I don't think you have any business reading /dev/urandom any more than you have using, say, AES-NI

Re:Google confirms Java and OpenSSL crypto PRNG on Android a... by tedunangst on Friday August 16, 2013 @01:51PM (#6225592)
Nobody is going to miss the logic bug that causes the Linux kernel random number generator to not even try to seed itself.

Well, NetBSD more or less did that twice in a row earlier this year...

Re:Google confirms Java and OpenSSL crypto PRNG on Android a... by doe88 on Thursday August 15, 2013 @02:27PM (#6219694)
I think iOS does just that see the function SecRandomCopyBytes in http://opensource.apple.com/source/Security/Security-55179.1... it just wraps /dev/random