diff options
author | Nick Mathewson <nickm@torproject.org> | 2011-11-29 18:30:41 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2011-11-29 18:30:41 -0500 |
commit | da6c136817983e30349e9733891239b05aa66f09 (patch) | |
tree | 5c5af254f33ddfdbf8f004410f00ea131b280880 /src/or/router.c | |
parent | 83f66db79ec6469beea0fb410be6536acb90ffd0 (diff) | |
parent | 055d6c01fff3324dbb38c2d81ad49ccfdb5432c2 (diff) | |
download | tor-da6c136817983e30349e9733891239b05aa66f09.tar.gz tor-da6c136817983e30349e9733891239b05aa66f09.zip |
Merge remote-tracking branch 'asn-mytor/bug4548_take2'
Diffstat (limited to 'src/or/router.c')
-rw-r--r-- | src/or/router.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/or/router.c b/src/or/router.c index d0292aa66a..8fe45dd6f8 100644 --- a/src/or/router.c +++ b/src/or/router.c @@ -484,6 +484,16 @@ v3_authority_check_key_expiry(void) last_warned = now; } +int +router_initialize_tls_context(void) +{ + return tor_tls_context_init(public_server_mode(get_options()), + get_tlsclient_identity_key(), + server_mode(get_options()) ? + get_server_identity_key() : NULL, + MAX_SSL_KEY_LIFETIME_ADVERTISED); +} + /** Initialize all OR private keys, and the TLS context, as necessary. * On OPs, this only initializes the tls context. Return 0 on success, * or -1 if Tor should die. @@ -530,10 +540,7 @@ init_keys(void) } set_client_identity_key(prkey); /* Create a TLS context. */ - if (tor_tls_context_init(0, - get_tlsclient_identity_key(), - NULL, - MAX_SSL_KEY_LIFETIME_ADVERTISED) < 0) { + if (router_initialize_tls_context() < 0) { log_err(LD_GENERAL,"Error creating TLS context for Tor client."); return -1; } @@ -626,13 +633,11 @@ init_keys(void) tor_free(keydir); /* 3. Initialize link key and TLS context. */ - if (tor_tls_context_init(public_server_mode(options), - get_tlsclient_identity_key(), - get_server_identity_key(), - MAX_SSL_KEY_LIFETIME_ADVERTISED) < 0) { + if (router_initialize_tls_context() < 0) { log_err(LD_GENERAL,"Error initializing TLS context"); return -1; } + /* 4. Build our router descriptor. */ /* Must be called after keys are initialized. */ mydesc = router_get_my_descriptor(); |