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_announce.h | |
parent | 7122d2e862e028a730478d88cd61557fbed16ebf (diff) |
Wrap all sodium/nacl functions in crypto_core.c.
Diffstat (limited to 'toxcore/onion_announce.h')
-rw-r--r-- | toxcore/onion_announce.h | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/toxcore/onion_announce.h b/toxcore/onion_announce.h index a9128be8..821e0c15 100644 --- a/toxcore/onion_announce.h +++ b/toxcore/onion_announce.h | |||
@@ -27,29 +27,29 @@ | |||
27 | 27 | ||
28 | #define ONION_ANNOUNCE_MAX_ENTRIES 160 | 28 | #define ONION_ANNOUNCE_MAX_ENTRIES 160 |
29 | #define ONION_ANNOUNCE_TIMEOUT 300 | 29 | #define ONION_ANNOUNCE_TIMEOUT 300 |
30 | #define ONION_PING_ID_SIZE crypto_hash_sha256_BYTES | 30 | #define ONION_PING_ID_SIZE CRYPTO_SHA256_SIZE |
31 | 31 | ||
32 | #define ONION_ANNOUNCE_SENDBACK_DATA_LENGTH (sizeof(uint64_t)) | 32 | #define ONION_ANNOUNCE_SENDBACK_DATA_LENGTH (sizeof(uint64_t)) |
33 | 33 | ||
34 | #define ONION_ANNOUNCE_REQUEST_SIZE (1 + crypto_box_NONCEBYTES + crypto_box_PUBLICKEYBYTES + ONION_PING_ID_SIZE + crypto_box_PUBLICKEYBYTES + crypto_box_PUBLICKEYBYTES + ONION_ANNOUNCE_SENDBACK_DATA_LENGTH + crypto_box_MACBYTES) | 34 | #define ONION_ANNOUNCE_REQUEST_SIZE (1 + CRYPTO_NONCE_SIZE + CRYPTO_PUBLIC_KEY_SIZE + ONION_PING_ID_SIZE + CRYPTO_PUBLIC_KEY_SIZE + CRYPTO_PUBLIC_KEY_SIZE + ONION_ANNOUNCE_SENDBACK_DATA_LENGTH + CRYPTO_MAC_SIZE) |
35 | 35 | ||
36 | #define ONION_ANNOUNCE_RESPONSE_MIN_SIZE (1 + ONION_ANNOUNCE_SENDBACK_DATA_LENGTH + crypto_box_NONCEBYTES + 1 + ONION_PING_ID_SIZE + crypto_box_MACBYTES) | 36 | #define ONION_ANNOUNCE_RESPONSE_MIN_SIZE (1 + ONION_ANNOUNCE_SENDBACK_DATA_LENGTH + CRYPTO_NONCE_SIZE + 1 + ONION_PING_ID_SIZE + CRYPTO_MAC_SIZE) |
37 | #define ONION_ANNOUNCE_RESPONSE_MAX_SIZE (ONION_ANNOUNCE_RESPONSE_MIN_SIZE + sizeof(Node_format)*MAX_SENT_NODES) | 37 | #define ONION_ANNOUNCE_RESPONSE_MAX_SIZE (ONION_ANNOUNCE_RESPONSE_MIN_SIZE + sizeof(Node_format)*MAX_SENT_NODES) |
38 | 38 | ||
39 | #define ONION_DATA_RESPONSE_MIN_SIZE (1 + crypto_box_NONCEBYTES + crypto_box_PUBLICKEYBYTES + crypto_box_MACBYTES) | 39 | #define ONION_DATA_RESPONSE_MIN_SIZE (1 + CRYPTO_NONCE_SIZE + CRYPTO_PUBLIC_KEY_SIZE + CRYPTO_MAC_SIZE) |
40 | 40 | ||
41 | #if ONION_PING_ID_SIZE != crypto_box_PUBLICKEYBYTES | 41 | #if ONION_PING_ID_SIZE != CRYPTO_PUBLIC_KEY_SIZE |
42 | #error announce response packets assume that ONION_PING_ID_SIZE is equal to crypto_box_PUBLICKEYBYTES | 42 | #error announce response packets assume that ONION_PING_ID_SIZE is equal to CRYPTO_PUBLIC_KEY_SIZE |
43 | #endif | 43 | #endif |
44 | 44 | ||
45 | #define ONION_DATA_REQUEST_MIN_SIZE (1 + crypto_box_PUBLICKEYBYTES + crypto_box_NONCEBYTES + crypto_box_PUBLICKEYBYTES + crypto_box_MACBYTES) | 45 | #define ONION_DATA_REQUEST_MIN_SIZE (1 + CRYPTO_PUBLIC_KEY_SIZE + CRYPTO_NONCE_SIZE + CRYPTO_PUBLIC_KEY_SIZE + CRYPTO_MAC_SIZE) |
46 | #define MAX_DATA_REQUEST_SIZE (ONION_MAX_DATA_SIZE - ONION_DATA_REQUEST_MIN_SIZE) | 46 | #define MAX_DATA_REQUEST_SIZE (ONION_MAX_DATA_SIZE - ONION_DATA_REQUEST_MIN_SIZE) |
47 | 47 | ||
48 | typedef struct { | 48 | typedef struct { |
49 | uint8_t public_key[crypto_box_PUBLICKEYBYTES]; | 49 | uint8_t public_key[CRYPTO_PUBLIC_KEY_SIZE]; |
50 | IP_Port ret_ip_port; | 50 | IP_Port ret_ip_port; |
51 | uint8_t ret[ONION_RETURN_3]; | 51 | uint8_t ret[ONION_RETURN_3]; |
52 | uint8_t data_public_key[crypto_box_PUBLICKEYBYTES]; | 52 | uint8_t data_public_key[CRYPTO_PUBLIC_KEY_SIZE]; |
53 | uint64_t time; | 53 | uint64_t time; |
54 | } Onion_Announce_Entry; | 54 | } Onion_Announce_Entry; |
55 | 55 | ||
@@ -57,8 +57,8 @@ typedef struct { | |||
57 | DHT *dht; | 57 | DHT *dht; |
58 | Networking_Core *net; | 58 | Networking_Core *net; |
59 | Onion_Announce_Entry entries[ONION_ANNOUNCE_MAX_ENTRIES]; | 59 | Onion_Announce_Entry entries[ONION_ANNOUNCE_MAX_ENTRIES]; |
60 | /* This is crypto_box_KEYBYTES long just so we can use new_symmetric_key() to fill it */ | 60 | /* This is CRYPTO_SYMMETRIC_KEY_SIZE long just so we can use new_symmetric_key() to fill it */ |
61 | uint8_t secret_bytes[crypto_box_KEYBYTES]; | 61 | uint8_t secret_bytes[CRYPTO_SYMMETRIC_KEY_SIZE]; |
62 | 62 | ||
63 | Shared_Keys shared_keys_recv; | 63 | Shared_Keys shared_keys_recv; |
64 | } Onion_Announce; | 64 | } Onion_Announce; |