diff options
author | Nick Mathewson <nickm@torproject.org> | 2020-10-16 09:26:41 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2020-10-16 16:07:46 -0400 |
commit | acf4225441fbb20eebedf32d15cb7ccd0488da9f (patch) | |
tree | 816a0d85a10de9d8de34434f7557757bfc50b577 /src/feature | |
parent | 36ea25c23636a3525100dc9bb4aa43039881079e (diff) | |
download | tor-acf4225441fbb20eebedf32d15cb7ccd0488da9f.tar.gz tor-acf4225441fbb20eebedf32d15cb7ccd0488da9f.zip |
Fix up vote tests in test_dir_handle_get.
These tests used a hardcoded vote with a hardcoded digest. That
vote didn't have any pr lines, and so it is now invalid. I've
adjusted the testing code so that it mocks the signature-checking,
so that we can more easily change the contents of the vote.
Diffstat (limited to 'src/feature')
-rw-r--r-- | src/feature/dirparse/sigcommon.c | 6 | ||||
-rw-r--r-- | src/feature/dirparse/sigcommon.h | 12 |
2 files changed, 9 insertions, 9 deletions
diff --git a/src/feature/dirparse/sigcommon.c b/src/feature/dirparse/sigcommon.c index 8b970d7d1f..fb81b2da6e 100644 --- a/src/feature/dirparse/sigcommon.c +++ b/src/feature/dirparse/sigcommon.c @@ -139,13 +139,13 @@ signed_digest_equals, (const uint8_t *d1, const uint8_t *d2, size_t len)) * the document when generating log messages. Return 0 on success, negative * on failure. */ -int -check_signature_token(const char *digest, +MOCK_IMPL(int, +check_signature_token,(const char *digest, ssize_t digest_len, directory_token_t *tok, crypto_pk_t *pkey, int flags, - const char *doctype) + const char *doctype)) { char *signed_digest; size_t keysize; diff --git a/src/feature/dirparse/sigcommon.h b/src/feature/dirparse/sigcommon.h index c2ed9df494..c7f370f8e8 100644 --- a/src/feature/dirparse/sigcommon.h +++ b/src/feature/dirparse/sigcommon.h @@ -20,12 +20,12 @@ int router_get_hash_impl(const char *s, size_t s_len, char *digest, #define CST_NO_CHECK_OBJTYPE (1<<0) struct directory_token_t; -int check_signature_token(const char *digest, - ssize_t digest_len, - struct directory_token_t *tok, - crypto_pk_t *pkey, - int flags, - const char *doctype); +MOCK_DECL(int, check_signature_token,(const char *digest, + ssize_t digest_len, + struct directory_token_t *tok, + crypto_pk_t *pkey, + int flags, + const char *doctype)); int router_get_hash_impl_helper(const char *s, size_t s_len, const char *start_str, |