aboutsummaryrefslogtreecommitdiff
path: root/src/or/rendservice.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2017-08-09 09:24:16 -0400
committerNick Mathewson <nickm@torproject.org>2017-08-09 09:24:16 -0400
commit418f3d6298beb27e050618e2f59e01d6d3b2f45b (patch)
tree97ac6a038194559561a34d245fbd74584cb5f9c6 /src/or/rendservice.c
parent9696021593d28a7ae3b6a88ac57ff31234b469f5 (diff)
downloadtor-418f3d6298beb27e050618e2f59e01d6d3b2f45b.tar.gz
tor-418f3d6298beb27e050618e2f59e01d6d3b2f45b.zip
Make sure we always wind up checking i2d_*'s output.
The biggest offender here was sometimes not checking the output of crypto_pk_get_digest. Fixes bug 19418. Reported by Guido Vranken.
Diffstat (limited to 'src/or/rendservice.c')
-rw-r--r--src/or/rendservice.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/or/rendservice.c b/src/or/rendservice.c
index 4d04da02aa..d4441b63ce 100644
--- a/src/or/rendservice.c
+++ b/src/or/rendservice.c
@@ -2689,7 +2689,14 @@ rend_service_decrypt_intro(
/* Check that this cell actually matches this service key */
/* first DIGEST_LEN bytes of request is intro or service pk digest */
- crypto_pk_get_digest(key, (char *)key_digest);
+ if (crypto_pk_get_digest(key, (char *)key_digest) < 0) {
+ if (err_msg_out)
+ *err_msg_out = tor_strdup("Couldn't compute RSA digest.");
+ log_warn(LD_BUG, "Couldn't compute key digest.");
+ status = -7;
+ goto err;
+ }
+
if (tor_memneq(key_digest, intro->pk, DIGEST_LEN)) {
if (err_msg_out) {
base32_encode(service_id, REND_SERVICE_ID_LEN_BASE32 + 1,