@@ -117,7 +117,7 @@ START_TEST(test_basic)
117117 increment_nonce (f_nonce_r );
118118 ck_assert_msg (packet_resp_plain [0 ] == 1 , "wrong packet id %u" , packet_resp_plain [0 ]);
119119 ck_assert_msg (packet_resp_plain [1 ] == 0 , "connection not refused %u" , packet_resp_plain [1 ]);
120- ck_assert_msg (memcmp (packet_resp_plain + 2 , f_public_key , crypto_box_PUBLICKEYBYTES ) == 0 , "key in packet wrong" );
120+ ck_assert_msg (public_key_cmp (packet_resp_plain + 2 , f_public_key ) == 0 , "key in packet wrong" );
121121 kill_TCP_server (tcp_s );
122122}
123123END_TEST
@@ -235,12 +235,12 @@ START_TEST(test_some)
235235 ck_assert_msg (len == 1 + 1 + crypto_box_PUBLICKEYBYTES , "wrong len %u" , len );
236236 ck_assert_msg (data [0 ] == 1 , "wrong packet id %u" , data [0 ]);
237237 ck_assert_msg (data [1 ] == 16 , "connection not refused %u" , data [1 ]);
238- ck_assert_msg (memcmp (data + 2 , con3 -> public_key , crypto_box_PUBLICKEYBYTES ) == 0 , "key in packet wrong" );
238+ ck_assert_msg (public_key_cmp (data + 2 , con3 -> public_key ) == 0 , "key in packet wrong" );
239239 len = read_packet_sec_TCP (con3 , data , 2 + 1 + 1 + crypto_box_PUBLICKEYBYTES + crypto_box_MACBYTES );
240240 ck_assert_msg (len == 1 + 1 + crypto_box_PUBLICKEYBYTES , "wrong len %u" , len );
241241 ck_assert_msg (data [0 ] == 1 , "wrong packet id %u" , data [0 ]);
242242 ck_assert_msg (data [1 ] == 16 , "connection not refused %u" , data [1 ]);
243- ck_assert_msg (memcmp (data + 2 , con1 -> public_key , crypto_box_PUBLICKEYBYTES ) == 0 , "key in packet wrong" );
243+ ck_assert_msg (public_key_cmp (data + 2 , con1 -> public_key ) == 0 , "key in packet wrong" );
244244
245245 uint8_t test_packet [512 ] = {16 , 17 , 16 , 86 , 99 , 127 , 255 , 189 , 78 };
246246 write_packet_TCP_secure_connection (con3 , test_packet , sizeof (test_packet ));
@@ -363,7 +363,7 @@ static int oob_data_callback(void *object, const uint8_t *public_key, const uint
363363 if (length != 5 )
364364 return 1 ;
365365
366- if (memcmp (public_key , oob_pubkey , crypto_box_PUBLICKEYBYTES ) != 0 )
366+ if (public_key_cmp (public_key , oob_pubkey ) != 0 )
367367 return 1 ;
368368
369369 if (data [0 ] == 1 && data [1 ] == 2 && data [2 ] == 3 && data [3 ] == 4 && data [4 ] == 5 ) {
@@ -447,7 +447,7 @@ START_TEST(test_client)
447447 do_TCP_connection (conn2 );
448448 ck_assert_msg (oob_data_callback_good == 1 , "oob callback not called" );
449449 ck_assert_msg (response_callback_good == 1 , "response callback not called" );
450- ck_assert_msg (memcmp (response_callback_public_key , f2_public_key , crypto_box_PUBLICKEYBYTES ) == 0 , "wrong public key" );
450+ ck_assert_msg (public_key_cmp (response_callback_public_key , f2_public_key ) == 0 , "wrong public key" );
451451 ck_assert_msg (status_callback_good == 1 , "status callback not called" );
452452 ck_assert_msg (status_callback_status == 2 , "wrong status" );
453453 ck_assert_msg (status_callback_connection_id == response_callback_connection_id , "connection ids not equal" );
@@ -538,17 +538,17 @@ START_TEST(test_tcp_connection)
538538 uint8_t self_secret_key [crypto_box_SECRETKEYBYTES ];
539539 crypto_box_keypair (self_public_key , self_secret_key );
540540 TCP_Server * tcp_s = new_TCP_server (1 , NUM_PORTS , ports , self_secret_key , NULL );
541- ck_assert_msg (memcmp (tcp_s -> public_key , self_public_key , crypto_box_PUBLICKEYBYTES ) == 0 , "Wrong public key" );
541+ ck_assert_msg (public_key_cmp (tcp_s -> public_key , self_public_key ) == 0 , "Wrong public key" );
542542
543543 TCP_Proxy_Info proxy_info ;
544544 proxy_info .proxy_type = TCP_PROXY_NONE ;
545545 crypto_box_keypair (self_public_key , self_secret_key );
546546 TCP_Connections * tc_1 = new_tcp_connections (self_secret_key , & proxy_info );
547- ck_assert_msg (memcmp (tc_1 -> self_public_key , self_public_key , crypto_box_PUBLICKEYBYTES ) == 0 , "Wrong public key" );
547+ ck_assert_msg (public_key_cmp (tc_1 -> self_public_key , self_public_key ) == 0 , "Wrong public key" );
548548
549549 crypto_box_keypair (self_public_key , self_secret_key );
550550 TCP_Connections * tc_2 = new_tcp_connections (self_secret_key , & proxy_info );
551- ck_assert_msg (memcmp (tc_2 -> self_public_key , self_public_key , crypto_box_PUBLICKEYBYTES ) == 0 , "Wrong public key" );
551+ ck_assert_msg (public_key_cmp (tc_2 -> self_public_key , self_public_key ) == 0 , "Wrong public key" );
552552
553553 IP_Port ip_port_tcp_s ;
554554
@@ -641,17 +641,17 @@ START_TEST(test_tcp_connection2)
641641 uint8_t self_secret_key [crypto_box_SECRETKEYBYTES ];
642642 crypto_box_keypair (self_public_key , self_secret_key );
643643 TCP_Server * tcp_s = new_TCP_server (1 , NUM_PORTS , ports , self_secret_key , NULL );
644- ck_assert_msg (memcmp (tcp_s -> public_key , self_public_key , crypto_box_PUBLICKEYBYTES ) == 0 , "Wrong public key" );
644+ ck_assert_msg (public_key_cmp (tcp_s -> public_key , self_public_key ) == 0 , "Wrong public key" );
645645
646646 TCP_Proxy_Info proxy_info ;
647647 proxy_info .proxy_type = TCP_PROXY_NONE ;
648648 crypto_box_keypair (self_public_key , self_secret_key );
649649 TCP_Connections * tc_1 = new_tcp_connections (self_secret_key , & proxy_info );
650- ck_assert_msg (memcmp (tc_1 -> self_public_key , self_public_key , crypto_box_PUBLICKEYBYTES ) == 0 , "Wrong public key" );
650+ ck_assert_msg (public_key_cmp (tc_1 -> self_public_key , self_public_key ) == 0 , "Wrong public key" );
651651
652652 crypto_box_keypair (self_public_key , self_secret_key );
653653 TCP_Connections * tc_2 = new_tcp_connections (self_secret_key , & proxy_info );
654- ck_assert_msg (memcmp (tc_2 -> self_public_key , self_public_key , crypto_box_PUBLICKEYBYTES ) == 0 , "Wrong public key" );
654+ ck_assert_msg (public_key_cmp (tc_2 -> self_public_key , self_public_key ) == 0 , "Wrong public key" );
655655
656656 IP_Port ip_port_tcp_s ;
657657
0 commit comments