summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2006-12-16 07:00:59 +0000
committerNick Mathewson <nickm@torproject.org>2006-12-16 07:00:59 +0000
commit80b8abf7beeed528e16ae58b44d52f4708a81df1 (patch)
tree488fa249939291b1a2d392700625ef64c41bd08f /src
parent9cd8feb64913cc0c5d4c0be35dc77eaf93dc8921 (diff)
downloadtor-80b8abf7beeed528e16ae58b44d52f4708a81df1.tar.gz
tor-80b8abf7beeed528e16ae58b44d52f4708a81df1.zip
r11618@Kushana: nickm | 2006-12-16 02:00:52 -0500
Make router_is_me work without calling router_rebuild_descriptor. svn:r9139
Diffstat (limited to 'src')
-rw-r--r--src/or/router.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/or/router.c b/src/or/router.c
index fbf2469fcc..daa05d6e74 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -31,6 +31,7 @@ static time_t onionkey_set_at=0; /* When was onionkey last changed? */
static crypto_pk_env_t *onionkey=NULL;
static crypto_pk_env_t *lastonionkey=NULL;
static crypto_pk_env_t *identitykey=NULL;
+static char identitykey_digest[DIGEST_LEN];
/** Replace the current onion key with <b>k</b>. Does not affect lastonionkey;
* to update onionkey correctly, call rotate_onion_key().
@@ -90,6 +91,7 @@ set_identity_key(crypto_pk_env_t *k)
if (identitykey)
crypto_free_pk_env(identitykey);
identitykey = k;
+ crypto_pk_get_digest(identitykey, identitykey_digest);
}
/** Returns the current identity key; requires that the identity key has been
@@ -717,10 +719,7 @@ router_compare_to_my_exit_policy(edge_connection_t *conn)
int
router_digest_is_me(const char *digest)
{
- routerinfo_t *me = router_get_my_routerinfo();
- if (!me || memcmp(me->cache_info.identity_digest, digest, DIGEST_LEN))
- return 0;
- return 1;
+ return identitykey && !memcmp(identitykey_digest, digest, DIGEST_LEN);
}
/** A wrapper around router_digest_is_me(). */