diff options
author | Roman Proskuryakov <humbug@deeptown.org> | 2016-01-24 19:16:40 +0300 |
---|---|---|
committer | Roman Proskuryakov <humbug@deeptown.org> | 2016-01-27 02:14:59 +0300 |
commit | ed3a794c9bf6380801ee21c816505f457b6a1348 (patch) | |
tree | 14e1b8fa1c8c1b7f45b08bae5e0b6169054c3751 /toxcore/TCP_connection.c | |
parent | 61f8e65c0157049ac26bf9b081ba6842d7defdeb (diff) |
fix: compare sensitive data with sodium_memcmp
fix: make increment_nonce & increment_nonce_number independent of user-controlled input
fix: make crypto_core more stable agains null ptr dereference
Diffstat (limited to 'toxcore/TCP_connection.c')
-rw-r--r-- | toxcore/TCP_connection.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/toxcore/TCP_connection.c b/toxcore/TCP_connection.c index 5f38b5dd..027779dd 100644 --- a/toxcore/TCP_connection.c +++ b/toxcore/TCP_connection.c | |||
@@ -384,7 +384,7 @@ static int find_tcp_connection_to(TCP_Connections *tcp_c, const uint8_t *public_ | |||
384 | TCP_Connection_to *con_to = get_connection(tcp_c, i); | 384 | TCP_Connection_to *con_to = get_connection(tcp_c, i); |
385 | 385 | ||
386 | if (con_to) { | 386 | if (con_to) { |
387 | if (memcmp(con_to->public_key, public_key, crypto_box_PUBLICKEYBYTES) == 0) { | 387 | if (public_key_cmp(con_to->public_key, public_key) == 0) { |
388 | return i; | 388 | return i; |
389 | } | 389 | } |
390 | } | 390 | } |
@@ -407,11 +407,11 @@ static int find_tcp_connection_relay(TCP_Connections *tcp_c, const uint8_t *rela | |||
407 | 407 | ||
408 | if (tcp_con) { | 408 | if (tcp_con) { |
409 | if (tcp_con->status == TCP_CONN_SLEEPING) { | 409 | if (tcp_con->status == TCP_CONN_SLEEPING) { |
410 | if (memcmp(tcp_con->relay_pk, relay_pk, crypto_box_PUBLICKEYBYTES) == 0) { | 410 | if (public_key_cmp(tcp_con->relay_pk, relay_pk) == 0) { |
411 | return i; | 411 | return i; |
412 | } | 412 | } |
413 | } else { | 413 | } else { |
414 | if (memcmp(tcp_con->connection->public_key, relay_pk, crypto_box_PUBLICKEYBYTES) == 0) { | 414 | if (public_key_cmp(tcp_con->connection->public_key, relay_pk) == 0) { |
415 | return i; | 415 | return i; |
416 | } | 416 | } |
417 | } | 417 | } |