diff options
author | Nick Mathewson <nickm@torproject.org> | 2009-09-14 11:57:19 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2009-10-15 15:17:12 -0400 |
commit | 8b2f6b27fdc03f12d092d37c42d1995ff7426916 (patch) | |
tree | e43bd2156f445597940f0b9b386920811e7a38de /src/or/routerparse.c | |
parent | 8d41e6c47126fb467858f98b06ab7460dcc6647b (diff) | |
download | tor-8b2f6b27fdc03f12d092d37c42d1995ff7426916.tar.gz tor-8b2f6b27fdc03f12d092d37c42d1995ff7426916.zip |
Make signature-generation code handle different key and digest lengths.
Diffstat (limited to 'src/or/routerparse.c')
-rw-r--r-- | src/or/routerparse.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/or/routerparse.c b/src/or/routerparse.c index e35ece06de..02c5cdb44e 100644 --- a/src/or/routerparse.c +++ b/src/or/routerparse.c @@ -643,14 +643,15 @@ router_get_extrainfo_hash(const char *s, char *digest) */ int router_append_dirobj_signature(char *buf, size_t buf_len, const char *digest, - crypto_pk_env_t *private_key) + size_t digest_len, crypto_pk_env_t *private_key) { char *signature; size_t i; + int siglen; signature = tor_malloc(crypto_pk_keysize(private_key)); - if (crypto_pk_private_sign(private_key, signature, digest, DIGEST_LEN) < 0) { - + siglen = crypto_pk_private_sign(private_key, signature, digest, digest_len); + if (siglen < 0) { log_warn(LD_BUG,"Couldn't sign digest."); goto err; } @@ -658,7 +659,7 @@ router_append_dirobj_signature(char *buf, size_t buf_len, const char *digest, goto truncated; i = strlen(buf); - if (base64_encode(buf+i, buf_len-i, signature, 128) < 0) { + if (base64_encode(buf+i, buf_len-i, signature, siglen) < 0) { log_warn(LD_BUG,"couldn't base64-encode signature"); goto err; } |