diff options
author | Andrew Bartlett <abartlet@samba.org> | 2010-01-12 18:16:45 +1100 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2010-03-27 11:51:27 +1100 |
commit | 89eaef025376339ef25d07cdc4748920fceaa968 (patch) | |
tree | f514f4632c9d54a372a7f1f0ca845a0c3a488fbf /source4/heimdal/lib/hcrypto/rand-fortuna.c | |
parent | fac8ca52ade6e490eea3cf3d0fc98287da321c13 (diff) | |
download | samba-89eaef025376339ef25d07cdc4748920fceaa968.tar.gz samba-89eaef025376339ef25d07cdc4748920fceaa968.tar.bz2 samba-89eaef025376339ef25d07cdc4748920fceaa968.zip |
s4:heimdal: import lorikeet-heimdal-201001120029 (commit a5e675fed7c5db8a7370b77ed0bfa724196aa84d)
Diffstat (limited to 'source4/heimdal/lib/hcrypto/rand-fortuna.c')
-rw-r--r-- | source4/heimdal/lib/hcrypto/rand-fortuna.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/source4/heimdal/lib/hcrypto/rand-fortuna.c b/source4/heimdal/lib/hcrypto/rand-fortuna.c index c39c713901..c81eb9e2d7 100644 --- a/source4/heimdal/lib/hcrypto/rand-fortuna.c +++ b/source4/heimdal/lib/hcrypto/rand-fortuna.c @@ -35,6 +35,9 @@ #include <stdlib.h> #include <rand.h> +#ifdef KRB5 +#include <krb5-types.h> +#endif #include <roken.h> #include "randi.h" @@ -451,6 +454,7 @@ fortuna_reseed(void) if (!init_done) abort(); +#ifndef NO_RAND_UNIX_METHOD { unsigned char buf[INIT_BYTES]; if ((*hc_rand_unix_method.bytes)(buf, sizeof(buf)) == 1) { @@ -459,6 +463,7 @@ fortuna_reseed(void) memset(buf, 0, sizeof(buf)); } } +#endif #ifdef HAVE_ARC4RANDOM { uint32_t buf[INIT_BYTES / sizeof(uint32_t)]; @@ -470,6 +475,7 @@ fortuna_reseed(void) entropy_p = 1; } #endif +#ifndef NO_RAND_EGD_METHOD /* * Only to get egd entropy if /dev/random or arc4rand failed since * it can be horribly slow to generate new bits. @@ -482,6 +488,7 @@ fortuna_reseed(void) memset(buf, 0, sizeof(buf)); } } +#endif /* * Fall back to gattering data from timer and secret files, this * is really the last resort. @@ -521,10 +528,12 @@ fortuna_reseed(void) gettimeofday(&tv, NULL); add_entropy(&main_state, (void *)&tv, sizeof(tv)); } +#ifdef HAVE_GETUID { uid_t u = getuid(); add_entropy(&main_state, (void *)&u, sizeof(u)); } +#endif return entropy_p; } |