Loading src/or/shared_random.c +10 −9 Original line number Diff line number Diff line Loading @@ -599,6 +599,16 @@ should_keep_commit(const sr_commit_t *commit, const char *voter_key, goto ignore; } /* Let's make sure, for extra safety, that this fingerprint is known to * us. Even though this comes from a vote, doesn't hurt to be * extracareful. */ if (trusteddirserver_get_by_v3_auth_digest(commit->rsa_identity) == NULL) { log_warn(LD_DIR, "SR: Fingerprint %s is not from a recognized " "authority. Discarding commit.", escaped(commit->rsa_identity)); goto ignore; } /* Check if the authority that voted for <b>commit</b> has already posted * a commit before. */ saved_commit = sr_state_get_commit(commit->rsa_identity); Loading Loading @@ -1108,15 +1118,6 @@ sr_parse_commit(const smartlist_t *args) escaped(rsa_identity_fpr)); goto error; } /* Let's make sure, for extra safety, that this fingerprint is known to * us. Even though this comes from a vote, doesn't hurt to be * extracareful. */ if (trusteddirserver_get_by_v3_auth_digest(digest) == NULL) { log_warn(LD_DIR, "SR: Fingerprint %s is not from a recognized " "authority. Discarding commit.", escaped(rsa_identity_fpr)); goto error; } /* Allocate commit since we have a valid identity now. */ commit = commit_new(digest); Loading src/test/test_shared_random.c +4 −4 Original line number Diff line number Diff line Loading @@ -277,9 +277,6 @@ test_sr_commit(void *arg) (void) arg; MOCK(trusteddirserver_get_by_v3_auth_digest, trusteddirserver_get_by_v3_auth_digest_m); { /* Setup a minimal dirauth environment for this test */ or_options_t *options = get_options_mutable(); Loading Loading @@ -366,7 +363,6 @@ test_sr_commit(void *arg) done: smartlist_free(args); sr_commit_free(our_commit); UNMOCK(trusteddirserver_get_by_v3_auth_digest); } /* Test the encoding and decoding function for commit and reveal values. */ Loading Loading @@ -1121,6 +1117,9 @@ test_keep_commit(void *arg) (void) arg; MOCK(trusteddirserver_get_by_v3_auth_digest, trusteddirserver_get_by_v3_auth_digest_m); { /* Setup a minimal dirauth environment for this test */ crypto_pk_t *k = crypto_pk_new(); /* Have a key that is not the one from our commit. */ Loading Loading @@ -1199,6 +1198,7 @@ test_keep_commit(void *arg) done: sr_commit_free(commit); sr_commit_free(dup_commit); UNMOCK(trusteddirserver_get_by_v3_auth_digest); } static void Loading Loading
src/or/shared_random.c +10 −9 Original line number Diff line number Diff line Loading @@ -599,6 +599,16 @@ should_keep_commit(const sr_commit_t *commit, const char *voter_key, goto ignore; } /* Let's make sure, for extra safety, that this fingerprint is known to * us. Even though this comes from a vote, doesn't hurt to be * extracareful. */ if (trusteddirserver_get_by_v3_auth_digest(commit->rsa_identity) == NULL) { log_warn(LD_DIR, "SR: Fingerprint %s is not from a recognized " "authority. Discarding commit.", escaped(commit->rsa_identity)); goto ignore; } /* Check if the authority that voted for <b>commit</b> has already posted * a commit before. */ saved_commit = sr_state_get_commit(commit->rsa_identity); Loading Loading @@ -1108,15 +1118,6 @@ sr_parse_commit(const smartlist_t *args) escaped(rsa_identity_fpr)); goto error; } /* Let's make sure, for extra safety, that this fingerprint is known to * us. Even though this comes from a vote, doesn't hurt to be * extracareful. */ if (trusteddirserver_get_by_v3_auth_digest(digest) == NULL) { log_warn(LD_DIR, "SR: Fingerprint %s is not from a recognized " "authority. Discarding commit.", escaped(rsa_identity_fpr)); goto error; } /* Allocate commit since we have a valid identity now. */ commit = commit_new(digest); Loading
src/test/test_shared_random.c +4 −4 Original line number Diff line number Diff line Loading @@ -277,9 +277,6 @@ test_sr_commit(void *arg) (void) arg; MOCK(trusteddirserver_get_by_v3_auth_digest, trusteddirserver_get_by_v3_auth_digest_m); { /* Setup a minimal dirauth environment for this test */ or_options_t *options = get_options_mutable(); Loading Loading @@ -366,7 +363,6 @@ test_sr_commit(void *arg) done: smartlist_free(args); sr_commit_free(our_commit); UNMOCK(trusteddirserver_get_by_v3_auth_digest); } /* Test the encoding and decoding function for commit and reveal values. */ Loading Loading @@ -1121,6 +1117,9 @@ test_keep_commit(void *arg) (void) arg; MOCK(trusteddirserver_get_by_v3_auth_digest, trusteddirserver_get_by_v3_auth_digest_m); { /* Setup a minimal dirauth environment for this test */ crypto_pk_t *k = crypto_pk_new(); /* Have a key that is not the one from our commit. */ Loading Loading @@ -1199,6 +1198,7 @@ test_keep_commit(void *arg) done: sr_commit_free(commit); sr_commit_free(dup_commit); UNMOCK(trusteddirserver_get_by_v3_auth_digest); } static void Loading