aboutsummaryrefslogtreecommitdiff
path: root/src/cadet
diff options
context:
space:
mode:
authorJulius Bünger <buenger@mytum.de>2019-04-26 05:56:54 +0200
committerJulius Bünger <buenger@mytum.de>2019-04-26 05:56:54 +0200
commitf5f5a9f680df2cebe6435ec87650cb3cb6e3ef6e (patch)
tree94055d2c049a65b5ab6c61fd3c5867fe49f6f429 /src/cadet
parenta097690795f4f814de7cdbc97ef95fb899eeacd3 (diff)
downloadgnunet-f5f5a9f680df2cebe6435ec87650cb3cb6e3ef6e.tar.gz
gnunet-f5f5a9f680df2cebe6435ec87650cb3cb6e3ef6e.zip
memcmp() -> GNUNET_memcmp(), first take
Diffstat (limited to 'src/cadet')
-rw-r--r--src/cadet/gnunet-service-cadet_channel.c15
-rw-r--r--src/cadet/gnunet-service-cadet_connection.c5
-rw-r--r--src/cadet/gnunet-service-cadet_core.c10
-rw-r--r--src/cadet/gnunet-service-cadet_hello.c5
-rw-r--r--src/cadet/gnunet-service-cadet_paths.c5
-rw-r--r--src/cadet/gnunet-service-cadet_tunnels.c45
6 files changed, 34 insertions, 51 deletions
diff --git a/src/cadet/gnunet-service-cadet_channel.c b/src/cadet/gnunet-service-cadet_channel.c
index 1e898c1eb..bd95428be 100644
--- a/src/cadet/gnunet-service-cadet_channel.c
+++ b/src/cadet/gnunet-service-cadet_channel.c
@@ -679,9 +679,8 @@ GCCH_channel_local_new (struct CadetClient *owner,
679 GCCH_hash_port (&ch->h_port, 679 GCCH_hash_port (&ch->h_port,
680 port, 680 port,
681 GCP_get_id (destination)); 681 GCP_get_id (destination));
682 if (0 == memcmp (&my_full_id, 682 if (0 == GNUNET_memcmp (&my_full_id,
683 GCP_get_id (destination), 683 GCP_get_id (destination)))
684 sizeof (struct GNUNET_PeerIdentity)))
685 { 684 {
686 struct OpenPort *op; 685 struct OpenPort *op;
687 686
@@ -1185,9 +1184,8 @@ GCCH_handle_channel_open_ack (struct CadetChannel *ch,
1185 GNUNET_break_op (0); 1184 GNUNET_break_op (0);
1186 return; 1185 return;
1187 } 1186 }
1188 if (0 != memcmp (&ch->port, 1187 if (0 != GNUNET_memcmp (&ch->port,
1189 port, 1188 port))
1190 sizeof (struct GNUNET_HashCode)))
1191 { 1189 {
1192 /* Other peer failed to provide the right port, 1190 /* Other peer failed to provide the right port,
1193 refuse connection. */ 1191 refuse connection. */
@@ -1612,9 +1610,8 @@ handle_matching_ack (struct CadetChannel *ch,
1612 (NULL != cti) ) 1610 (NULL != cti) )
1613 { 1611 {
1614 GCC_ack_observed (cti); 1612 GCC_ack_observed (cti);
1615 if (0 == memcmp (cti, 1613 if (0 == GNUNET_memcmp (cti,
1616 &crm->connection_taken, 1614 &crm->connection_taken))
1617 sizeof (struct GNUNET_CADET_ConnectionTunnelIdentifier)))
1618 { 1615 {
1619 GCC_latency_observed (cti, 1616 GCC_latency_observed (cti,
1620 GNUNET_TIME_absolute_get_duration (crm->first_transmission_time)); 1617 GNUNET_TIME_absolute_get_duration (crm->first_transmission_time));
diff --git a/src/cadet/gnunet-service-cadet_connection.c b/src/cadet/gnunet-service-cadet_connection.c
index 4f1e5be8e..1f7e86d60 100644
--- a/src/cadet/gnunet-service-cadet_connection.c
+++ b/src/cadet/gnunet-service-cadet_connection.c
@@ -919,9 +919,8 @@ GCC_create_inbound (struct CadetPeer *destination,
919 { 919 {
920 int cmp; 920 int cmp;
921 921
922 cmp = memcmp (cid, 922 cmp = GNUNET_memcmp (cid,
923 &cc->cid, 923 &cc->cid);
924 sizeof (*cid));
925 if (0 == cmp) 924 if (0 == cmp)
926 { 925 {
927 /* Two peers picked the SAME random connection identifier at the 926 /* Two peers picked the SAME random connection identifier at the
diff --git a/src/cadet/gnunet-service-cadet_core.c b/src/cadet/gnunet-service-cadet_core.c
index 275785b57..879230d29 100644
--- a/src/cadet/gnunet-service-cadet_core.c
+++ b/src/cadet/gnunet-service-cadet_core.c
@@ -843,9 +843,8 @@ handle_connection_create (void *cls,
843 } 843 }
844 /* Initiator is at offset 0, find us */ 844 /* Initiator is at offset 0, find us */
845 for (off=1;off<path_length;off++) 845 for (off=1;off<path_length;off++)
846 if (0 == memcmp (&my_full_id, 846 if (0 == GNUNET_memcmp (&my_full_id,
847 &pids[off], 847 &pids[off]))
848 sizeof (struct GNUNET_PeerIdentity)))
849 break; 848 break;
850 if (off == path_length) 849 if (off == path_length)
851 { 850 {
@@ -1310,9 +1309,8 @@ core_init_cb (void *cls,
1310 return; 1309 return;
1311 } 1310 }
1312 GNUNET_break (0 == 1311 GNUNET_break (0 ==
1313 memcmp (my_identity, 1312 GNUNET_memcmp (my_identity,
1314 &my_full_id, 1313 &my_full_id));
1315 sizeof (struct GNUNET_PeerIdentity)));
1316} 1314}
1317 1315
1318 1316
diff --git a/src/cadet/gnunet-service-cadet_hello.c b/src/cadet/gnunet-service-cadet_hello.c
index 2c06006f4..fe2477c34 100644
--- a/src/cadet/gnunet-service-cadet_hello.c
+++ b/src/cadet/gnunet-service-cadet_hello.c
@@ -72,9 +72,8 @@ got_hello (void *cls,
72 if ( (NULL == id) || 72 if ( (NULL == id) ||
73 (NULL == hello) ) 73 (NULL == hello) )
74 return; 74 return;
75 if (0 == memcmp (id, 75 if (0 == GNUNET_memcmp (id,
76 &my_full_id, 76 &my_full_id))
77 sizeof (struct GNUNET_PeerIdentity)))
78 { 77 {
79 GNUNET_free_non_null (mine); 78 GNUNET_free_non_null (mine);
80 mine = (struct GNUNET_HELLO_Message *) GNUNET_copy_message (&hello->header); 79 mine = (struct GNUNET_HELLO_Message *) GNUNET_copy_message (&hello->header);
diff --git a/src/cadet/gnunet-service-cadet_paths.c b/src/cadet/gnunet-service-cadet_paths.c
index a061c5685..bdc92668e 100644
--- a/src/cadet/gnunet-service-cadet_paths.c
+++ b/src/cadet/gnunet-service-cadet_paths.c
@@ -496,9 +496,8 @@ GCPP_try_path_from_dht (const struct GNUNET_PeerIdentity *get_path,
496 ? &get_path[get_path_length - off - 1] 496 ? &get_path[get_path_length - off - 1]
497 : &put_path[get_path_length + put_path_length - off - 1]; 497 : &put_path[get_path_length + put_path_length - off - 1];
498 /* Check that I am not in the path */ 498 /* Check that I am not in the path */
499 if (0 == memcmp (&my_full_id, 499 if (0 == GNUNET_memcmp (&my_full_id,
500 pid, 500 pid))
501 sizeof (struct GNUNET_PeerIdentity)))
502 { 501 {
503 skip = off + 1; 502 skip = off + 1;
504 continue; 503 continue;
diff --git a/src/cadet/gnunet-service-cadet_tunnels.c b/src/cadet/gnunet-service-cadet_tunnels.c
index 57a6d1adf..a2a493ebd 100644
--- a/src/cadet/gnunet-service-cadet_tunnels.c
+++ b/src/cadet/gnunet-service-cadet_tunnels.c
@@ -1013,9 +1013,8 @@ try_old_ax_keys (struct CadetTunnelAxolotl *ax,
1013 0, 1013 0,
1014 &key->HK, 1014 &key->HK,
1015 hmac); 1015 hmac);
1016 if (0 == memcmp (hmac, 1016 if (0 == GNUNET_memcmp (hmac,
1017 &src->hmac, 1017 &src->hmac))
1018 sizeof (*hmac)))
1019 { 1018 {
1020 valid_HK = &key->HK; 1019 valid_HK = &key->HK;
1021 break; 1020 break;
@@ -1047,9 +1046,8 @@ try_old_ax_keys (struct CadetTunnelAxolotl *ax,
1047 (N != key->Kn) ) 1046 (N != key->Kn) )
1048 key = key->next; 1047 key = key->next;
1049 if ( (NULL == key) || 1048 if ( (NULL == key) ||
1050 (0 != memcmp (&key->HK, 1049 (0 != GNUNET_memcmp (&key->HK,
1051 valid_HK, 1050 valid_HK)) )
1052 sizeof (*valid_HK))) )
1053 return -1; 1051 return -1;
1054 1052
1055 /* Decrypt payload */ 1053 /* Decrypt payload */
@@ -1181,9 +1179,8 @@ t_ax_decrypt_and_validate (struct CadetTunnelAxolotl *ax,
1181 sizeof (struct GNUNET_CADET_AxHeader) + esize, 1179 sizeof (struct GNUNET_CADET_AxHeader) + esize,
1182 0, &ax->HKr, 1180 0, &ax->HKr,
1183 &msg_hmac); 1181 &msg_hmac);
1184 if (0 != memcmp (&msg_hmac, 1182 if (0 != GNUNET_memcmp (&msg_hmac,
1185 &src->hmac, 1183 &src->hmac))
1186 sizeof (msg_hmac)))
1187 { 1184 {
1188 static const char ctx[] = "axolotl ratchet"; 1185 static const char ctx[] = "axolotl ratchet";
1189 struct GNUNET_CRYPTO_SymmetricSessionKey keys[3]; /* RKp, NHKp, CKp */ 1186 struct GNUNET_CRYPTO_SymmetricSessionKey keys[3]; /* RKp, NHKp, CKp */
@@ -1197,9 +1194,8 @@ t_ax_decrypt_and_validate (struct CadetTunnelAxolotl *ax,
1197 0, 1194 0,
1198 &ax->NHKr, 1195 &ax->NHKr,
1199 &msg_hmac); 1196 &msg_hmac);
1200 if (0 != memcmp (&msg_hmac, 1197 if (0 != GNUNET_memcmp (&msg_hmac,
1201 &src->hmac, 1198 &src->hmac))
1202 sizeof (msg_hmac)))
1203 { 1199 {
1204 /* Try the skipped keys, if that fails, we're out of luck. */ 1200 /* Try the skipped keys, if that fails, we're out of luck. */
1205 return try_old_ax_keys (ax, 1201 return try_old_ax_keys (ax,
@@ -1528,9 +1524,8 @@ update_ax_by_kx (struct CadetTunnelAxolotl *ax,
1528 GNUNET_break_op (0); 1524 GNUNET_break_op (0);
1529 return GNUNET_SYSERR; 1525 return GNUNET_SYSERR;
1530 } 1526 }
1531 if (0 == memcmp (&ax->DHRr, 1527 if (0 == GNUNET_memcmp (&ax->DHRr,
1532 ratchet_key, 1528 ratchet_key))
1533 sizeof (*ratchet_key)))
1534 { 1529 {
1535 GNUNET_STATISTICS_update (stats, 1530 GNUNET_STATISTICS_update (stats,
1536 "# Ratchet key already known", 1531 "# Ratchet key already known",
@@ -1872,9 +1867,8 @@ check_ee (const struct GNUNET_CRYPTO_EcdhePrivateKey *e1,
1872 GNUNET_CRYPTO_ecc_ecdh (e2, 1867 GNUNET_CRYPTO_ecc_ecdh (e2,
1873 &p1, 1868 &p1,
1874 &hc2)); 1869 &hc2));
1875 GNUNET_break (0 == memcmp (&hc1, 1870 GNUNET_break (0 == GNUNET_memcmp (&hc1,
1876 &hc2, 1871 &hc2));
1877 sizeof (hc1)));
1878} 1872}
1879 1873
1880 1874
@@ -1899,9 +1893,8 @@ check_ed (const struct GNUNET_CRYPTO_EcdhePrivateKey *e1,
1899 GNUNET_CRYPTO_eddsa_ecdh (e2, 1893 GNUNET_CRYPTO_eddsa_ecdh (e2,
1900 &p1, 1894 &p1,
1901 &hc2)); 1895 &hc2));
1902 GNUNET_break (0 == memcmp (&hc1, 1896 GNUNET_break (0 == GNUNET_memcmp (&hc1,
1903 &hc2, 1897 &hc2));
1904 sizeof (hc1)));
1905} 1898}
1906 1899
1907 1900
@@ -1974,9 +1967,8 @@ GCT_handle_kx_auth (struct CadetTConnection *ct,
1974 GNUNET_CRYPTO_hash (&ax_tmp.RK, 1967 GNUNET_CRYPTO_hash (&ax_tmp.RK,
1975 sizeof (ax_tmp.RK), 1968 sizeof (ax_tmp.RK),
1976 &kx_auth); 1969 &kx_auth);
1977 if (0 != memcmp (&kx_auth, 1970 if (0 != GNUNET_memcmp (&kx_auth,
1978 &msg->auth, 1971 &msg->auth))
1979 sizeof (kx_auth)))
1980 { 1972 {
1981 /* This KX_AUTH is not using the latest KX/KX_AUTH data 1973 /* This KX_AUTH is not using the latest KX/KX_AUTH data
1982 we transmitted to the sender, refuse it, try KX again. */ 1974 we transmitted to the sender, refuse it, try KX again. */
@@ -1992,9 +1984,8 @@ GCT_handle_kx_auth (struct CadetTConnection *ct,
1992 1984
1993 GNUNET_CRYPTO_ecdhe_key_get_public (&ax_tmp.kx_0, 1985 GNUNET_CRYPTO_ecdhe_key_get_public (&ax_tmp.kx_0,
1994 &ephemeral_key); 1986 &ephemeral_key);
1995 if (0 != memcmp (&ephemeral_key, 1987 if (0 != GNUNET_memcmp (&ephemeral_key,
1996 &msg->r_ephemeral_key_XXX, 1988 &msg->r_ephemeral_key_XXX))
1997 sizeof (ephemeral_key)))
1998 { 1989 {
1999 LOG (GNUNET_ERROR_TYPE_WARNING, 1990 LOG (GNUNET_ERROR_TYPE_WARNING,
2000 "My ephemeral is %s!\n", 1991 "My ephemeral is %s!\n",