summaryrefslogtreecommitdiff
path: root/auto_tests/onion_test.c
diff options
context:
space:
mode:
Diffstat (limited to 'auto_tests/onion_test.c')
-rw-r--r--auto_tests/onion_test.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/auto_tests/onion_test.c b/auto_tests/onion_test.c
index 234e8aa5..1f175134 100644
--- a/auto_tests/onion_test.c
+++ b/auto_tests/onion_test.c
@@ -77,18 +77,20 @@ static int handle_test_3(void *object, IP_Port source, uint8_t *packet, uint32_t
77 crypto_box_MACBYTES)) 77 crypto_box_MACBYTES))
78 return 1; 78 return 1;
79 79
80 uint8_t plain[ONION_ANNOUNCE_SENDBACK_DATA_LENGTH + crypto_hash_sha256_BYTES]; 80 uint8_t plain[crypto_hash_sha256_BYTES];
81 //print_client_id(packet, length); 81 //print_client_id(packet, length);
82 int len = decrypt_data(test_3_pub_key, onion->dht->c->self_secret_key, packet + 1, packet + 1 + crypto_box_NONCEBYTES, 82 int len = decrypt_data(test_3_pub_key, onion->dht->c->self_secret_key, packet + 1 + ONION_ANNOUNCE_SENDBACK_DATA_LENGTH,
83 ONION_ANNOUNCE_SENDBACK_DATA_LENGTH + crypto_hash_sha256_BYTES + crypto_box_MACBYTES, plain); 83 packet + 1 + ONION_ANNOUNCE_SENDBACK_DATA_LENGTH + crypto_box_NONCEBYTES,
84 crypto_hash_sha256_BYTES + crypto_box_MACBYTES, plain);
84 85
85 if (len == -1) 86 if (len == -1)
86 return 1; 87 return 1;
87 88
88 if (memcmp(plain, sb_data, ONION_ANNOUNCE_SENDBACK_DATA_LENGTH) != 0) 89
90 if (memcmp(packet + 1, sb_data, ONION_ANNOUNCE_SENDBACK_DATA_LENGTH) != 0)
89 return 1; 91 return 1;
90 92
91 memcpy(test_3_ping_id, plain + ONION_ANNOUNCE_SENDBACK_DATA_LENGTH, crypto_hash_sha256_BYTES); 93 memcpy(test_3_ping_id, plain, crypto_hash_sha256_BYTES);
92 //print_client_id(test_3_ping_id, sizeof(test_3_ping_id)); 94 //print_client_id(test_3_ping_id, sizeof(test_3_ping_id));
93 handled_test_3 = 1; 95 handled_test_3 = 1;
94 return 0; 96 return 0;