diff options
author | irungentoo <irungentoo@gmail.com> | 2014-04-22 20:28:40 -0400 |
---|---|---|
committer | irungentoo <irungentoo@gmail.com> | 2014-04-22 20:28:40 -0400 |
commit | 1bfe15ee88844bdbd43052b4026202cf924ad6ca (patch) | |
tree | a740f16199cf0a263447e2084dd8906028a7b268 /toxcore/TCP_client.c | |
parent | c46ab5821d0fa8c604de52e15009e2b8da5d9c07 (diff) |
Decided pretty much how the handshake would work.
Started writing the code.
Astyled some files.
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 825d762c..3745e14d 100644 --- a/toxcore/TCP_client.c +++ b/toxcore/TCP_client.c | |||
@@ -75,7 +75,7 @@ static int generate_handshake(TCP_Client_Connection *TCP_conn, uint8_t *self_pub | |||
75 | memcpy(TCP_conn->last_packet, self_public_key, crypto_box_PUBLICKEYBYTES); | 75 | memcpy(TCP_conn->last_packet, self_public_key, crypto_box_PUBLICKEYBYTES); |
76 | new_nonce(TCP_conn->last_packet + crypto_box_PUBLICKEYBYTES); | 76 | new_nonce(TCP_conn->last_packet + crypto_box_PUBLICKEYBYTES); |
77 | int len = encrypt_data_symmetric(TCP_conn->shared_key, TCP_conn->last_packet + crypto_box_PUBLICKEYBYTES, plain, | 77 | int len = encrypt_data_symmetric(TCP_conn->shared_key, TCP_conn->last_packet + crypto_box_PUBLICKEYBYTES, plain, |
78 | sizeof(plain), TCP_conn->last_packet + crypto_box_PUBLICKEYBYTES + crypto_box_NONCEBYTES); | 78 | sizeof(plain), TCP_conn->last_packet + crypto_box_PUBLICKEYBYTES + crypto_box_NONCEBYTES); |
79 | 79 | ||
80 | if (len != sizeof(plain) + crypto_box_MACBYTES) | 80 | if (len != sizeof(plain) + crypto_box_MACBYTES) |
81 | return -1; | 81 | return -1; |
@@ -94,7 +94,7 @@ static int handle_handshake(TCP_Client_Connection *TCP_conn, uint8_t *data) | |||
94 | { | 94 | { |
95 | uint8_t plain[crypto_box_PUBLICKEYBYTES + crypto_box_NONCEBYTES]; | 95 | uint8_t plain[crypto_box_PUBLICKEYBYTES + crypto_box_NONCEBYTES]; |
96 | int len = decrypt_data_symmetric(TCP_conn->shared_key, data, data + crypto_box_NONCEBYTES, | 96 | int len = decrypt_data_symmetric(TCP_conn->shared_key, data, data + crypto_box_NONCEBYTES, |
97 | TCP_SERVER_HANDSHAKE_SIZE - crypto_box_NONCEBYTES, plain); | 97 | TCP_SERVER_HANDSHAKE_SIZE - crypto_box_NONCEBYTES, plain); |
98 | 98 | ||
99 | if (len != sizeof(plain)) | 99 | if (len != sizeof(plain)) |
100 | return -1; | 100 | return -1; |