News for hackers. Stuff that matters.
Re:Random Number Generator Recommendations for Applications by tptacek on Tuesday May 30, 2023 @09:53PM (#36133603)
I don't think this "PRNG" vs. "RNG" distinction is doing us much good. There's no meaningful difference in the mechanics of how urandom and random serve unpredictable bits. There is also no such thing as "running out of entropy".
Re:Random Number Generator Recommendations for Applications by cbsmith on Wednesday May 31, 2023 @12:01PM (#36139898)
What do you interpret the output of `cat /proc/sys/kernel/random/entropy_avail` to mean?
Re:Random Number Generator Recommendations for Applications by tptacek on Wednesday May 31, 2023 @12:18PM (#36140106)
Nothing.
Re:Random Number Generator Recommendations for Applications by cryptonector on Wednesday May 31, 2023 @12:43PM (#36140415)
> There is also no such thing as "running out of entropy".

Hear hear. There is, indeed, no such thing as running out of entropy in a modern PRNG's state.

> I don't think this "PRNG" vs. "RNG" distinction is doing us much good.

But it's still nice to seed and periodically reseed a PRNG w/ entropy from an RNG. So there is a distinction between PRNG and RNG to be made, and we should make it. What we really want is to always have an RNG-seeded PRNG, and to always use the PRNG not the RNG.

Re:Random Number Generator Recommendations for Applications by cbsmith on Wednesday May 31, 2023 @01:12PM (#36140805)
> Hear hear. There is, indeed, no such thing as running out of entropy in a modern PRNG's state.

Yes, of course. PRNG's are about producing random data from a seed. But /dev/random & /dev/urandom isn't just a PRNG.

> What we really want is to always have an RNG-seeded PRNG, and to always use the PRNG not the RNG.

Which is effectively what is going on with /dev/random & /dev/urandom

Re:Random Number Generator Recommendations for Applications by tptacek on Wednesday May 31, 2023 @02:08PM (#36141593)
At the point where you're simply equating /dev/random and /dev/urandom, you're no longer really disagreeing with anybody here. The only difference between the two is that /dev/random keeps a metric on how many bits its vended, and blocks waiting for rekeying when that metric gets too high. That's more or less a nonsensical thing to do.
Re:Random Number Generator Recommendations for Applications by cbsmith on Wednesday May 31, 2023 @06:01PM (#36144973)
I'm definitely not saying what /dev/random does makes sense. ;-)
Re:Random Number Generator Recommendations for Applications by cbsmith on Wednesday May 31, 2023 @01:46PM (#36141250)
I think I understand what you were getting at by "there is no such thing as running out of entropy". Would you say there is such thing as "not having adequate entropy"?
Re:Random Number Generator Recommendations for Applications by tptacek on Wednesday May 31, 2023 @02:06PM (#36141573)
Not really. A CSPRNG is either initialized properly or it isn't. Once it is, entropy has ceased to be a concern. The original LRNG design misapprehends the purpose of continuous "entropy collection", which is about post-compromise security (it's essentially a rekeying operation), and not about any kind of cryptographic exhaustion.
Re:Random Number Generator Recommendations for Applications by cbsmith on Wednesday May 31, 2023 @06:01PM (#36144958)
But /dev/urandom will provide you with random numbers even if initialization has not completed, whereas /dev/random will not.
Re:Random Number Generator Recommendations for Applications by tptacek on Thursday June 01, 2023 @02:09PM (#36155026)
It's best to think of this as an OS/distro detail; if you can reasonably expect /dev/urandom to give you insecure bits, your distro has a vulnerability.

That said: today you'd just use some variant of getrandom.

Re:Random Number Generator Recommendations for Applications by cbsmith on Friday June 02, 2023 @03:34AM (#36162207)
> It's best to think of this as an OS/distro detail; if you can reasonably expect /dev/urandom to give you insecure bits, your distro has a vulnerability.

Isn't that more a function of hardware than software? The hardware random number generators on modern CPUs pretty much eliminate the need to worry about entropy...

Re:Random Number Generator Recommendations for Applications by tptacek on Friday June 02, 2023 @10:42AM (#36165753)
No, this has nothing at all to do with hardware; the state of play is the same on machines that don't have instructions like RDRAND.
Re:Random Number Generator Recommendations for Applications by cbsmith on Friday June 02, 2023 @02:20PM (#36168846)
I think I still don't understand. Can you explain why it is not a hypothetical problem on a deterministic virtual machine?