Replace random() with arc4random_buf()
This commit is contained in:
parent
1449a85f9c
commit
7b75257f75
@ -59,6 +59,7 @@ getbits (long data, unsigned char *dst)
|
||||
void
|
||||
XdmcpGenerateKey (XdmAuthKeyPtr key)
|
||||
{
|
||||
#ifndef HAVE_ARC4RANDOM_BUF
|
||||
long lowbits, highbits;
|
||||
|
||||
srandom ((int)getpid() ^ time((Time_t *)0));
|
||||
@ -66,6 +67,9 @@ XdmcpGenerateKey (XdmAuthKeyPtr key)
|
||||
highbits = random ();
|
||||
getbits (lowbits, key->data);
|
||||
getbits (highbits, key->data + 4);
|
||||
#else
|
||||
arc4random_buf(key->data, 8);
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -53,7 +53,7 @@ AC_PROG_LN_S
|
||||
AC_SEARCH_LIBS([recvfrom],[socket])
|
||||
|
||||
# Checks for library functions.
|
||||
AC_CHECK_FUNCS([srand48 lrand48])
|
||||
AC_CHECK_FUNCS([srand48 lrand48 arc4random_buf])
|
||||
|
||||
# Obtain compiler/linker options for depedencies
|
||||
PKG_CHECK_MODULES(XDMCP, xproto)
|
||||
|
Loading…
Reference in New Issue
Block a user