Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upAre 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 |

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

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/urandomwhen on Mac OS?[1] https://en.wikipedia.org/wiki/Yarrow_algorithm#Cons