diff options
author | David Goulet <dgoulet@ev0ke.net> | 2015-04-21 10:17:12 -0400 |
---|---|---|
committer | David Goulet <dgoulet@ev0ke.net> | 2015-04-21 11:06:12 -0400 |
commit | 3f413184728c1d7b441b8e54585c43220665218c (patch) | |
tree | 4098cf1f1c596e98a3be1a5c78f3d07aa3d353e8 /src/or/main.c | |
parent | 6f6881c4324f35d44b997591939de7e847cca7a3 (diff) | |
download | tor-3f413184728c1d7b441b8e54585c43220665218c.tar.gz tor-3f413184728c1d7b441b8e54585c43220665218c.zip |
Add crypto_rand_int_range() and use it
Incidently, this fixes a bug where the maximum value was never used when
only using crypto_rand_int(). For instance this example below in
rendservice.c never gets to INTRO_POINT_LIFETIME_MAX_SECONDS.
int intro_point_lifetime_seconds =
INTRO_POINT_LIFETIME_MIN_SECONDS +
crypto_rand_int(INTRO_POINT_LIFETIME_MAX_SECONDS -
INTRO_POINT_LIFETIME_MIN_SECONDS);
Signed-off-by: David Goulet <dgoulet@ev0ke.net>
Diffstat (limited to 'src/or/main.c')
-rw-r--r-- | src/or/main.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/or/main.c b/src/or/main.c index 39c0f5c89e..b9009db151 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -1623,7 +1623,7 @@ run_scheduled_events(time_t now) time_to.check_for_correct_dns < now && ! router_my_exit_policy_is_reject_star()) { if (!time_to.check_for_correct_dns) { - time_to.check_for_correct_dns = now + 60 + crypto_rand_int(120); + time_to.check_for_correct_dns = crypto_rand_int_range(now, now + 120) + 60; } else { dns_launch_correctness_checks(); time_to.check_for_correct_dns = now + 12*3600 + |