From 06e9857f891a84dec25f930d7670cae5a593adb5 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Wed, 24 Nov 2004 19:53:31 +0000 Subject: [PATCH] random_init() should be called at most once during the running of PuTTY, even if it's managing multiple sessions. [originally from svn r4900] --- sshrand.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sshrand.c b/sshrand.c index 524bbd43..a7b3dc4e 100644 --- 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)