diff options
author | Nick Mathewson <nickm@torproject.org> | 2006-12-24 02:45:53 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2006-12-24 02:45:53 +0000 |
commit | f3fd5d9032e377783a90b9b6995ef3a6413fc98e (patch) | |
tree | 7784559bf3b9ab9e6d3672d6acbf75e0b81019bd /src | |
parent | bba5a3533f1413601c04a8f61ab0662b77fe7e2b (diff) | |
download | tor-f3fd5d9032e377783a90b9b6995ef3a6413fc98e.tar tor-f3fd5d9032e377783a90b9b6995ef3a6413fc98e.tar.gz |
r11680@Kushana: nickm | 2006-12-23 21:45:05 -0500
Remove code to look for keys in their old locations: we havent stored them there since 0.0.7.2.
svn:r9175
Diffstat (limited to 'src')
-rw-r--r-- | src/or/router.c | 35 |
1 files changed, 6 insertions, 29 deletions
diff --git a/src/or/router.c b/src/or/router.c index a43584205..350c9bd69 100644 --- a/src/or/router.c +++ b/src/or/router.c @@ -162,26 +162,6 @@ rotate_onion_key(void) log_warn(LD_GENERAL, "Couldn't rotate onion key."); } -/* Read an RSA secret key key from a file that was once named fname_old, - * but is now named fname_new. Rename the file from old to new as needed. - */ -static crypto_pk_env_t * -init_key_from_file_name_changed(const char *fname_old, - const char *fname_new) -{ - if (file_status(fname_new) == FN_FILE || file_status(fname_old) != FN_FILE) - /* The new filename is there, or both are, or neither is. */ - return init_key_from_file(fname_new); - - /* The old filename exists, and the new one doesn't. Rename and load. */ - if (rename(fname_old, fname_new) < 0) { - log_warn(LD_FS, "Couldn't rename key file \"%s\" to \"%s\": %s", - fname_old, fname_new, strerror(errno)); - return NULL; - } - return init_key_from_file(fname_new); -} - /** Try to read an RSA key from <b>fname</b>. If <b>fname</b> doesn't exist, * create a new RSA key and save it in <b>fname</b>. Return the read/created * key, or NULL on error. @@ -245,7 +225,6 @@ int init_keys(void) { char keydir[512]; - char keydir2[512]; char fingerprint[FINGERPRINT_LEN+1]; /*nickname<space>fp\n\0 */ char fingerprint_line[MAX_NICKNAME_LEN+FINGERPRINT_LEN+3]; @@ -287,17 +266,15 @@ init_keys(void) } /* 1. Read identity key. Make it if none is found. */ - tor_snprintf(keydir,sizeof(keydir),"%s/keys/identity.key",datadir); - tor_snprintf(keydir2,sizeof(keydir2),"%s/keys/secret_id_key",datadir); - log_info(LD_GENERAL,"Reading/making identity key \"%s\"...",keydir2); - prkey = init_key_from_file_name_changed(keydir,keydir2); + tor_snprintf(keydir,sizeof(keydir),"%s/keys/secret_id_key",datadir); + log_info(LD_GENERAL,"Reading/making identity key \"%s\"...",keydir); + prkey = init_key_from_file(keydir); if (!prkey) return -1; set_identity_key(prkey); /* 2. Read onion key. Make it if none is found. */ - tor_snprintf(keydir,sizeof(keydir),"%s/keys/onion.key",datadir); - tor_snprintf(keydir2,sizeof(keydir2),"%s/keys/secret_onion_key",datadir); - log_info(LD_GENERAL,"Reading/making onion key \"%s\"...",keydir2); - prkey = init_key_from_file_name_changed(keydir,keydir2); + tor_snprintf(keydir,sizeof(keydir),"%s/keys/secret_onion_key",datadir); + log_info(LD_GENERAL,"Reading/making onion key \"%s\"...",keydir); + prkey = init_key_from_file(keydir); if (!prkey) return -1; set_onion_key(prkey); if (state->LastRotatedOnionKey > 100) { /* allow for some parsing slop. */ |