@@ -36,6 +36,10 @@
#include <time.h>
#define Time_t time_t
+#ifdef HAVE_LIBBSD
+#include <bsd/stdlib.h> /* for arc4random_buf() */
+#endif
+
static int was_called_state;
/*
@@ -50,14 +54,19 @@
)
{
char *auth;
+#ifndef HAVE_ARC4RANDOM_BUF
long ldata[2];
int seed;
int value;
int i;
+#endif
if ((auth = (char *) malloc (len + 1)) == NULL)
return (NULL);
+#ifdef HAVE_ARC4RANDOM_BUF
+ arc4random_buf(auth, len);
+#else
#ifdef ITIMER_REAL
{
struct timeval now;
@@ -81,8 +90,8 @@
value = rand ();
auth[i] = value & 0xff;
}
+#endif
auth[len] = '\0';
-
return (auth);
}
@@ -37,6 +37,10 @@
static int binaryEqual ();
+#ifdef HAVE_LIBBSD
+#include <bsd/stdlib.h> /* for arc4random_buf() */
+#endif
+
static int was_called_state;
/*
@@ -52,14 +56,19 @@
{
char *auth;
+#ifndef HAVE_ARC4RANDOM_BUF
long ldata[2];
int seed;
int value;
int i;
+#endif
if ((auth = (char *) malloc (len + 1)) == NULL)
return (NULL);
+#ifdef HAVE_ARC4RANDOM_BUF
+ arc4random_buf(auth, len);
+#else
#ifdef ITIMER_REAL
{
struct timeval now;
@@ -83,8 +92,8 @@
value = rand ();
auth[i] = value & 0xff;
}
+#endif
auth[len] = '\0';
-
return (auth);
}