@@ -111,13 +111,13 @@ static void test_basic(void)
111
111
free (handshake_plain );
112
112
113
113
// Sending the handshake
114
- ck_assert_msg (net_send (ns , mem , logger , sock , handshake , TCP_CLIENT_HANDSHAKE_SIZE - 1 ,
114
+ ck_assert_msg (net_send (ns , logger , sock , handshake , TCP_CLIENT_HANDSHAKE_SIZE - 1 ,
115
115
& localhost , nullptr ) == TCP_CLIENT_HANDSHAKE_SIZE - 1 ,
116
116
"An attempt to send the initial handshake minus last byte failed." );
117
117
118
118
do_tcp_server_delay (tcp_s , mono_time , 50 );
119
119
120
- ck_assert_msg (net_send (ns , mem , logger , sock , handshake + (TCP_CLIENT_HANDSHAKE_SIZE - 1 ), 1 , & localhost , nullptr ) == 1 ,
120
+ ck_assert_msg (net_send (ns , logger , sock , handshake + (TCP_CLIENT_HANDSHAKE_SIZE - 1 ), 1 , & localhost , nullptr ) == 1 ,
121
121
"The attempt to send the last byte of handshake failed." );
122
122
123
123
free (handshake );
@@ -127,7 +127,7 @@ static void test_basic(void)
127
127
// Receiving server response and decrypting it
128
128
uint8_t response [TCP_SERVER_HANDSHAKE_SIZE ];
129
129
uint8_t response_plain [TCP_HANDSHAKE_PLAIN_SIZE ];
130
- ck_assert_msg (net_recv (ns , mem , logger , sock , response , TCP_SERVER_HANDSHAKE_SIZE , & localhost ) == TCP_SERVER_HANDSHAKE_SIZE ,
130
+ ck_assert_msg (net_recv (ns , logger , sock , response , TCP_SERVER_HANDSHAKE_SIZE , & localhost ) == TCP_SERVER_HANDSHAKE_SIZE ,
131
131
"Could/did not receive a server response to the initial handshake." );
132
132
ret = decrypt_data (mem , self_public_key , f_secret_key , response , response + CRYPTO_NONCE_SIZE ,
133
133
TCP_SERVER_HANDSHAKE_SIZE - CRYPTO_NONCE_SIZE , response_plain );
@@ -156,7 +156,7 @@ static void test_basic(void)
156
156
msg_length = sizeof (r_req ) - i ;
157
157
}
158
158
159
- ck_assert_msg (net_send (ns , mem , logger , sock , r_req + i , msg_length , & localhost , nullptr ) == msg_length ,
159
+ ck_assert_msg (net_send (ns , logger , sock , r_req + i , msg_length , & localhost , nullptr ) == msg_length ,
160
160
"Failed to send request after completing the handshake." );
161
161
i += msg_length ;
162
162
@@ -169,7 +169,7 @@ static void test_basic(void)
169
169
const size_t max_packet_size = 4096 ;
170
170
uint8_t * packet_resp = (uint8_t * )malloc (max_packet_size );
171
171
ck_assert (packet_resp != nullptr );
172
- int recv_data_len = net_recv (ns , mem , logger , sock , packet_resp , 2 + 2 + CRYPTO_PUBLIC_KEY_SIZE + CRYPTO_MAC_SIZE , & localhost );
172
+ int recv_data_len = net_recv (ns , logger , sock , packet_resp , 2 + 2 + CRYPTO_PUBLIC_KEY_SIZE + CRYPTO_MAC_SIZE , & localhost );
173
173
ck_assert_msg (recv_data_len == 2 + 2 + CRYPTO_PUBLIC_KEY_SIZE + CRYPTO_MAC_SIZE ,
174
174
"Failed to receive server response to request. %d" , recv_data_len );
175
175
memcpy (& size , packet_resp , 2 );
@@ -241,20 +241,20 @@ static struct sec_TCP_con *new_tcp_con(const Logger *logger, const Memory *mem,
241
241
ck_assert_msg (ret == TCP_CLIENT_HANDSHAKE_SIZE - (CRYPTO_PUBLIC_KEY_SIZE + CRYPTO_NONCE_SIZE ),
242
242
"Failed to encrypt the outgoing handshake." );
243
243
244
- ck_assert_msg (net_send (ns , mem , logger , sock , handshake , TCP_CLIENT_HANDSHAKE_SIZE - 1 ,
244
+ ck_assert_msg (net_send (ns , logger , sock , handshake , TCP_CLIENT_HANDSHAKE_SIZE - 1 ,
245
245
& localhost , nullptr ) == TCP_CLIENT_HANDSHAKE_SIZE - 1 ,
246
246
"Failed to send the first portion of the handshake to the TCP relay server." );
247
247
248
248
do_tcp_server_delay (tcp_s , mono_time , 50 );
249
249
250
- ck_assert_msg (net_send (ns , mem , logger , sock , handshake + (TCP_CLIENT_HANDSHAKE_SIZE - 1 ), 1 , & localhost , nullptr ) == 1 ,
250
+ ck_assert_msg (net_send (ns , logger , sock , handshake + (TCP_CLIENT_HANDSHAKE_SIZE - 1 ), 1 , & localhost , nullptr ) == 1 ,
251
251
"Failed to send last byte of handshake." );
252
252
253
253
do_tcp_server_delay (tcp_s , mono_time , 50 );
254
254
255
255
uint8_t response [TCP_SERVER_HANDSHAKE_SIZE ];
256
256
uint8_t response_plain [TCP_HANDSHAKE_PLAIN_SIZE ];
257
- ck_assert_msg (net_recv (sec_c -> ns , mem , logger , sock , response , TCP_SERVER_HANDSHAKE_SIZE , & localhost ) == TCP_SERVER_HANDSHAKE_SIZE ,
257
+ ck_assert_msg (net_recv (sec_c -> ns , logger , sock , response , TCP_SERVER_HANDSHAKE_SIZE , & localhost ) == TCP_SERVER_HANDSHAKE_SIZE ,
258
258
"Failed to receive server handshake response." );
259
259
ret = decrypt_data (mem , tcp_server_public_key (tcp_s ), f_secret_key , response , response + CRYPTO_NONCE_SIZE ,
260
260
TCP_SERVER_HANDSHAKE_SIZE - CRYPTO_NONCE_SIZE , response_plain );
@@ -291,7 +291,7 @@ static int write_packet_tcp_test_connection(const Logger *logger, const Memory *
291
291
localhost .ip = get_loopback ();
292
292
localhost .port = 0 ;
293
293
294
- ck_assert_msg (net_send (con -> ns , mem , logger , con -> sock , packet , packet_size , & localhost , nullptr ) == packet_size ,
294
+ ck_assert_msg (net_send (con -> ns , logger , con -> sock , packet , packet_size , & localhost , nullptr ) == packet_size ,
295
295
"Failed to send a packet." );
296
296
return 0 ;
297
297
}
@@ -302,7 +302,7 @@ static int read_packet_sec_tcp(const Logger *logger, struct sec_TCP_con *con, ui
302
302
localhost .ip = get_loopback ();
303
303
localhost .port = 0 ;
304
304
305
- int rlen = net_recv (con -> ns , con -> mem , logger , con -> sock , data , length , & localhost );
305
+ int rlen = net_recv (con -> ns , logger , con -> sock , data , length , & localhost );
306
306
ck_assert_msg (rlen == length , "Did not receive packet of correct length. Wanted %i, instead got %i" , length , rlen );
307
307
rlen = decrypt_data_symmetric (con -> mem , con -> shared_key , con -> recv_nonce , data + 2 , length - 2 , data );
308
308
ck_assert_msg (rlen != -1 , "Failed to decrypt a received packet from the Relay server." );
0 commit comments