diff options
author | Lutz Jänicke <jaenicke@openssl.org> | 2001-01-09 10:58:36 +0000 |
---|---|---|
committer | Lutz Jänicke <jaenicke@openssl.org> | 2001-01-09 10:58:36 +0000 |
commit | 28e5428d5df083c6015be5abc88959ee2e662eb6 (patch) | |
tree | 424ac6c4c5b1d4ae1148dfedf0787437f49a2dc2 /crypto | |
parent | 3c914840520161d9ca121d38973a79b050916a8a (diff) | |
download | openssl-28e5428d5df083c6015be5abc88959ee2e662eb6.tar.gz |
Don't cheat: when only getting several bytes from each source, n is incremented
correctly, but RAND_add(..,n) counts the increasing n several times.
Only RAND_add(..,n) once entropy collection is finished.
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/rand/rand_unix.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/crypto/rand/rand_unix.c b/crypto/rand/rand_unix.c index c4aae38f1d..658d35f81c 100644 --- a/crypto/rand/rand_unix.c +++ b/crypto/rand/rand_unix.c @@ -183,10 +183,13 @@ int RAND_poll(void) && t.tv_usec != 0 && n < ENTROPY_NEEDED); close(fd); - RAND_add(tmpbuf,sizeof tmpbuf,n); - memset(tmpbuf,0,n); } } + if (n > 0) + { + RAND_add(tmpbuf,sizeof tmpbuf,n); + memset(tmpbuf,0,n); + } #endif /* put in some default random data, we need more than just this */ |