diff options
author | Bart Polot <bart@net.in.tum.de> | 2015-10-02 03:37:55 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2015-10-02 03:37:55 +0000 |
commit | f7d9a7d0b9167ed1c8a062e54c7903b0ef42e394 (patch) | |
tree | f01ad35501c9ab3ae959a39cd4b22529565bc0f6 /src/cadet | |
parent | b76a0622c6c6ad15a121ed0f6811d2bf4a6f3e73 (diff) | |
download | gnunet-f7d9a7d0b9167ed1c8a062e54c7903b0ef42e394.tar.gz gnunet-f7d9a7d0b9167ed1c8a062e54c7903b0ef42e394.zip |
- adjust logging
Diffstat (limited to 'src/cadet')
-rw-r--r-- | src/cadet/gnunet-service-cadet_tunnel.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/cadet/gnunet-service-cadet_tunnel.c b/src/cadet/gnunet-service-cadet_tunnel.c index 7dd82a7f7..0c34777ca 100644 --- a/src/cadet/gnunet-service-cadet_tunnel.c +++ b/src/cadet/gnunet-service-cadet_tunnel.c | |||
@@ -883,6 +883,14 @@ new_ephemeral (struct CadetTunnel *t) | |||
883 | { | 883 | { |
884 | GNUNET_free_non_null (t->ax->DHRs); | 884 | GNUNET_free_non_null (t->ax->DHRs); |
885 | t->ax->DHRs = GNUNET_CRYPTO_ecdhe_key_create(); | 885 | t->ax->DHRs = GNUNET_CRYPTO_ecdhe_key_create(); |
886 | #if DUMP_KEYS_TO_STDERR | ||
887 | { | ||
888 | struct GNUNET_CRYPTO_EcdhePublicKey pub; | ||
889 | GNUNET_CRYPTO_ecdhe_key_get_public (t->ax->DHRs, &pub); | ||
890 | LOG (GNUNET_ERROR_TYPE_DEBUG, " new DHRs generated: pub %s\n", | ||
891 | GNUNET_i2s ((struct GNUNET_PeerIdentity *) &pub)); | ||
892 | } | ||
893 | #endif | ||
886 | } | 894 | } |
887 | 895 | ||
888 | 896 | ||
@@ -1064,7 +1072,7 @@ t_ax_encrypt (struct CadetTunnel *t, void *dst, const void *src, size_t size) | |||
1064 | GNUNET_CRYPTO_symmetric_derive_iv (&iv, &MK, NULL, 0, NULL); | 1072 | GNUNET_CRYPTO_symmetric_derive_iv (&iv, &MK, NULL, 0, NULL); |
1065 | 1073 | ||
1066 | #if DUMP_KEYS_TO_STDERR | 1074 | #if DUMP_KEYS_TO_STDERR |
1067 | LOG (GNUNET_ERROR_TYPE_INFO, " CKs: %s\n", | 1075 | LOG (GNUNET_ERROR_TYPE_DEBUG, " CKs: %s\n", |
1068 | GNUNET_i2s ((struct GNUNET_PeerIdentity *) &ax->CKs)); | 1076 | GNUNET_i2s ((struct GNUNET_PeerIdentity *) &ax->CKs)); |
1069 | LOG (GNUNET_ERROR_TYPE_INFO, " AX_ENC with key %u: %s\n", ax->Ns, | 1077 | LOG (GNUNET_ERROR_TYPE_INFO, " AX_ENC with key %u: %s\n", ax->Ns, |
1070 | GNUNET_i2s ((struct GNUNET_PeerIdentity *) &MK)); | 1078 | GNUNET_i2s ((struct GNUNET_PeerIdentity *) &MK)); |
@@ -1101,12 +1109,13 @@ t_ax_decrypt (struct CadetTunnel *t, void *dst, const void *src, size_t size) | |||
1101 | LOG (GNUNET_ERROR_TYPE_DEBUG, " t_ax_decrypt start\n"); | 1109 | LOG (GNUNET_ERROR_TYPE_DEBUG, " t_ax_decrypt start\n"); |
1102 | 1110 | ||
1103 | ax = t->ax; | 1111 | ax = t->ax; |
1112 | ax_debug (ax, GNUNET_ERROR_TYPE_INFO); | ||
1104 | 1113 | ||
1105 | t_hmac_derive_key (&ax->CKr, &MK, "0", 1); | 1114 | t_hmac_derive_key (&ax->CKr, &MK, "0", 1); |
1106 | GNUNET_CRYPTO_symmetric_derive_iv (&iv, &MK, NULL, 0, NULL); | 1115 | GNUNET_CRYPTO_symmetric_derive_iv (&iv, &MK, NULL, 0, NULL); |
1107 | 1116 | ||
1108 | #if DUMP_KEYS_TO_STDERR | 1117 | #if DUMP_KEYS_TO_STDERR |
1109 | LOG (GNUNET_ERROR_TYPE_INFO, " CKr: %s\n", | 1118 | LOG (GNUNET_ERROR_TYPE_DEBUG, " CKr: %s\n", |
1110 | GNUNET_i2s ((struct GNUNET_PeerIdentity *) &ax->CKr)); | 1119 | GNUNET_i2s ((struct GNUNET_PeerIdentity *) &ax->CKr)); |
1111 | LOG (GNUNET_ERROR_TYPE_INFO, " AX_DEC with key %u: %s\n", ax->Nr, | 1120 | LOG (GNUNET_ERROR_TYPE_INFO, " AX_DEC with key %u: %s\n", ax->Nr, |
1112 | GNUNET_i2s ((struct GNUNET_PeerIdentity *) &MK)); | 1121 | GNUNET_i2s ((struct GNUNET_PeerIdentity *) &MK)); |
@@ -1423,9 +1432,9 @@ store_skipped_key (struct CadetTunnel *t, | |||
1423 | key->HK = t->ax->HKr; | 1432 | key->HK = t->ax->HKr; |
1424 | t_hmac_derive_key (&t->ax->CKr, &key->MK, "0", 1); | 1433 | t_hmac_derive_key (&t->ax->CKr, &key->MK, "0", 1); |
1425 | #if DUMP_KEYS_TO_STDERR | 1434 | #if DUMP_KEYS_TO_STDERR |
1426 | LOG (GNUNET_ERROR_TYPE_INFO, " storing MK for Nr %u: %s\n", | 1435 | LOG (GNUNET_ERROR_TYPE_DEBUG, " storing MK for Nr %u: %s\n", |
1427 | key->Kn, GNUNET_i2s ((struct GNUNET_PeerIdentity *) &key->MK)); | 1436 | key->Kn, GNUNET_i2s ((struct GNUNET_PeerIdentity *) &key->MK)); |
1428 | LOG (GNUNET_ERROR_TYPE_INFO, " for CKr: %s\n", | 1437 | LOG (GNUNET_ERROR_TYPE_DEBUG, " for CKr: %s\n", |
1429 | GNUNET_i2s ((struct GNUNET_PeerIdentity *) &t->ax->CKr)); | 1438 | GNUNET_i2s ((struct GNUNET_PeerIdentity *) &t->ax->CKr)); |
1430 | #endif | 1439 | #endif |
1431 | t_hmac_derive_key (&t->ax->CKr, &t->ax->CKr, "1", 1); | 1440 | t_hmac_derive_key (&t->ax->CKr, &t->ax->CKr, "1", 1); |
@@ -1471,6 +1480,7 @@ store_ax_keys (struct CadetTunnel *t, | |||
1471 | 1480 | ||
1472 | 1481 | ||
1473 | gap = Np - t->ax->Nr; | 1482 | gap = Np - t->ax->Nr; |
1483 | LOG (GNUNET_ERROR_TYPE_INFO, "Storing keys [%u, %u)\n", t->ax->Nr, Np); | ||
1474 | if (MAX_KEY_GAP < gap) | 1484 | if (MAX_KEY_GAP < gap) |
1475 | { | 1485 | { |
1476 | /* Avoid DoS (forcing peer to do 2*33 chain HMAC operations) */ | 1486 | /* Avoid DoS (forcing peer to do 2*33 chain HMAC operations) */ |
@@ -1537,6 +1547,7 @@ t_ax_decrypt_and_validate (struct CadetTunnel *t, void *dst, | |||
1537 | struct GNUNET_CRYPTO_EcdhePublicKey *DHRp; | 1547 | struct GNUNET_CRYPTO_EcdhePublicKey *DHRp; |
1538 | 1548 | ||
1539 | /* Try Next HK */ | 1549 | /* Try Next HK */ |
1550 | LOG (GNUNET_ERROR_TYPE_DEBUG, " trying next HK\n"); | ||
1540 | t_hmac (&src->Ns, AX_HEADER_SIZE + esize, 0, &ax->NHKr, &msg_hmac); | 1551 | t_hmac (&src->Ns, AX_HEADER_SIZE + esize, 0, &ax->NHKr, &msg_hmac); |
1541 | if (0 != memcmp (&msg_hmac, &src->hmac, sizeof (msg_hmac))) | 1552 | if (0 != memcmp (&msg_hmac, &src->hmac, sizeof (msg_hmac))) |
1542 | { | 1553 | { |