From 7b22d65034ac280e0b4eaa857c71b17ee3ad7d99 Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Sun, 18 Jun 2000 14:07:04 +1000 Subject: - (djm) Add summary of configure options to end of ./configure run - (djm) Not all systems define RUSAGE_SELF & RUSAGE_CHILDREN. Report from Michael Stone - (djm) rusage is a privileged operation on some Unices (incl. Solaris 2.5.1). Report from Paul D. Smith - (djm) Avoid PAM failures when running without a TTY. Report from Martin Petrak - (djm) Include sys/types.h when including netinet/in.h in configure tests. Patch from Jun-ichiro itojun Hagino --- entropy.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'entropy.c') diff --git a/entropy.c b/entropy.c index cbb36fd29..09dcae3ba 100644 --- a/entropy.c +++ b/entropy.c @@ -35,7 +35,7 @@ #include #include -RCSID("$Id: entropy.c,v 1.13 2000/06/07 12:20:23 djm Exp $"); +RCSID("$Id: entropy.c,v 1.14 2000/06/18 04:07:04 djm Exp $"); #ifndef offsetof # define offsetof(type, member) ((size_t) &((type *)0)->member) @@ -55,6 +55,13 @@ RCSID("$Id: entropy.c,v 1.13 2000/06/07 12:20:23 djm Exp $"); #define WHITESPACE " \t\n" +#ifndef RUSAGE_SELF +# define RUSAGE_SELF 0 +#endif +#ifndef RUSAGE_CHILDREN +# define RUSAGE_CHILDREN 0 +#endif + #if defined(EGD_SOCKET) || defined(RANDOM_POOL) #ifdef EGD_SOCKET @@ -187,11 +194,11 @@ stir_from_system(void) total_entropy_estimate = 0; i = getpid(); - RAND_add(&i, sizeof(i), 0.1); + RAND_add(&i, sizeof(i), 0.5); total_entropy_estimate += 0.1; i = getppid(); - RAND_add(&i, sizeof(i), 0.1); + RAND_add(&i, sizeof(i), 0.5); total_entropy_estimate += 0.1; i = getuid(); @@ -200,7 +207,7 @@ stir_from_system(void) RAND_add(&i, sizeof(i), 0.0); total_entropy_estimate += stir_gettimeofday(1.0); - total_entropy_estimate += stir_clock(0.2); + total_entropy_estimate += stir_clock(0.5); total_entropy_estimate += stir_rusage(RUSAGE_SELF, 2.0); return(total_entropy_estimate); @@ -301,9 +308,9 @@ stir_rusage(int who, double entropy_estimate) struct rusage ru; if (getrusage(who, &ru) == -1) - fatal("Couldn't getrusage: %s", strerror(errno)); + return(0); - RAND_add(&ru, sizeof(ru), 0.1); + RAND_add(&ru, sizeof(ru), entropy_estimate); return(entropy_estimate); #else /* _HAVE_GETRUSAGE */ -- cgit v1.2.3