mirror of
https://github.com/isc-projects/bind9.git
synced 2026-06-11 04:09:59 -04:00
1499. [bug] isc_random need to be seeded better if arc4random()
is not used.
This commit is contained in:
parent
a3f906859d
commit
1b5a728293
2 changed files with 13 additions and 2 deletions
3
CHANGES
3
CHANGES
|
|
@ -1,3 +1,6 @@
|
|||
1499. [bug] isc_random need to be seeded better if arc4random()
|
||||
is not used.
|
||||
|
||||
1498. [port] bsdos: 5.x support.
|
||||
|
||||
1497. [placeholder]
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: random.c,v 1.17 2002/12/05 04:36:26 marka Exp $ */
|
||||
/* $Id: random.c,v 1.18 2003/08/05 00:08:30 marka Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
|
|
@ -34,7 +34,15 @@ static void
|
|||
initialize_rand(void)
|
||||
{
|
||||
#ifndef HAVE_ARC4RANDOM
|
||||
srand(time(NULL));
|
||||
unsigned int pid = getpid();
|
||||
|
||||
/*
|
||||
* The low bits of pid generally change faster.
|
||||
* Xor them with the high bits of time which change slowly.
|
||||
*/
|
||||
pid = ((pid << 16) & 0xffff0000) | ((pid >> 16) & 0xffff);
|
||||
|
||||
srand(time(NULL) ^ pid);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue