X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/6e522441172d5b1c2a2fa4d0f6bbe905ce6b647a..0d694692c59504838ec2043ddfe670b3a9247faf:/sshrand.c diff --git a/sshrand.c b/sshrand.c index 84c3e91e..21a1b833 100644 --- a/sshrand.c +++ b/sshrand.c @@ -39,6 +39,7 @@ struct RandPool { }; static struct RandPool pool; +static int random_active = 0; void random_stir(void) { word32 block[HASHINPUT/sizeof(word32)]; @@ -114,6 +115,9 @@ void random_add_noise(void *noise, int length) { unsigned char *p = noise; int i; + if (!random_active) + return; + /* * This function processes HASHINPUT bytes into only HASHSIZE * bytes, so _if_ we were getting incredibly high entropy @@ -176,7 +180,10 @@ static void random_add_heavynoise_bitbybit(void *noise, int length) { void random_init(void) { memset(&pool, 0, sizeof(pool)); /* just to start with */ + random_active = 1; + noise_get_heavy(random_add_heavynoise_bitbybit); + random_stir(); } int random_byte(void) {