summaryrefslogtreecommitdiff
path: root/auto_tests/TCP_test.c
diff options
context:
space:
mode:
authoriphydf <iphydf@users.noreply.github.com>2016-11-06 15:14:02 +0000
committeriphydf <iphydf@users.noreply.github.com>2016-11-09 22:30:49 +0000
commitaed24408db9cd8afe632a1d3f056669ae34f49be (patch)
tree77cb037490b3f97af949eb39dfdf2e1e513b61d1 /auto_tests/TCP_test.c
parent42dfdf73c1dfd899a4f5a44ea1584aaf3a4ed3d2 (diff)
Remove new_nonce function in favour of random_nonce.
`new_nonce` has been an alias for `random_nonce` for a while now. Having two names for the same operation is confusing. `random_nonce` better expresses the intent. The documentation for `new_nonce` talks about guaranteeing that the nonce is different from previous ones, which is incorrect, it's just quite likely to be different.
Diffstat (limited to 'auto_tests/TCP_test.c')
-rw-r--r--auto_tests/TCP_test.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/auto_tests/TCP_test.c b/auto_tests/TCP_test.c
index 77327299..4fdb8a88 100644
--- a/auto_tests/TCP_test.c
+++ b/auto_tests/TCP_test.c
@@ -57,7 +57,7 @@ START_TEST(test_basic)
57 memcpy(handshake_plain + crypto_box_PUBLICKEYBYTES, f_nonce, crypto_box_NONCEBYTES); 57 memcpy(handshake_plain + crypto_box_PUBLICKEYBYTES, f_nonce, crypto_box_NONCEBYTES);
58 uint8_t handshake[TCP_CLIENT_HANDSHAKE_SIZE]; 58 uint8_t handshake[TCP_CLIENT_HANDSHAKE_SIZE];
59 memcpy(handshake, f_public_key, crypto_box_PUBLICKEYBYTES); 59 memcpy(handshake, f_public_key, crypto_box_PUBLICKEYBYTES);
60 new_nonce(handshake + crypto_box_PUBLICKEYBYTES); 60 random_nonce(handshake + crypto_box_PUBLICKEYBYTES);
61 61
62 ret = encrypt_data(self_public_key, f_secret_key, handshake + crypto_box_PUBLICKEYBYTES, handshake_plain, 62 ret = encrypt_data(self_public_key, f_secret_key, handshake + crypto_box_PUBLICKEYBYTES, handshake_plain,
63 TCP_HANDSHAKE_PLAIN_SIZE, handshake + crypto_box_PUBLICKEYBYTES + crypto_box_NONCEBYTES); 63 TCP_HANDSHAKE_PLAIN_SIZE, handshake + crypto_box_PUBLICKEYBYTES + crypto_box_NONCEBYTES);
@@ -153,7 +153,7 @@ static struct sec_TCP_con *new_TCP_con(TCP_Server *tcp_s)
153 memcpy(handshake_plain + crypto_box_PUBLICKEYBYTES, sec_c->sent_nonce, crypto_box_NONCEBYTES); 153 memcpy(handshake_plain + crypto_box_PUBLICKEYBYTES, sec_c->sent_nonce, crypto_box_NONCEBYTES);
154 uint8_t handshake[TCP_CLIENT_HANDSHAKE_SIZE]; 154 uint8_t handshake[TCP_CLIENT_HANDSHAKE_SIZE];
155 memcpy(handshake, sec_c->public_key, crypto_box_PUBLICKEYBYTES); 155 memcpy(handshake, sec_c->public_key, crypto_box_PUBLICKEYBYTES);
156 new_nonce(handshake + crypto_box_PUBLICKEYBYTES); 156 random_nonce(handshake + crypto_box_PUBLICKEYBYTES);
157 157
158 ret = encrypt_data(tcp_server_public_key(tcp_s), f_secret_key, handshake + crypto_box_PUBLICKEYBYTES, handshake_plain, 158 ret = encrypt_data(tcp_server_public_key(tcp_s), f_secret_key, handshake + crypto_box_PUBLICKEYBYTES, handshake_plain,
159 TCP_HANDSHAKE_PLAIN_SIZE, handshake + crypto_box_PUBLICKEYBYTES + crypto_box_NONCEBYTES); 159 TCP_HANDSHAKE_PLAIN_SIZE, handshake + crypto_box_PUBLICKEYBYTES + crypto_box_NONCEBYTES);