1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +00:00

Move random_save_seed() into sshrand.c.

It's identical in uxnoise and winnoise, being written entirely in
terms of existing cross-platform functions. Might as well centralise
it into sshrand.c.
This commit is contained in:
Simon Tatham 2019-05-05 19:59:35 +01:00
parent 5f35f5b4ac
commit 4fb20b15f3
3 changed files with 13 additions and 24 deletions

View File

@ -4,6 +4,7 @@
#include "putty.h"
#include "ssh.h"
#include "storage.h"
#include <assert.h>
/* Collect environmental noise every 5 minutes */
@ -78,6 +79,18 @@ static void random_create(const ssh_hashalg *hashalg)
random_save_seed();
}
void random_save_seed(void)
{
int len;
void *data;
if (random_active) {
random_get_savedata(&data, &len);
write_random_seed(data, len);
sfree(data);
}
}
void random_ref(void)
{
if (!random_active++)

View File

@ -84,18 +84,6 @@ void noise_get_heavy(void (*func) (void *, int))
read_random_seed(func);
}
void random_save_seed(void)
{
int len;
void *data;
if (random_active) {
random_get_savedata(&data, &len);
write_random_seed(data, len);
sfree(data);
}
}
/*
* This function is called on a timer, and grabs as much changeable
* system data as it can quickly get its hands on.

View File

@ -75,18 +75,6 @@ void noise_get_heavy(void (*func) (void *, int))
read_random_seed(func);
}
void random_save_seed(void)
{
int len;
void *data;
if (random_active) {
random_get_savedata(&data, &len);
write_random_seed(data, len);
sfree(data);
}
}
/*
* This function is called on a timer, and it will monitor
* frequently changing quantities such as the state of physical and