diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 4 | ||||
-rw-r--r-- | src/utils.c | 7 |
2 files changed, 11 insertions, 0 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index da23fd8..1d161a2 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -18,9 +18,13 @@ if HAVE_ICMPFILTER ptunnel_ng_CFLAGS += -DHAVE_ICMPFILTER=1 endif +if HAVE_ARC4RANDOM +ptunnel_ng_CFLAGS += -DHAVE_ARC4RANDOM=1 +else if HAVE_RANDOM ptunnel_ng_CFLAGS += -DHAVE_RANDOM=1 endif +endif ptunnel_ng_SOURCES = \ md5.c \ diff --git a/src/utils.c b/src/utils.c index 6233753..10e8182 100644 --- a/src/utils.c +++ b/src/utils.c @@ -49,6 +49,9 @@ #include <string.h> #include <time.h> #include <assert.h> +#ifdef HAVE_ARC4RANDOM +#include <bsd/stdlib.h> +#endif #ifndef WIN32 #include <syslog.h> @@ -148,6 +151,9 @@ void print_hexstr(unsigned char *buf, size_t siz) { #endif int pt_random(void) { +#ifdef HAVE_ARC4RANDOM + return arc4random(); +#else #ifdef HAVE_RANDOM #ifndef TIME_UTC #define TIME_UTC 1 @@ -161,4 +167,5 @@ int pt_random(void) { srand(time(0)); return rand(); #endif +#endif } |