diff options
author | Simon Kelley <simon@thekelleys.org.uk> | 2013-11-22 11:17:37 +0000 |
---|---|---|
committer | Simon Kelley <simon@thekelleys.org.uk> | 2013-11-22 11:17:37 +0000 |
commit | 241fa9c6c81fe42148252d8f02f0a2db28f745b5 (patch) | |
tree | f3602e840b5df81c85be751530e64c8e0737ae2e | |
parent | e142a832962ab7b791e4e7ff4db32787d3744b02 (diff) | |
download | dnsmasq-241fa9c6c81fe42148252d8f02f0a2db28f745b5.tar.gz |
Remove arc4random, we have a good RNG and it's a portability problem.v2.68rc2
-rw-r--r-- | src/config.h | 13 | ||||
-rw-r--r-- | src/util.c | 24 |
2 files changed, 0 insertions, 37 deletions
diff --git a/src/config.h b/src/config.h index b351a37..60de687 100644 --- a/src/config.h +++ b/src/config.h @@ -189,10 +189,6 @@ HAVE_SOLARIS_NETWORK HAVE_GETOPT_LONG defined when GNU-style getopt_long available. -HAVE_ARC4RANDOM - defined if arc4random() available to get better security from DNS spoofs - by using really random ids (OpenBSD) - HAVE_SOCKADDR_SA_LEN defined if struct sockaddr has sa_len field (*BSD) */ @@ -201,7 +197,6 @@ HAVE_SOCKADDR_SA_LEN #if defined(__uClinux__) #define HAVE_LINUX_NETWORK #define HAVE_GETOPT_LONG -#undef HAVE_ARC4RANDOM #undef HAVE_SOCKADDR_SA_LEN /* Never use fork() on uClinux. Note that this is subtly different from the --keep-in-foreground option, since it also suppresses forking new @@ -215,7 +210,6 @@ HAVE_SOCKADDR_SA_LEN ((__UCLIBC_MAJOR__==0) && (__UCLIBC_MINOR__==9) && (__UCLIBC_SUBLEVEL__<21)) # define HAVE_GETOPT_LONG #endif -#undef HAVE_ARC4RANDOM #undef HAVE_SOCKADDR_SA_LEN #if !defined(__ARCH_HAS_MMU__) && !defined(__UCLIBC_HAS_MMU__) # define NO_FORK @@ -230,7 +224,6 @@ HAVE_SOCKADDR_SA_LEN #elif defined(__linux__) #define HAVE_LINUX_NETWORK #define HAVE_GETOPT_LONG -#undef HAVE_ARC4RANDOM #undef HAVE_SOCKADDR_SA_LEN #elif defined(__FreeBSD__) || \ @@ -242,15 +235,11 @@ HAVE_SOCKADDR_SA_LEN #if defined(optional_argument) && defined(required_argument) # define HAVE_GETOPT_LONG #endif -#if !defined(__FreeBSD_kernel__) -# define HAVE_ARC4RANDOM -#endif #define HAVE_SOCKADDR_SA_LEN #elif defined(__APPLE__) #define HAVE_BSD_NETWORK #define HAVE_GETOPT_LONG -#define HAVE_ARC4RANDOM #define HAVE_SOCKADDR_SA_LEN /* Define before sys/socket.h is included so we get socklen_t */ #define _BSD_SOCKLEN_T_ @@ -261,13 +250,11 @@ HAVE_SOCKADDR_SA_LEN #elif defined(__NetBSD__) #define HAVE_BSD_NETWORK #define HAVE_GETOPT_LONG -#undef HAVE_ARC4RANDOM #define HAVE_SOCKADDR_SA_LEN #elif defined(__sun) || defined(__sun__) #define HAVE_SOLARIS_NETWORK #define HAVE_GETOPT_LONG -#undef HAVE_ARC4RANDOM #undef HAVE_SOCKADDR_SA_LEN #define ETHER_ADDR_LEN 6 @@ -28,28 +28,6 @@ #include <idna.h> #endif -#ifdef HAVE_ARC4RANDOM -void rand_init(void) -{ - return; -} - -unsigned short rand16(void) -{ - return (unsigned short) (arc4random() >> 15); -} - -u64 rand64(void) -{ - u64 ret; - - arc4random_buf(&ret, sizeof(ret)); - - return ret; -} - -#else - /* SURF random number generator */ static u32 seed[32]; @@ -119,8 +97,6 @@ u64 rand64(void) return (u64)out[outleft+1] + (((u64)out[outleft]) << 32); } -#endif - static int check_name(char *in) { /* remove trailing . |