diff options
Diffstat (limited to 'src/cadet/gnunet-service-cadet_tunnels.c')
-rw-r--r-- | src/cadet/gnunet-service-cadet_tunnels.c | 45 |
1 files changed, 18 insertions, 27 deletions
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", |