News for hackers. Stuff that matters.
Re:Cracking random number generators (xoroshiro128+) by tptacek on Tuesday August 22, 2017 @09:57AM (#15072414)
This shouldn't have been downvoted because it is exactly correct.

Cryptographic generators don't work like PCG and xoroshiro and Mersenne Twister. They're generally built by taking a cryptographically secure cipher or hash core, "keying" it with secret entropy, and running it in a streaming configuration (like CTR mode).

A properly designed CSPRNG can only be "cracked" in a few specific scenarios:

1. The primitive it's built on (or the streaming construction it's configured in) is broken, in which case the news for cryptography as a field is significantly bigger than the fact that an RNG has a flaw.

2. An attacker has exploited a systems flaw to directly disclose the contents of the memory the CSPRNG is operating out of, in which case you have bigger problems than your CSPRNG.

3. The secrets that key the generator have become predictable. This is in practice the only way CSPRNGs get broken (unintentionally), and, in practice, always means the CSPRNG wasn't initialized properly (the "cold start entropy problem").

You should use the getrandom() system call, or read from /dev/urandom, to the exclusion of all other mechanisms.

Re:Cracking random number generators (xoroshiro128+) by IanCal on Tuesday August 22, 2017 @11:02AM (#15073072)
I'd have called that a PRNG, because to me there were only two main categories. Pseudo-random, where it's designed to be unpredictable, and actually random where it is based on an external hardware source of true random information.

A CSPRNG is surely a type of PRNG. Is that not right?

Their comment doesn't really seem correct to me. The title is "Cracking random number generators (xoroshiro128+)" which seems pretty accurate to me. The article definitely doesn't seem to say it's breaking anything other than a very specific, flawed random number generator.

Re:Cracking random number generators (xoroshiro128+) by tptacek on Tuesday August 22, 2017 @11:47AM (#15073530)
I'd have added "Cryptographically secure" and not capitalized "pseudo", but that's small-stakes stuff. The point he's making is the most important safety point on this topic.
Re:Cracking random number generators (xoroshiro128+) by pbnjay on Tuesday August 22, 2017 @02:16PM (#15075031)
Duly noted!

I'm not in this field, but I know enough to know what not to do (most of the time).

Re:Cracking random number generators (xoroshiro128+) by alphaalpha101 on Tuesday August 22, 2017 @07:32PM (#15077219)
>I'd have called that a PRNG, because to me there were only two main categories. Pseudo-random, where it's designed to be unpredictable, and actually random where it is based on an external hardware source of true random information.

PRNGs produce numbers that seem hard to predict. CSPRNGs product numbers that actually are hard to predict, assuming P != NP (kind of).

Re:Cracking random number generators (xoroshiro128+) by raverbashing on Tuesday August 22, 2017 @03:22PM (#15075551)
> A CSPRNG is surely a type of PRNG. Is that not right?

Yes. In the same way the POTUS limousine is a car

Re:Cracking random number generators (xoroshiro128+) by baby on Tuesday August 22, 2017 @10:01AM (#15072456)
FWIW you rarely hear the term CSPRNG in crypto I find. I always call these PRNGs but I can see how having a naming distinction could help prevent misuse in the applied world.

Edit: thinking a bit more about it. I guess it wouldn't make sense to call anything "crypto" in crypto. It's like calling fries "french fries" in France. There they're just fries. I know this is a bad example because french fries are probably not from France :o)

Re:Cracking random number generators (xoroshiro128+) by gwbas1c on Tuesday August 22, 2017 @11:58AM (#15073649)
But, it's important to make the decision because a "crypto" psudorandom number generator may be significantly slower than an insecure generator.

This is critical for performance-sensitive operations. For example, certain audio and video codecs need to simulate noise. In these cases, high performance is much more important than cryptographic security.

Re:Cracking random number generators (xoroshiro128+) by tptacek on Tuesday August 22, 2017 @12:04PM (#15073722)
In the overwhelming majority of cases, cryptographic random bit generation performs perfectly adequately. Insecure random number generation is wildly overused in our industry. CSPRNGs should be the default application RNGs on most platforms, and should always be the default choice for developers.

Which makes stuff like PCG even weirder! Because in most cases, what you want is a somewhat slower generator that has better failsafe behavior.

Re:Cracking random number generators (xoroshiro128+) by aidenn0 on Tuesday August 22, 2017 @01:07PM (#15074347)
Many microbenchmarks intended to measure other things become benchmarks of your RNG if you use anything slower than an LCG. This biases a lot of places towards using the poorest RNG they can get away with.

This is made worse by many purchasing decisions made based upon microbenchmarks with the requirements of "default settings" so defaulting to insecure is a sound business decision in more cases than you might think.

Re:Cracking random number generators (xoroshiro128+) by sanxiyn on Tuesday August 22, 2017 @03:37PM (#15075670)
This is indeed a tragedy, because it could have been easily avoided by including LCG in microbenchmarks. LCG is less than ten lines, so even for very short microbenchmarks including RNG is very feasible. Alas, I guess such reasonable people don't write microbenchmarks in the first place.
Re:Cracking random number generators (xoroshiro128+) by tptacek on Tuesday August 22, 2017 @04:05PM (#15075902)
I understand the "broken benchmarks" problem and I acknowledge that there are some cases that are so demanding and have such low security sensitivity that it makes sense to have an LCG in the standard library.

But I stand by my argument that the default platform RNG should be a CSPRNG, and that developers should reach for a CSPRNG by default.

Which makes all the attention we've been giving to stuff like xoroshiro128+ and PCG pretty confusing to me. It feels like people arguing very earnestly about non-problems, while ignoring a huge problem in our standard libraries.

Re:Cracking random number generators (xoroshiro128+) by alphaalpha101 on Tuesday August 22, 2017 @07:34PM (#15077233)
>stuff like PCG

PCG is cryptographically secure, though. Or at least, it is as cryptographically secure as any other PRNG in the sense that nobody actually knows how to predict it, many have tried, nobody has succeeded, but nobody has proved it impossible.

Re:Cracking random number generators (xoroshiro128+) by tptacek on Tuesday August 22, 2017 @10:02PM (#15077963)
So, it's "cryptographically secure" in the "sci.crypt proposal" sense.