summaryrefslogtreecommitdiff
path: root/src/or/networkstatus.c
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2018-05-01 10:59:10 -0400
committerDavid Goulet <dgoulet@torproject.org>2018-05-01 11:43:23 -0400
commit098b7fe25bdba20974ebf4ae02ec816316f23383 (patch)
tree11c97b69557f99c99c8358c1a7229bce96a46fa5 /src/or/networkstatus.c
parentafd4fc689a5212a9aafa084f4e377db28583360d (diff)
downloadtor-098b7fe25bdba20974ebf4ae02ec816316f23383.tar.gz
tor-098b7fe25bdba20974ebf4ae02ec816316f23383.zip
ns: Move dirvote_get_voter_sig_by_alg() to networkstatus.c
It makes more sense to be in networkstatus.c so move it there and rename it with the "networkstatus_" prefix. Part of #25988 Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/or/networkstatus.c')
-rw-r--r--src/or/networkstatus.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c
index 1267d9d6bc..99f1490203 100644
--- a/src/or/networkstatus.c
+++ b/src/or/networkstatus.c
@@ -390,6 +390,20 @@ networkstatus_get_voter_by_id(networkstatus_t *vote,
return NULL;
}
+/** Return the signature made by <b>voter</b> using the algorithm
+ * <b>alg</b>, or NULL if none is found. */
+document_signature_t *
+networkstatus_get_voter_sig_by_alg(const networkstatus_voter_info_t *voter,
+ digest_algorithm_t alg)
+{
+ if (!voter->sigs)
+ return NULL;
+ SMARTLIST_FOREACH(voter->sigs, document_signature_t *, sig,
+ if (sig->alg == alg)
+ return sig);
+ return NULL;
+}
+
/** Check whether the signature <b>sig</b> is correctly signed with the
* signing key in <b>cert</b>. Return -1 if <b>cert</b> doesn't match the
* signing key; otherwise set the good_signature or bad_signature flag on