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 /other/bootstrap_daemon/src/tox-bootstrapd.c | |
parent | 7122d2e862e028a730478d88cd61557fbed16ebf (diff) |
Wrap all sodium/nacl functions in crypto_core.c.
Diffstat (limited to 'other/bootstrap_daemon/src/tox-bootstrapd.c')
-rw-r--r-- | other/bootstrap_daemon/src/tox-bootstrapd.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/other/bootstrap_daemon/src/tox-bootstrapd.c b/other/bootstrap_daemon/src/tox-bootstrapd.c index ce1ac5eb..4495f88e 100644 --- a/other/bootstrap_daemon/src/tox-bootstrapd.c +++ b/other/bootstrap_daemon/src/tox-bootstrapd.c | |||
@@ -57,7 +57,7 @@ | |||
57 | 57 | ||
58 | static int manage_keys(DHT *dht, char *keys_file_path) | 58 | static int manage_keys(DHT *dht, char *keys_file_path) |
59 | { | 59 | { |
60 | enum { KEYS_SIZE = crypto_box_PUBLICKEYBYTES + crypto_box_SECRETKEYBYTES }; | 60 | enum { KEYS_SIZE = CRYPTO_PUBLIC_KEY_SIZE + CRYPTO_SECRET_KEY_SIZE }; |
61 | uint8_t keys[KEYS_SIZE]; | 61 | uint8_t keys[KEYS_SIZE]; |
62 | FILE *keys_file; | 62 | FILE *keys_file; |
63 | 63 | ||
@@ -72,12 +72,12 @@ static int manage_keys(DHT *dht, char *keys_file_path) | |||
72 | return 0; | 72 | return 0; |
73 | } | 73 | } |
74 | 74 | ||
75 | memcpy(dht->self_public_key, keys, crypto_box_PUBLICKEYBYTES); | 75 | memcpy(dht->self_public_key, keys, CRYPTO_PUBLIC_KEY_SIZE); |
76 | memcpy(dht->self_secret_key, keys + crypto_box_PUBLICKEYBYTES, crypto_box_SECRETKEYBYTES); | 76 | memcpy(dht->self_secret_key, keys + CRYPTO_PUBLIC_KEY_SIZE, CRYPTO_SECRET_KEY_SIZE); |
77 | } else { | 77 | } else { |
78 | // Otherwise save new keys | 78 | // Otherwise save new keys |
79 | memcpy(keys, dht->self_public_key, crypto_box_PUBLICKEYBYTES); | 79 | memcpy(keys, dht->self_public_key, CRYPTO_PUBLIC_KEY_SIZE); |
80 | memcpy(keys + crypto_box_PUBLICKEYBYTES, dht->self_secret_key, crypto_box_SECRETKEYBYTES); | 80 | memcpy(keys + CRYPTO_PUBLIC_KEY_SIZE, dht->self_secret_key, CRYPTO_SECRET_KEY_SIZE); |
81 | 81 | ||
82 | keys_file = fopen(keys_file_path, "w"); | 82 | keys_file = fopen(keys_file_path, "w"); |
83 | 83 | ||
@@ -102,12 +102,12 @@ static int manage_keys(DHT *dht, char *keys_file_path) | |||
102 | 102 | ||
103 | static void print_public_key(const uint8_t *public_key) | 103 | static void print_public_key(const uint8_t *public_key) |
104 | { | 104 | { |
105 | char buffer[2 * crypto_box_PUBLICKEYBYTES + 1]; | 105 | char buffer[2 * CRYPTO_PUBLIC_KEY_SIZE + 1]; |
106 | int index = 0; | 106 | int index = 0; |
107 | 107 | ||
108 | size_t i; | 108 | size_t i; |
109 | 109 | ||
110 | for (i = 0; i < crypto_box_PUBLICKEYBYTES; i++) { | 110 | for (i = 0; i < CRYPTO_PUBLIC_KEY_SIZE; i++) { |
111 | index += sprintf(buffer + index, "%02hhX", public_key[i]); | 111 | index += sprintf(buffer + index, "%02hhX", public_key[i]); |
112 | } | 112 | } |
113 | 113 | ||