mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-05-09 13:42:09 -05:00
Improved robustness in random seed file handling.
[originally from svn r2201]
This commit is contained in:
parent
997c082c3b
commit
52bb59be17
3
noise.c
3
noise.c
@ -40,6 +40,8 @@ void noise_get_heavy(void (*func) (void *, int))
|
||||
}
|
||||
|
||||
read_random_seed(func);
|
||||
/* Update the seed immediately, in case another instance uses it. */
|
||||
random_save_seed();
|
||||
|
||||
gsps = NULL;
|
||||
mod = GetModuleHandle("KERNEL32");
|
||||
@ -56,6 +58,7 @@ void random_save_seed(void)
|
||||
if (random_active) {
|
||||
random_get_savedata(&data, &len);
|
||||
write_random_seed(data, len);
|
||||
sfree(data);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user