diff options
author | Roman Proskuryakov <humbug@deeptown.org> | 2016-01-24 05:55:25 +0300 |
---|---|---|
committer | Roman Proskuryakov <humbug@deeptown.org> | 2016-01-27 02:17:40 +0300 |
commit | 23b0c9cdedae01b09055a0476823e225680d3930 (patch) | |
tree | 065896349a6d6aa9aa6a2240aa746daf38d4545c /toxcore/TCP_client.c | |
parent | 7d66c700374c3f5d772a439b6706bf455c703fea (diff) |
fix: replace memset with sodium_memzero for sensitive data
Diffstat (limited to 'toxcore/TCP_client.c')
-rw-r--r-- | toxcore/TCP_client.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/toxcore/TCP_client.c b/toxcore/TCP_client.c index e2110ad8..752deecf 100644 --- a/toxcore/TCP_client.c +++ b/toxcore/TCP_client.c | |||
@@ -251,7 +251,7 @@ static int handle_handshake(TCP_Client_Connection *TCP_conn, const uint8_t *data | |||
251 | 251 | ||
252 | memcpy(TCP_conn->recv_nonce, plain + crypto_box_PUBLICKEYBYTES, crypto_box_NONCEBYTES); | 252 | memcpy(TCP_conn->recv_nonce, plain + crypto_box_PUBLICKEYBYTES, crypto_box_NONCEBYTES); |
253 | encrypt_precompute(plain, TCP_conn->temp_secret_key, TCP_conn->shared_key); | 253 | encrypt_precompute(plain, TCP_conn->temp_secret_key, TCP_conn->shared_key); |
254 | memset(TCP_conn->temp_secret_key, 0, crypto_box_SECRETKEYBYTES); | 254 | sodium_memzero(TCP_conn->temp_secret_key, crypto_box_SECRETKEYBYTES); |
255 | return 0; | 255 | return 0; |
256 | } | 256 | } |
257 | 257 | ||
@@ -962,6 +962,6 @@ void kill_TCP_connection(TCP_Client_Connection *TCP_connection) | |||
962 | 962 | ||
963 | wipe_priority_list(TCP_connection); | 963 | wipe_priority_list(TCP_connection); |
964 | kill_sock(TCP_connection->sock); | 964 | kill_sock(TCP_connection->sock); |
965 | memset(TCP_connection, 0, sizeof(TCP_Client_Connection)); | 965 | sodium_memzero(TCP_connection, sizeof(TCP_Client_Connection)); |
966 | free(TCP_connection); | 966 | free(TCP_connection); |
967 | } | 967 | } |