aboutsummaryrefslogtreecommitdiff
path: root/src/or/main.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2005-10-06 22:22:22 +0000
committerNick Mathewson <nickm@torproject.org>2005-10-06 22:22:22 +0000
commita89daaeca90b84bed9ab802965c13705a18ed1a9 (patch)
tree610e421147c221337d95dd2fa44625acc8812546 /src/or/main.c
parentcc35e1720f7dde775e2c8246c2f9b542954e401f (diff)
downloadtor-a89daaeca90b84bed9ab802965c13705a18ed1a9.tar
tor-a89daaeca90b84bed9ab802965c13705a18ed1a9.tar.gz
Once an hour (not just on startup) give OpenSSL some more entropy.
Add entropy in 512-bit chunks, not 160-bit chunks. (This latter change is voodoo.) svn:r5211
Diffstat (limited to 'src/or/main.c')
-rw-r--r--src/or/main.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/or/main.c b/src/or/main.c
index d05a5b828..28913e11b 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -98,6 +98,7 @@ static char* nt_strerror(uint32_t errnum);
#define DESCRIPTOR_RETRY_INTERVAL 10
#define DESCRIPTOR_FAILURE_RESET_INTERVAL 60*60
#define TIMEOUT_UNTIL_UNREACHABILITY_COMPLAINT (20*60) /* 20 minutes */
+#define ENTROPY_INTERVAL 60*60
/********* END VARIABLES ************/
@@ -639,6 +640,7 @@ run_scheduled_events(time_t now)
static time_t time_to_shrink_buffers = 0;
static time_t time_to_try_getting_descriptors = 0;
static time_t time_to_reset_descriptor_failures = 0;
+ static time_t time_to_add_entropy = 0;
or_options_t *options = get_options();
int i;
@@ -689,6 +691,14 @@ run_scheduled_events(time_t now)
* them at all. */
}
+ if (time_to_add_entropy == 0)
+ time_to_add_entropy = now + ENTROPY_INTERVAL;
+ if (time_to_add_entropy < now) {
+ /* We already seeded once, so don't die on failure. */
+ crypto_seed_rng();
+ time_to_add_entropy = now + ENTROPY_INTERVAL;
+ }
+
/** 1c. If we have to change the accounting interval or record
* bandwidth used in this accounting interval, do so. */
if (accounting_is_enabled(options))