diff options
author | Daniel Stone <daniel@fooishbar.org> | 2008-07-17 21:39:46 +0300 |
---|---|---|
committer | Daniel Stone <daniel@fooishbar.org> | 2008-07-17 21:39:46 +0300 |
commit | 711720650cc192022f0d91f5cf94292d48dbc891 (patch) | |
tree | c8326a62566276f2e004ce6126754df84a52bd52 /os | |
parent | 446fe9eecddd1337f9d5164dd7c301e1ba3dfe32 (diff) |
Everyone has urandom
If you don't have urandom, please just add a fallback to /dev/random,
rather than building our own random generator.
Diffstat (limited to 'os')
-rw-r--r-- | os/auth.c | 43 |
1 files changed, 0 insertions, 43 deletions
@@ -314,8 +314,6 @@ GenerateAuthorization( return -1; } -#ifdef HAVE_URANDOM - void GenerateRandomData (int len, char *buf) { @@ -326,45 +324,4 @@ GenerateRandomData (int len, char *buf) close(fd); } -#else /* !HAVE_URANDOM */ - -/* A random number generator that is more unpredictable - than that shipped with some systems. - This code is taken from the C standard. */ - -static unsigned long int next = 1; - -static int -xdm_rand(void) -{ - next = next * 1103515245 + 12345; - return (unsigned int)(next/65536) % 32768; -} - -static void -xdm_srand(unsigned int seed) -{ - next = seed; -} - -void -GenerateRandomData (int len, char *buf) -{ - static int seed; - int value; - int i; - - seed += GetTimeInMillis(); - xdm_srand (seed); - for (i = 0; i < len; i++) - { - value = xdm_rand (); - buf[i] ^= (value & 0xff00) >> 8; - } - - /* XXX add getrusage, popen("ps -ale") */ -} - -#endif /* HAVE_URANDOM */ - #endif /* XCSECURITY */ |