summaryrefslogtreecommitdiff
path: root/src/or/routerkeys.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2015-09-10 10:37:13 -0400
committerNick Mathewson <nickm@torproject.org>2015-09-10 10:37:13 -0400
commit41891cbf93c32282ed6136d29375b5863efcf727 (patch)
tree2fa0359d3d9e7ce8d5adc66badbb0a86e295b884 /src/or/routerkeys.c
parent901732a1bc62b1d8455e13bc989d1f0196432943 (diff)
parent037e8763a7cb6358b4622ebef30bda6e11bb2ce5 (diff)
downloadtor-41891cbf93c32282ed6136d29375b5863efcf727.tar.gz
tor-41891cbf93c32282ed6136d29375b5863efcf727.zip
Merge remote-tracking branch 'public/ed25519_hup_v2'
Diffstat (limited to 'src/or/routerkeys.c')
-rw-r--r--src/or/routerkeys.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/or/routerkeys.c b/src/or/routerkeys.c
index 50659fcb69..1120578c28 100644
--- a/src/or/routerkeys.c
+++ b/src/or/routerkeys.c
@@ -638,11 +638,13 @@ load_ed_keys(const or_options_t *options, time_t now)
goto err; \
} while (0)
#define SET_KEY(key, newval) do { \
- ed25519_keypair_free(key); \
+ if ((key) != (newval)) \
+ ed25519_keypair_free(key); \
key = (newval); \
} while (0)
#define SET_CERT(cert, newval) do { \
- tor_cert_free(cert); \
+ if ((cert) != (newval)) \
+ tor_cert_free(cert); \
cert = (newval); \
} while (0)
#define EXPIRES_SOON(cert, interval) \
@@ -651,10 +653,7 @@ load_ed_keys(const or_options_t *options, time_t now)
/* XXXX support encrypted identity keys fully */
/* First try to get the signing key to see how it is. */
- if (master_signing_key) {
- check_signing_cert = signing_key_cert;
- use_signing = master_signing_key;
- } else {
+ {
char *fname =
options_get_datadir_fname2(options, "keys", "ed25519_signing");
sign = ed_key_init_from_file(
@@ -668,6 +667,11 @@ load_ed_keys(const or_options_t *options, time_t now)
use_signing = sign;
}
+ if (!use_signing && master_signing_key) {
+ check_signing_cert = signing_key_cert;
+ use_signing = master_signing_key;
+ }
+
const int need_new_signing_key =
NULL == use_signing ||
EXPIRES_SOON(check_signing_cert, 0) ||