diff options
author | irungentoo <irungentoo@gmail.com> | 2014-01-09 19:54:42 -0500 |
---|---|---|
committer | irungentoo <irungentoo@gmail.com> | 2014-01-09 19:54:42 -0500 |
commit | ea7d1a726d2145d11c210c217370c766cc6179e9 (patch) | |
tree | fae9fdf80ded77b16874e297f0a14ea1b1adaa43 /auto_tests/onion_test.c | |
parent | 0fd8e49c386e357487ab9d68f2a9aa1d8a2356e0 (diff) |
Putting the sendback outside the encrypted part of the response.
It's more useful this way.
Diffstat (limited to 'auto_tests/onion_test.c')
-rw-r--r-- | auto_tests/onion_test.c | 12 |
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; |