summaryrefslogtreecommitdiff
path: root/src/or/onion_ntor.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2015-02-02 16:31:32 -0500
committerNick Mathewson <nickm@torproject.org>2015-02-02 16:31:32 -0500
commitd03e1da232ada2e0d3a3de3dbf6885caec74e4e0 (patch)
treecd3fc872abd2f7fa80af365887a0ea87564199b8 /src/or/onion_ntor.c
parent3b96bf68315083f83a5f807ccf6f41feafeeb445 (diff)
parent41ba4f5627326e1745f0eea143f038677170c596 (diff)
downloadtor-d03e1da232ada2e0d3a3de3dbf6885caec74e4e0.tar.gz
tor-d03e1da232ada2e0d3a3de3dbf6885caec74e4e0.zip
Merge remote-tracking branch 'public/bug9635_warnings_025'
Conflicts: src/test/test.c
Diffstat (limited to 'src/or/onion_ntor.c')
-rw-r--r--src/or/onion_ntor.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/or/onion_ntor.c b/src/or/onion_ntor.c
index 7f58f4d758..539f06f61f 100644
--- a/src/or/onion_ntor.c
+++ b/src/or/onion_ntor.c
@@ -3,8 +3,8 @@
#include "orconfig.h"
-#include "crypto.h"
#define ONION_NTOR_PRIVATE
+#include "crypto.h"
#include "onion_ntor.h"
#include "torlog.h"
#include "util.h"
@@ -226,7 +226,8 @@ onion_skin_ntor_client_handshake(
const ntor_handshake_state_t *handshake_state,
const uint8_t *handshake_reply,
uint8_t *key_out,
- size_t key_out_len)
+ size_t key_out_len,
+ const char **msg_out)
{
const tweakset_t *T = &proto1_tweaks;
/* Sensitive stack-allocated material. Kept in an anonymous struct to make
@@ -292,7 +293,19 @@ onion_skin_ntor_client_handshake(
memwipe(&s, 0, sizeof(s));
if (bad) {
- log_warn(LD_PROTOCOL, "Invalid result from curve25519 handshake: %d", bad);
+ if (bad & 4) {
+ if (msg_out)
+ *msg_out = NULL; /* Don't report this one; we probably just had the
+ * wrong onion key.*/
+ log_fn(LOG_INFO, LD_PROTOCOL,
+ "Invalid result from curve25519 handshake: %d", bad);
+ }
+ if (bad & 3) {
+ if (msg_out)
+ *msg_out = "Zero output from curve25519 handshake";
+ log_fn(LOG_WARN, LD_PROTOCOL,
+ "Invalid result from curve25519 handshake: %d", bad);
+ }
}
return bad ? -1 : 0;