summaryrefslogtreecommitdiff
path: root/entropy.c
diff options
context:
space:
mode:
Diffstat (limited to 'entropy.c')
-rw-r--r--entropy.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/entropy.c b/entropy.c
index 79ef93ac6..cc7e81527 100644
--- a/entropy.c
+++ b/entropy.c
@@ -35,7 +35,7 @@
35#include <openssl/rand.h> 35#include <openssl/rand.h>
36#include <openssl/sha.h> 36#include <openssl/sha.h>
37 37
38RCSID("$Id: entropy.c,v 1.10 2000/05/17 11:34:08 damien Exp $"); 38RCSID("$Id: entropy.c,v 1.11 2000/05/17 12:08:30 damien Exp $");
39 39
40#ifdef EGD_SOCKET 40#ifdef EGD_SOCKET
41#ifndef offsetof 41#ifndef offsetof
@@ -735,18 +735,26 @@ prng_seed_cleanup(void *junk)
735void 735void
736seed_rng(void) 736seed_rng(void)
737{ 737{
738 void *old_sigchld_handler;
739
738 if (!prng_commands_loaded) { 740 if (!prng_commands_loaded) {
739 if (!prng_read_commands(SSH_PRNG_COMMAND_FILE)) 741 if (!prng_read_commands(SSH_PRNG_COMMAND_FILE))
740 fatal("PRNG initialisation failed -- exiting."); 742 fatal("PRNG initialisation failed -- exiting.");
741 prng_commands_loaded = 1; 743 prng_commands_loaded = 1;
742 } 744 }
743 745
746 /* Make sure some other sigchld handler doesn't reap our entropy */
747 /* commands */
748 old_sigchld_handler = signal(SIGCHLD, SIG_DFL);
749
744 debug("Seeding random number generator."); 750 debug("Seeding random number generator.");
745 debug("OpenSSL random status is now %i\n", RAND_status()); 751 debug("OpenSSL random status is now %i\n", RAND_status());
746 debug("%i bytes from system calls", (int)stir_from_system()); 752 debug("%i bytes from system calls", (int)stir_from_system());
747 debug("%i bytes from programs", (int)stir_from_programs()); 753 debug("%i bytes from programs", (int)stir_from_programs());
748 debug("OpenSSL random status is now %i\n", RAND_status()); 754 debug("OpenSSL random status is now %i\n", RAND_status());
749 755
756 signal(SIGCHLD, old_sigchld_handler);
757
750 if (!RAND_status()) 758 if (!RAND_status())
751 fatal("Couldn't initialise builtin random number generator -- exiting."); 759 fatal("Couldn't initialise builtin random number generator -- exiting.");
752 760