Replace random() with arc4random_buf()

This commit is contained in:
matthieu 2013-07-20 13:27:38 +00:00
parent 1449a85f9c
commit 7b75257f75
2 changed files with 5 additions and 1 deletions

View File

@ -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

View File

@ -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)