summaryrefslogtreecommitdiff
path: root/toxcore/onion.h
diff options
context:
space:
mode:
Diffstat (limited to 'toxcore/onion.h')
-rw-r--r--toxcore/onion.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/toxcore/onion.h b/toxcore/onion.h
index 637692eb..8a972e17 100644
--- a/toxcore/onion.h
+++ b/toxcore/onion.h
@@ -28,6 +28,16 @@ typedef struct {
28 uint8_t secret_symmetric_key[crypto_secretbox_KEYBYTES]; 28 uint8_t secret_symmetric_key[crypto_secretbox_KEYBYTES];
29} Onion; 29} Onion;
30 30
31#define ONION_RETURN_1 (crypto_secretbox_NONCEBYTES + sizeof(IP_Port) + crypto_secretbox_MACBYTES)
32#define ONION_RETURN_2 (crypto_secretbox_NONCEBYTES + sizeof(IP_Port) + crypto_secretbox_MACBYTES + ONION_RETURN_1)
33#define ONION_RETURN_3 (crypto_secretbox_NONCEBYTES + sizeof(IP_Port) + crypto_secretbox_MACBYTES + ONION_RETURN_2)
34
35#define ONION_SEND_BASE (crypto_box_PUBLICKEYBYTES + sizeof(IP_Port) + crypto_box_MACBYTES)
36#define ONION_SEND_3 (crypto_box_NONCEBYTES + ONION_SEND_BASE + ONION_RETURN_2)
37#define ONION_SEND_2 (crypto_box_NONCEBYTES + ONION_SEND_BASE*2 + ONION_RETURN_1)
38#define ONION_SEND_1 (crypto_box_NONCEBYTES + ONION_SEND_BASE*3)
39
40
31/* Create and send a onion packet. 41/* Create and send a onion packet.
32 * 42 *
33 * nodes is a list of 4 nodes, the packet will route through nodes 0, 1, 2 and the data 43 * nodes is a list of 4 nodes, the packet will route through nodes 0, 1, 2 and the data