summaryrefslogtreecommitdiff
path: root/src/or/shared_random.c
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2016-05-11 16:02:18 -0400
committerDavid Goulet <dgoulet@torproject.org>2016-07-01 14:01:41 -0400
commit545b77e2f8fac6cf5909bb6b69b52d9cb4f8f397 (patch)
treecd7f3f3f5a4e93ddbea683da551f072f42da1f1c /src/or/shared_random.c
parent0f27d92e4c420cae8fff0ab889ad8494461d6f8e (diff)
downloadtor-545b77e2f8fac6cf5909bb6b69b52d9cb4f8f397.tar.gz
tor-545b77e2f8fac6cf5909bb6b69b52d9cb4f8f397.zip
prop250: Only trust known authority when computing SRV
Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/or/shared_random.c')
-rw-r--r--src/or/shared_random.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/or/shared_random.c b/src/or/shared_random.c
index 6e6ff3baa3..d409d109ac 100644
--- a/src/or/shared_random.c
+++ b/src/or/shared_random.c
@@ -951,6 +951,16 @@ sr_compute_srv(void)
DIGESTMAP_FOREACH(state_commits, key, sr_commit_t *, c) {
/* Extra safety net, make sure we have valid commit before using it. */
ASSERT_COMMIT_VALID(c);
+ /* Let's not use a commit from an authority that we don't know. It's
+ * possible that an authority could be removed during a protocol run so
+ * that commit value should never be used in the SRV computation. */
+ if (trusteddirserver_get_by_v3_auth_digest(c->rsa_identity) == NULL) {
+ log_warn(LD_DIR, "SR: Fingerprint %s is not from a recognized "
+ "authority. Discarding commit for the SRV computation.",
+ sr_commit_get_rsa_fpr(c));
+ continue;
+ }
+ /* We consider this commit valid. */
smartlist_add(commits, c);
} DIGESTMAP_FOREACH_END;
smartlist_sort(commits, compare_reveal_);