diff options
author | Damien Miller <djm@mindrot.org> | 2000-06-18 14:07:04 +1000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2000-06-18 14:07:04 +1000 |
commit | 7b22d65034ac280e0b4eaa857c71b17ee3ad7d99 (patch) | |
tree | b4fd3f622d95a30394908bc7e9aa30a3658e7b4f /entropy.c | |
parent | 1a13225d877ffdd035659bf5577d5aff388bb317 (diff) |
- (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>
Diffstat (limited to 'entropy.c')
-rw-r--r-- | entropy.c | 19 |
1 files changed, 13 insertions, 6 deletions
@@ -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 @@ 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 */ |