aboutsummaryrefslogtreecommitdiff
path: root/src/or/onion.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2014-03-27 14:15:53 -0400
committerNick Mathewson <nickm@torproject.org>2014-03-27 14:15:53 -0400
commitde9de9e7dd2f34af04c76abf3f51c72dec4bdc93 (patch)
treeaf125f4d2e25a93c82c678c08c7b89d43fef66e3 /src/or/onion.c
parentcd15172444e0f8e34d1adcd84034c40893cd6c0f (diff)
downloadtor-de9de9e7dd2f34af04c76abf3f51c72dec4bdc93.tar
tor-de9de9e7dd2f34af04c76abf3f51c72dec4bdc93.tar.gz
Give specific warnings when client-side onionskin handshakes fail
Fix for bug9635.
Diffstat (limited to 'src/or/onion.c')
-rw-r--r--src/or/onion.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/or/onion.c b/src/or/onion.c
index 30b983d91..7c2c316aa 100644
--- a/src/or/onion.c
+++ b/src/or/onion.c
@@ -552,8 +552,10 @@ onion_skin_client_handshake(int type,
switch (type) {
case ONION_HANDSHAKE_TYPE_TAP:
- if (reply_len != TAP_ONIONSKIN_REPLY_LEN)
+ if (reply_len != TAP_ONIONSKIN_REPLY_LEN) {
+ log_warn(LD_CIRC, "TAP reply was not of the correct length.");
return -1;
+ }
if (onion_skin_TAP_client_handshake(handshake_state->u.tap,
(const char*)reply,
(char *)keys_out, keys_out_len) < 0)
@@ -563,8 +565,10 @@ onion_skin_client_handshake(int type,
return 0;
case ONION_HANDSHAKE_TYPE_FAST:
- if (reply_len != CREATED_FAST_LEN)
+ if (reply_len != CREATED_FAST_LEN) {
+ log_warn(LD_CIRC, "CREATED_FAST reply was not of the correct length.");
return -1;
+ }
if (fast_client_handshake(handshake_state->u.fast, reply,
keys_out, keys_out_len) < 0)
return -1;
@@ -573,8 +577,10 @@ onion_skin_client_handshake(int type,
return 0;
#ifdef CURVE25519_ENABLED
case ONION_HANDSHAKE_TYPE_NTOR:
- if (reply_len < NTOR_REPLY_LEN)
+ if (reply_len < NTOR_REPLY_LEN) {
+ log_warn(LD_CIRC, "ntor reply was not of the correct length.");
return -1;
+ }
{
size_t keys_tmp_len = keys_out_len + DIGEST_LEN;
uint8_t *keys_tmp = tor_malloc(keys_tmp_len);