[v9_10] check for arc4random_addrandom()

3840.	[port]		Check for arc4random_addrandom() before using it;
			it's been removed from OpenBSD 5.5. [RT #35907]

(cherry picked from commit 1ea6e09c37)
This commit is contained in:
Evan Hunt
2014-05-07 08:58:47 -07:00
parent 812cf443bb
commit b674db54ca
6 changed files with 29 additions and 3 deletions

View File

@@ -67,8 +67,16 @@ isc_random_seed(isc_uint32_t seed)
#ifndef HAVE_ARC4RANDOM
srand(seed);
#else
#elif defined(HAVE_ARC4RANDOM_ADDRANDOM)
arc4random_addrandom((u_char *) &seed, sizeof(isc_uint32_t));
#else
/*
* If arcrandom() is available and no corresponding seeding
* function arc4random_addrandom() is available, no seeding is
* done on such platforms (e.g., OpenBSD 5.5). This is because
* the OS itself is supposed to seed the RNG and it is assumed
* that no explicit seeding is required.
*/
#endif
}