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/TCP_connection.c | |
parent | 7122d2e862e028a730478d88cd61557fbed16ebf (diff) |
Wrap all sodium/nacl functions in crypto_core.c.
Diffstat (limited to 'toxcore/TCP_connection.c')
-rw-r--r-- | toxcore/TCP_connection.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/toxcore/TCP_connection.c b/toxcore/TCP_connection.c index 234a8d79..e8f51273 100644 --- a/toxcore/TCP_connection.c +++ b/toxcore/TCP_connection.c | |||
@@ -33,8 +33,8 @@ | |||
33 | struct TCP_Connections { | 33 | struct TCP_Connections { |
34 | DHT *dht; | 34 | DHT *dht; |
35 | 35 | ||
36 | uint8_t self_public_key[crypto_box_PUBLICKEYBYTES]; | 36 | uint8_t self_public_key[CRYPTO_PUBLIC_KEY_SIZE]; |
37 | uint8_t self_secret_key[crypto_box_SECRETKEYBYTES]; | 37 | uint8_t self_secret_key[CRYPTO_SECRET_KEY_SIZE]; |
38 | 38 | ||
39 | TCP_Connection_to *connections; | 39 | TCP_Connection_to *connections; |
40 | uint32_t connections_length; /* Length of connections array. */ | 40 | uint32_t connections_length; /* Length of connections array. */ |
@@ -509,7 +509,7 @@ int new_tcp_connection_to(TCP_Connections *tcp_c, const uint8_t *public_key, int | |||
509 | TCP_Connection_to *con_to = &tcp_c->connections[connections_number]; | 509 | TCP_Connection_to *con_to = &tcp_c->connections[connections_number]; |
510 | 510 | ||
511 | con_to->status = TCP_CONN_VALID; | 511 | con_to->status = TCP_CONN_VALID; |
512 | memcpy(con_to->public_key, public_key, crypto_box_PUBLICKEYBYTES); | 512 | memcpy(con_to->public_key, public_key, CRYPTO_PUBLIC_KEY_SIZE); |
513 | con_to->id = id; | 513 | con_to->id = id; |
514 | 514 | ||
515 | return connections_number; | 515 | return connections_number; |
@@ -767,8 +767,8 @@ static int reconnect_tcp_relay_connection(TCP_Connections *tcp_c, int tcp_connec | |||
767 | } | 767 | } |
768 | 768 | ||
769 | IP_Port ip_port = tcp_con->connection->ip_port; | 769 | IP_Port ip_port = tcp_con->connection->ip_port; |
770 | uint8_t relay_pk[crypto_box_PUBLICKEYBYTES]; | 770 | uint8_t relay_pk[CRYPTO_PUBLIC_KEY_SIZE]; |
771 | memcpy(relay_pk, tcp_con->connection->public_key, crypto_box_PUBLICKEYBYTES); | 771 | memcpy(relay_pk, tcp_con->connection->public_key, CRYPTO_PUBLIC_KEY_SIZE); |
772 | kill_TCP_connection(tcp_con->connection); | 772 | kill_TCP_connection(tcp_con->connection); |
773 | tcp_con->connection = new_TCP_connection(ip_port, relay_pk, tcp_c->self_public_key, tcp_c->self_secret_key, | 773 | tcp_con->connection = new_TCP_connection(ip_port, relay_pk, tcp_c->self_public_key, tcp_c->self_secret_key, |
774 | &tcp_c->proxy_info); | 774 | &tcp_c->proxy_info); |
@@ -819,7 +819,7 @@ static int sleep_tcp_relay_connection(TCP_Connections *tcp_c, int tcp_connection | |||
819 | } | 819 | } |
820 | 820 | ||
821 | tcp_con->ip_port = tcp_con->connection->ip_port; | 821 | tcp_con->ip_port = tcp_con->connection->ip_port; |
822 | memcpy(tcp_con->relay_pk, tcp_con->connection->public_key, crypto_box_PUBLICKEYBYTES); | 822 | memcpy(tcp_con->relay_pk, tcp_con->connection->public_key, CRYPTO_PUBLIC_KEY_SIZE); |
823 | 823 | ||
824 | kill_TCP_connection(tcp_con->connection); | 824 | kill_TCP_connection(tcp_con->connection); |
825 | tcp_con->connection = NULL; | 825 | tcp_con->connection = NULL; |
@@ -1271,7 +1271,7 @@ unsigned int tcp_copy_connected_relays(TCP_Connections *tcp_c, Node_format *tcp_ | |||
1271 | } | 1271 | } |
1272 | 1272 | ||
1273 | if (tcp_con->status == TCP_CONN_CONNECTED) { | 1273 | if (tcp_con->status == TCP_CONN_CONNECTED) { |
1274 | memcpy(tcp_relays[copied].public_key, tcp_con->connection->public_key, crypto_box_PUBLICKEYBYTES); | 1274 | memcpy(tcp_relays[copied].public_key, tcp_con->connection->public_key, CRYPTO_PUBLIC_KEY_SIZE); |
1275 | tcp_relays[copied].ip_port = tcp_con->connection->ip_port; | 1275 | tcp_relays[copied].ip_port = tcp_con->connection->ip_port; |
1276 | 1276 | ||
1277 | if (tcp_relays[copied].ip_port.ip.family == AF_INET) { | 1277 | if (tcp_relays[copied].ip_port.ip.family == AF_INET) { |
@@ -1376,8 +1376,8 @@ TCP_Connections *new_tcp_connections(const uint8_t *secret_key, TCP_Proxy_Info * | |||
1376 | return NULL; | 1376 | return NULL; |
1377 | } | 1377 | } |
1378 | 1378 | ||
1379 | memcpy(temp->self_secret_key, secret_key, crypto_box_SECRETKEYBYTES); | 1379 | memcpy(temp->self_secret_key, secret_key, CRYPTO_SECRET_KEY_SIZE); |
1380 | crypto_scalarmult_curve25519_base(temp->self_public_key, temp->self_secret_key); | 1380 | crypto_derive_public_key(temp->self_public_key, temp->self_secret_key); |
1381 | temp->proxy_info = *proxy_info; | 1381 | temp->proxy_info = *proxy_info; |
1382 | 1382 | ||
1383 | return temp; | 1383 | return temp; |