random_init() should be called at most once during the running of
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Wed, 24 Nov 2004 19:53:31 +0000 (19:53 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Wed, 24 Nov 2004 19:53:31 +0000 (19:53 +0000)
PuTTY, even if it's managing multiple sessions.

git-svn-id: svn://svn.tartarus.org/sgt/putty@4900 cda61777-01e9-0310-a592-d414129be87e

sshrand.c

index 524bbd4..a7b3dc4 100644 (file)
--- a/sshrand.c
+++ b/sshrand.c
@@ -184,12 +184,14 @@ static void random_add_heavynoise_bitbybit(void *noise, int length)
 
 void random_init(void)
 {
-    memset(&pool, 0, sizeof(pool));    /* just to start with */
+    if (!random_active) {
+       memset(&pool, 0, sizeof(pool));    /* just to start with */
 
-    random_active = 1;
+       random_active = 1;
 
-    noise_get_heavy(random_add_heavynoise_bitbybit);
-    random_stir();
+       noise_get_heavy(random_add_heavynoise_bitbybit);
+       random_stir();
+    }
 }
 
 int random_byte(void)