-
Notifications
You must be signed in to change notification settings - Fork 38.7k
Description
Please add a check for arc4random support on all OS:es.
When found, GetOSRand() of src/random.cpp should use it for getting entropy from the OS.
Line 109 in 27765b6
| int f = open("/dev/urandom", O_RDONLY); |
This will have the benefit that BitcoinD will work also in Unix environments where there is no /dev/urandom file, such as certain chroot:ed environments, in particular where the filesystem not supports the creation of device files.
The patch in src/random.cpp will amount to adding this before line 108:
#elif arc4random_supported
arc4random_buf(ent32,32);
I.e. if arc4random() is supported, then simply use this arc4random_buf() call as only code in GetOSRand(). arc4random_buf() has no failure states.
Then, the configure script must check if arc4random is supported, and if so set the arc4random_supported define.