X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/32874aeac8dacbca26663777b39a79efc5d8dc4b..6f1e7b78af0f9c4c502609392f62771cf2528d8f:/sshrand.c diff --git a/sshrand.c b/sshrand.c index 3014da4f..95c7b492 100644 --- a/sshrand.c +++ b/sshrand.c @@ -39,7 +39,7 @@ struct RandPool { }; static struct RandPool pool; -static int random_active = 0; +int random_active = 0; void random_stir(void) { @@ -201,7 +201,10 @@ int random_byte(void) void random_get_savedata(void **data, int *len) { + void *buf = smalloc(POOLSIZE / 2); random_stir(); - *data = pool.pool + pool.poolpos; + memcpy(buf, pool.pool + pool.poolpos, POOLSIZE / 2); *len = POOLSIZE / 2; + *data = buf; + random_stir(); }