aboutsummaryrefslogtreecommitdiff
path: root/src/or/routerparse.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2011-01-15 12:02:55 -0500
committerNick Mathewson <nickm@torproject.org>2011-01-15 12:02:55 -0500
commited87738ede789fb9eccfd2e5a34bd8c484dfe44e (patch)
tree27eb5efade75d368692a80d258615415deb8a7dc /src/or/routerparse.c
parentb27f5cc50d4a66bff31e43a596eb296a1b5a11dc (diff)
parent50b06a2b76190170e9f80739f022696755b54b99 (diff)
downloadtor-ed87738ede789fb9eccfd2e5a34bd8c484dfe44e.tar.gz
tor-ed87738ede789fb9eccfd2e5a34bd8c484dfe44e.zip
Merge remote branch 'origin/maint-0.2.1' into maint-0.2.2
Conflicts: src/or/config.c src/or/networkstatus.c src/or/rendcommon.c src/or/routerparse.c src/or/test.c
Diffstat (limited to 'src/or/routerparse.c')
-rw-r--r--src/or/routerparse.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index 691b9beabc..66d024ecd4 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -702,11 +702,13 @@ router_append_dirobj_signature(char *buf, size_t buf_len, const char *digest,
size_t digest_len, crypto_pk_env_t *private_key)
{
char *signature;
- size_t i;
+ size_t i, keysize;
int siglen;
- signature = tor_malloc(crypto_pk_keysize(private_key));
- siglen = crypto_pk_private_sign(private_key, signature, digest, digest_len);
+ keysize = crypto_pk_keysize(private_key);
+ signature = tor_malloc(keysize);
+ siglen = crypto_pk_private_sign(private_key, signature, keysize,
+ digest, digest_len);
if (siglen < 0) {
log_warn(LD_BUG,"Couldn't sign digest.");
goto err;
@@ -1059,6 +1061,7 @@ check_signature_token(const char *digest,
const char *doctype)
{
char *signed_digest;
+ size_t keysize;
const int check_authority = (flags & CST_CHECK_AUTHORITY);
const int check_objtype = ! (flags & CST_NO_CHECK_OBJTYPE);
@@ -1080,10 +1083,11 @@ check_signature_token(const char *digest,
}
}
- signed_digest = tor_malloc(tok->object_size);
- if (crypto_pk_public_checksig(pkey, signed_digest, tok->object_body,
- tok->object_size)
- < digest_len) {
+ keysize = crypto_pk_keysize(pkey);
+ signed_digest = tor_malloc(keysize);
+ if (crypto_pk_public_checksig(pkey, signed_digest, keysize,
+ tok->object_body, tok->object_size)
+ < DIGEST_LEN) {
log_warn(LD_DIR, "Error reading %s: invalid signature.", doctype);
tor_free(signed_digest);
return -1;