projects
/
u
/
mdw
/
putty
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Improved entropy gathering.
[u/mdw/putty]
/
sshrand.c
diff --git
a/sshrand.c
b/sshrand.c
index
84c3e91
..
3e0a0a8
100644
(file)
--- a/
sshrand.c
+++ b/
sshrand.c
@@
-39,6
+39,7
@@
struct RandPool {
};
static struct RandPool pool;
};
static struct RandPool pool;
+static int random_active = 0;
void random_stir(void) {
word32 block[HASHINPUT/sizeof(word32)];
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;
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
/*
* This function processes HASHINPUT bytes into only HASHSIZE
* bytes, so _if_ we were getting incredibly high entropy
@@
-176,6
+180,8
@@
static void random_add_heavynoise_bitbybit(void *noise, int length) {
void random_init(void) {
memset(&pool, 0, sizeof(pool)); /* just to start with */
void random_init(void) {
memset(&pool, 0, sizeof(pool)); /* just to start with */
+ random_active = 1;
+
noise_get_heavy(random_add_heavynoise_bitbybit);
}
noise_get_heavy(random_add_heavynoise_bitbybit);
}