- (djm) Add summary of configure options to end of ./configure run
- (djm) Not all systems define RUSAGE_SELF & RUSAGE_CHILDREN. Report from
Michael Stone <mstone@cs.loyola.edu>
- (djm) rusage is a privileged operation on some Unices (incl.
Solaris 2.5.1). Report from Paul D. Smith <pausmith@nortelnetworks.com>
- (djm) Avoid PAM failures when running without a TTY. Report from
Martin Petrak <petrak@spsknm.schools.sk>
- (djm) Include sys/types.h when including netinet/in.h in configure tests.
Patch from Jun-ichiro itojun Hagino <itojun@iijlab.net>
diff --git a/entropy.c b/entropy.c
index cbb36fd..09dcae3 100644
--- a/entropy.c
+++ b/entropy.c
@@ -35,7 +35,7 @@
#include <openssl/rand.h>
#include <openssl/sha.h>
-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 @@
#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 @@
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 @@
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 @@
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 */