diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core/gnunet-service-core_kx.c | 48 |
1 files changed, 30 insertions, 18 deletions
diff --git a/src/core/gnunet-service-core_kx.c b/src/core/gnunet-service-core_kx.c index fc242b171..6550160df 100644 --- a/src/core/gnunet-service-core_kx.c +++ b/src/core/gnunet-service-core_kx.c | |||
@@ -568,8 +568,9 @@ do_encrypt (struct GSC_KeyExchangeInfo *kx, | |||
568 | so we require manual intervention to get this one... */ | 568 | so we require manual intervention to get this one... */ |
569 | #if 0 | 569 | #if 0 |
570 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 570 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
571 | "Encrypted %u bytes for `%4s' using key %u, IV %u\n", | 571 | "Encrypted %u bytes for `%s' using key %u, IV %u\n", |
572 | (unsigned int) size, GNUNET_i2s (&kx->peer), | 572 | (unsigned int) size, |
573 | GNUNET_i2s (&kx->peer), | ||
573 | (unsigned int) kx->encrypt_key.crc32, GNUNET_CRYPTO_crc32_n (iv, | 574 | (unsigned int) kx->encrypt_key.crc32, GNUNET_CRYPTO_crc32_n (iv, |
574 | sizeof | 575 | sizeof |
575 | (iv))); | 576 | (iv))); |
@@ -608,23 +609,30 @@ do_decrypt (struct GSC_KeyExchangeInfo *kx, | |||
608 | return GNUNET_SYSERR; | 609 | return GNUNET_SYSERR; |
609 | } | 610 | } |
610 | if (size != | 611 | if (size != |
611 | GNUNET_CRYPTO_symmetric_decrypt (in, (uint16_t) size, &kx->decrypt_key, iv, | 612 | GNUNET_CRYPTO_symmetric_decrypt (in, |
612 | out)) | 613 | (uint16_t) size, |
614 | &kx->decrypt_key, | ||
615 | iv, | ||
616 | out)) | ||
613 | { | 617 | { |
614 | GNUNET_break (0); | 618 | GNUNET_break (0); |
615 | return GNUNET_SYSERR; | 619 | return GNUNET_SYSERR; |
616 | } | 620 | } |
617 | GNUNET_STATISTICS_update (GSC_stats, gettext_noop ("# bytes decrypted"), size, | 621 | GNUNET_STATISTICS_update (GSC_stats, |
622 | gettext_noop ("# bytes decrypted"), | ||
623 | size, | ||
618 | GNUNET_NO); | 624 | GNUNET_NO); |
619 | /* the following is too sensitive to write to log files by accident, | 625 | /* the following is too sensitive to write to log files by accident, |
620 | so we require manual intervention to get this one... */ | 626 | so we require manual intervention to get this one... */ |
621 | #if 0 | 627 | #if 0 |
622 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 628 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
623 | "Decrypted %u bytes from `%4s' using key %u, IV %u\n", | 629 | "Decrypted %u bytes from `%s' using key %u, IV %u\n", |
624 | (unsigned int) size, GNUNET_i2s (&kx->peer), | 630 | (unsigned int) size, |
625 | (unsigned int) kx->decrypt_key.crc32, GNUNET_CRYPTO_crc32_n (iv, | 631 | GNUNET_i2s (&kx->peer), |
626 | sizeof | 632 | (unsigned int) kx->decrypt_key.crc32, |
627 | (*iv))); | 633 | GNUNET_CRYPTO_crc32_n (iv, |
634 | sizeof | ||
635 | (*iv))); | ||
628 | #endif | 636 | #endif |
629 | return GNUNET_OK; | 637 | return GNUNET_OK; |
630 | } | 638 | } |
@@ -855,17 +863,21 @@ GSC_KX_handle_ephemeral_key (struct GSC_KeyExchangeInfo *kx, | |||
855 | gettext_noop ("# ephemeral keys received"), | 863 | gettext_noop ("# ephemeral keys received"), |
856 | 1, GNUNET_NO); | 864 | 1, GNUNET_NO); |
857 | 865 | ||
858 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
859 | "Core service receives `%s' request from `%4s'.\n", "EPHEMERAL_KEY", | ||
860 | GNUNET_i2s (&kx->peer)); | ||
861 | if (0 != | 866 | if (0 != |
862 | memcmp (&m->origin_identity, | 867 | memcmp (&m->origin_identity, |
863 | &kx->peer.public_key, | 868 | &kx->peer, |
864 | sizeof (struct GNUNET_PeerIdentity))) | 869 | sizeof (struct GNUNET_PeerIdentity))) |
865 | { | 870 | { |
871 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
872 | "Received EPHEMERAL_KEY from %s, but expected %s\n", | ||
873 | GNUNET_i2s (&m->origin_identity), | ||
874 | GNUNET_i2s_full (&kx->peer)); | ||
866 | GNUNET_break_op (0); | 875 | GNUNET_break_op (0); |
867 | return; | 876 | return; |
868 | } | 877 | } |
878 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
879 | "Core service receives EPHEMERAL_KEY request from `%s'.\n", | ||
880 | GNUNET_i2s (&kx->peer)); | ||
869 | if ((ntohl (m->purpose.size) != | 881 | if ((ntohl (m->purpose.size) != |
870 | sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) + | 882 | sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) + |
871 | sizeof (struct GNUNET_TIME_AbsoluteNBO) + | 883 | sizeof (struct GNUNET_TIME_AbsoluteNBO) + |
@@ -1010,7 +1022,7 @@ GSC_KX_handle_ping (struct GSC_KeyExchangeInfo *kx, | |||
1010 | } | 1022 | } |
1011 | m = (const struct PingMessage *) msg; | 1023 | m = (const struct PingMessage *) msg; |
1012 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1024 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1013 | "Core service receives `%s' request from `%4s'.\n", "PING", | 1025 | "Core service receives PING request from `%s'.\n", |
1014 | GNUNET_i2s (&kx->peer)); | 1026 | GNUNET_i2s (&kx->peer)); |
1015 | derive_iv (&iv, &kx->decrypt_key, m->iv_seed, &GSC_my_identity); | 1027 | derive_iv (&iv, &kx->decrypt_key, m->iv_seed, &GSC_my_identity); |
1016 | if (GNUNET_OK != | 1028 | if (GNUNET_OK != |
@@ -1179,7 +1191,7 @@ GSC_KX_handle_pong (struct GSC_KeyExchangeInfo *kx, | |||
1179 | } | 1191 | } |
1180 | m = (const struct PongMessage *) msg; | 1192 | m = (const struct PongMessage *) msg; |
1181 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1193 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1182 | "Core service receives `%s' response from `%4s'.\n", "PONG", | 1194 | "Core service receives PONG response from `%s'.\n", |
1183 | GNUNET_i2s (&kx->peer)); | 1195 | GNUNET_i2s (&kx->peer)); |
1184 | /* mark as garbage, just to be sure */ | 1196 | /* mark as garbage, just to be sure */ |
1185 | memset (&t, 255, sizeof (t)); | 1197 | memset (&t, 255, sizeof (t)); |
@@ -1201,11 +1213,11 @@ GSC_KX_handle_pong (struct GSC_KeyExchangeInfo *kx, | |||
1201 | { | 1213 | { |
1202 | /* PONG malformed */ | 1214 | /* PONG malformed */ |
1203 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1215 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1204 | "Received malformed `%s' wanted sender `%4s' with challenge %u\n", | 1216 | "Received malformed `%s' wanted sender `%s' with challenge %u\n", |
1205 | "PONG", GNUNET_i2s (&kx->peer), | 1217 | "PONG", GNUNET_i2s (&kx->peer), |
1206 | (unsigned int) kx->ping_challenge); | 1218 | (unsigned int) kx->ping_challenge); |
1207 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1219 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1208 | "Received malformed `%s' received from `%4s' with challenge %u\n", | 1220 | "Received malformed `%s' received from `%s' with challenge %u\n", |
1209 | "PONG", GNUNET_i2s (&t.target), (unsigned int) t.challenge); | 1221 | "PONG", GNUNET_i2s (&t.target), (unsigned int) t.challenge); |
1210 | return; | 1222 | return; |
1211 | } | 1223 | } |