-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Are we using /dev/urandom on Mac OS and is that a bad idea? #594
Comments
Hmm, I just found this blog article which suggests that using a user space CSPRNG is a bad idea: https://sockpuppet.org/blog/2014/02/25/safely-generate-random-numbers/ It looks like the correct security fix is for me to stop using Mac OS. :-( |
The mailing list post you mention was sent 15 years ago, and refers to a section of the man page that doesn't exist any more. The current code is here: https://github.com/opensource-apple/xnu/tree/53c5e2e62fc4182595609153d4b99648da577c39/osfmk/prng SHA-1 collisions are also irrelevant to its use within a PRNG. libsodium does ship with a userland PRNG even though it is not thread-safe and is never used by default. You can enable it with |
That man page is still in my copy of OX X El Capitan and the code you linked to is the same problematic Yarrow code but I appreciate your reassurance, thank you. |
@NodeGuy: The Yarrow code is still there, but I don't see it used in |
At a cursory glance this comment in /*
* Wrapper for requesting a CCDRBG operation.
* This macro makes the DRBG call with pre-emption disabled to ensure that
* any attempt to block will cause a panic. And the operation is timed and
* cannot exceed 10msec (for development kernels).
* But skip this while we retain Yarrow.
*/
#define YARROW 1 |
The manual states:
I assume that applies to Mac OS. On Mac OS,
/dev/urandom
(which is the same as/dev/random
) has several problems:From the Yarrow paper:
From Mac OS's man page for /dev/urandom:
Should Sodium supply its own CSPRNG (such as Fortuna, the improvement over Yarrow that FreeBSD switched to but Mac OS did not) instead of reading from
/dev/urandom
when on Mac OS?[1] https://en.wikipedia.org/wiki/Yarrow_algorithm#Cons
The text was updated successfully, but these errors were encountered: