aboutsummaryrefslogtreecommitdiff
path: root/src/or/directory.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2009-09-16 17:01:01 -0400
committerNick Mathewson <nickm@torproject.org>2009-10-15 15:17:13 -0400
commit3b2fc659a8ef83feedadcda32de49db06b80af10 (patch)
tree9df2972d2278f44f8e4fcfa6396aa45cc0d2e6db /src/or/directory.c
parente1ddee8bbe724e934fe9a4cb2d290719a7d6105c (diff)
downloadtor-3b2fc659a8ef83feedadcda32de49db06b80af10.tar.gz
tor-3b2fc659a8ef83feedadcda32de49db06b80af10.zip
Refactor consensus signature storage for multiple digests and flavors.
This patch introduces a new type called document_signature_t to represent the signature of a consensus document. Now, each consensus document can have up to one document signature per voter per digest algorithm. Also, each detached-signatures document can have up to one signature per <voter, algorithm, flavor>.
Diffstat (limited to 'src/or/directory.c')
-rw-r--r--src/or/directory.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/or/directory.c b/src/or/directory.c
index 5fe2de4eee..19ef6351c2 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -2330,7 +2330,7 @@ client_likes_consensus(networkstatus_t *v, const char *want_url)
dir_split_resource_into_fingerprints(want_url, want_authorities, NULL, 0, 0);
need_at_least = smartlist_len(want_authorities)/2+1;
- SMARTLIST_FOREACH(want_authorities, const char *, d, {
+ SMARTLIST_FOREACH_BEGIN(want_authorities, const char *, d) {
char want_digest[DIGEST_LEN];
size_t want_len = strlen(d)/2;
if (want_len > DIGEST_LEN)
@@ -2341,18 +2341,18 @@ client_likes_consensus(networkstatus_t *v, const char *want_url)
continue;
};
- SMARTLIST_FOREACH(v->voters, networkstatus_voter_info_t *, vi, {
- if (vi->signature &&
+ SMARTLIST_FOREACH_BEGIN(v->voters, networkstatus_voter_info_t *, vi) {
+ if (smartlist_len(vi->sigs) &&
!memcmp(vi->identity_digest, want_digest, want_len)) {
have++;
break;
};
- });
+ } SMARTLIST_FOREACH_END(vi);
/* early exit, if we already have enough */
if (have >= need_at_least)
break;
- });
+ } SMARTLIST_FOREACH_END(d);
SMARTLIST_FOREACH(want_authorities, char *, d, tor_free(d));
smartlist_free(want_authorities);