diff options
author | Nick Mathewson <nickm@torproject.org> | 2015-05-19 16:17:03 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2015-05-20 15:27:36 -0400 |
commit | f8f407d66a4389035852a229a6945cc08a64b198 (patch) | |
tree | 527054f001d4f1ab0f6ddcbd4727a2a5333debef /src/common | |
parent | 971f0f8e18c0f3ea9f2aa74a54951235269a1cd1 (diff) | |
download | tor-f8f407d66a4389035852a229a6945cc08a64b198.tar.gz tor-f8f407d66a4389035852a229a6945cc08a64b198.zip |
Now that OpenSSL 0.9.8 is dead, crypto_seed_rng() needs no args
It needed an argument before because it wasn't safe to call
RAND_poll() on openssl 0.9.8c if you had already opened more fds
than would fit in fd_set.
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/crypto.c | 8 | ||||
-rw-r--r-- | src/common/crypto.h | 2 |
2 files changed, 4 insertions, 6 deletions
diff --git a/src/common/crypto.c b/src/common/crypto.c index 0feed1cf1b..f980d7ecfc 100644 --- a/src/common/crypto.c +++ b/src/common/crypto.c @@ -302,7 +302,7 @@ crypto_early_init(void) crypto_force_rand_ssleay(); - if (crypto_seed_rng(1) < 0) + if (crypto_seed_rng() < 0) return -1; if (crypto_init_siphash_key() < 0) return -1; @@ -384,7 +384,7 @@ crypto_global_init(int useAccel, const char *accelName, const char *accelDir) } if (crypto_force_rand_ssleay()) { - if (crypto_seed_rng(1) < 0) + if (crypto_seed_rng() < 0) return -1; } @@ -2485,13 +2485,11 @@ crypto_strongest_rand(uint8_t *out, size_t out_len) * have not yet allocated a bunch of fds. Return 0 on success, -1 on failure. */ int -crypto_seed_rng(int startup) +crypto_seed_rng(void) { int rand_poll_ok = 0, load_entropy_ok = 0; uint8_t buf[ADD_ENTROPY]; - (void) startup; - /* OpenSSL has a RAND_poll function that knows about more kinds of * entropy than we do. We'll try calling that, *and* calling our own entropy * functions. If one succeeds, we'll accept the RNG as seeded. */ diff --git a/src/common/crypto.h b/src/common/crypto.h index d305bc17a0..5a08045b05 100644 --- a/src/common/crypto.h +++ b/src/common/crypto.h @@ -251,7 +251,7 @@ int crypto_expand_key_material_rfc5869_sha256( uint8_t *key_out, size_t key_out_len); /* random numbers */ -int crypto_seed_rng(int startup); +int crypto_seed_rng(void); MOCK_DECL(int,crypto_rand,(char *to, size_t n)); int crypto_strongest_rand(uint8_t *out, size_t out_len); int crypto_rand_int(unsigned int max); |