diff options
author | iphydf <iphydf@users.noreply.github.com> | 2016-12-19 02:47:42 +0000 |
---|---|---|
committer | iphydf <iphydf@users.noreply.github.com> | 2016-12-22 10:26:59 +0000 |
commit | ce29c8e7ec91d95167b2dea3aee9fd1ae1aac254 (patch) | |
tree | a288df55c44e8edf816e6abbde19a70faef73394 /toxcore/onion.h | |
parent | 7122d2e862e028a730478d88cd61557fbed16ebf (diff) |
Wrap all sodium/nacl functions in crypto_core.c.
Diffstat (limited to 'toxcore/onion.h')
-rw-r--r-- | toxcore/onion.h | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/toxcore/onion.h b/toxcore/onion.h index 2b270ea9..0c2dcc04 100644 --- a/toxcore/onion.h +++ b/toxcore/onion.h | |||
@@ -28,7 +28,7 @@ | |||
28 | typedef struct { | 28 | typedef struct { |
29 | DHT *dht; | 29 | DHT *dht; |
30 | Networking_Core *net; | 30 | Networking_Core *net; |
31 | uint8_t secret_symmetric_key[crypto_box_KEYBYTES]; | 31 | uint8_t secret_symmetric_key[CRYPTO_SYMMETRIC_KEY_SIZE]; |
32 | uint64_t timestamp; | 32 | uint64_t timestamp; |
33 | 33 | ||
34 | Shared_Keys shared_keys_1; | 34 | Shared_Keys shared_keys_1; |
@@ -41,14 +41,14 @@ typedef struct { | |||
41 | 41 | ||
42 | #define ONION_MAX_PACKET_SIZE 1400 | 42 | #define ONION_MAX_PACKET_SIZE 1400 |
43 | 43 | ||
44 | #define ONION_RETURN_1 (crypto_box_NONCEBYTES + SIZE_IPPORT + crypto_box_MACBYTES) | 44 | #define ONION_RETURN_1 (CRYPTO_NONCE_SIZE + SIZE_IPPORT + CRYPTO_MAC_SIZE) |
45 | #define ONION_RETURN_2 (crypto_box_NONCEBYTES + SIZE_IPPORT + crypto_box_MACBYTES + ONION_RETURN_1) | 45 | #define ONION_RETURN_2 (CRYPTO_NONCE_SIZE + SIZE_IPPORT + CRYPTO_MAC_SIZE + ONION_RETURN_1) |
46 | #define ONION_RETURN_3 (crypto_box_NONCEBYTES + SIZE_IPPORT + crypto_box_MACBYTES + ONION_RETURN_2) | 46 | #define ONION_RETURN_3 (CRYPTO_NONCE_SIZE + SIZE_IPPORT + CRYPTO_MAC_SIZE + ONION_RETURN_2) |
47 | 47 | ||
48 | #define ONION_SEND_BASE (crypto_box_PUBLICKEYBYTES + SIZE_IPPORT + crypto_box_MACBYTES) | 48 | #define ONION_SEND_BASE (CRYPTO_PUBLIC_KEY_SIZE + SIZE_IPPORT + CRYPTO_MAC_SIZE) |
49 | #define ONION_SEND_3 (crypto_box_NONCEBYTES + ONION_SEND_BASE + ONION_RETURN_2) | 49 | #define ONION_SEND_3 (CRYPTO_NONCE_SIZE + ONION_SEND_BASE + ONION_RETURN_2) |
50 | #define ONION_SEND_2 (crypto_box_NONCEBYTES + ONION_SEND_BASE*2 + ONION_RETURN_1) | 50 | #define ONION_SEND_2 (CRYPTO_NONCE_SIZE + ONION_SEND_BASE*2 + ONION_RETURN_1) |
51 | #define ONION_SEND_1 (crypto_box_NONCEBYTES + ONION_SEND_BASE*3) | 51 | #define ONION_SEND_1 (CRYPTO_NONCE_SIZE + ONION_SEND_BASE*3) |
52 | 52 | ||
53 | #define ONION_MAX_DATA_SIZE (ONION_MAX_PACKET_SIZE - (ONION_SEND_1 + 1)) | 53 | #define ONION_MAX_DATA_SIZE (ONION_MAX_PACKET_SIZE - (ONION_SEND_1 + 1)) |
54 | #define ONION_RESPONSE_MAX_DATA_SIZE (ONION_MAX_PACKET_SIZE - (1 + ONION_RETURN_3)) | 54 | #define ONION_RESPONSE_MAX_DATA_SIZE (ONION_MAX_PACKET_SIZE - (1 + ONION_RETURN_3)) |
@@ -56,22 +56,22 @@ typedef struct { | |||
56 | #define ONION_PATH_LENGTH 3 | 56 | #define ONION_PATH_LENGTH 3 |
57 | 57 | ||
58 | typedef struct { | 58 | typedef struct { |
59 | uint8_t shared_key1[crypto_box_BEFORENMBYTES]; | 59 | uint8_t shared_key1[CRYPTO_SHARED_KEY_SIZE]; |
60 | uint8_t shared_key2[crypto_box_BEFORENMBYTES]; | 60 | uint8_t shared_key2[CRYPTO_SHARED_KEY_SIZE]; |
61 | uint8_t shared_key3[crypto_box_BEFORENMBYTES]; | 61 | uint8_t shared_key3[CRYPTO_SHARED_KEY_SIZE]; |
62 | 62 | ||
63 | uint8_t public_key1[crypto_box_PUBLICKEYBYTES]; | 63 | uint8_t public_key1[CRYPTO_PUBLIC_KEY_SIZE]; |
64 | uint8_t public_key2[crypto_box_PUBLICKEYBYTES]; | 64 | uint8_t public_key2[CRYPTO_PUBLIC_KEY_SIZE]; |
65 | uint8_t public_key3[crypto_box_PUBLICKEYBYTES]; | 65 | uint8_t public_key3[CRYPTO_PUBLIC_KEY_SIZE]; |
66 | 66 | ||
67 | IP_Port ip_port1; | 67 | IP_Port ip_port1; |
68 | uint8_t node_public_key1[crypto_box_PUBLICKEYBYTES]; | 68 | uint8_t node_public_key1[CRYPTO_PUBLIC_KEY_SIZE]; |
69 | 69 | ||
70 | IP_Port ip_port2; | 70 | IP_Port ip_port2; |
71 | uint8_t node_public_key2[crypto_box_PUBLICKEYBYTES]; | 71 | uint8_t node_public_key2[CRYPTO_PUBLIC_KEY_SIZE]; |
72 | 72 | ||
73 | IP_Port ip_port3; | 73 | IP_Port ip_port3; |
74 | uint8_t node_public_key3[crypto_box_PUBLICKEYBYTES]; | 74 | uint8_t node_public_key3[CRYPTO_PUBLIC_KEY_SIZE]; |
75 | 75 | ||
76 | uint32_t path_num; | 76 | uint32_t path_num; |
77 | } Onion_Path; | 77 | } Onion_Path; |