aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cadet/gnunet-service-cadet_tunnel.c73
1 files changed, 36 insertions, 37 deletions
diff --git a/src/cadet/gnunet-service-cadet_tunnel.c b/src/cadet/gnunet-service-cadet_tunnel.c
index 44e2b9af9..a60ff8da5 100644
--- a/src/cadet/gnunet-service-cadet_tunnel.c
+++ b/src/cadet/gnunet-service-cadet_tunnel.c
@@ -896,7 +896,7 @@ t_hmac (const void *plaintext, size_t size,
896 896
897#if DUMP_KEYS_TO_STDERR 897#if DUMP_KEYS_TO_STDERR
898 LOG (GNUNET_ERROR_TYPE_INFO, " HMAC %u bytes with key %s\n", size, 898 LOG (GNUNET_ERROR_TYPE_INFO, " HMAC %u bytes with key %s\n", size,
899 GNUNET_h2s ((struct GNUNET_HashCode *) key)); 899 GNUNET_i2s ((struct GNUNET_PeerIdentity *) key));
900#endif 900#endif
901 GNUNET_CRYPTO_hmac_derive_key (&auth_key, key, 901 GNUNET_CRYPTO_hmac_derive_key (&auth_key, key,
902 &iv, sizeof (iv), 902 &iv, sizeof (iv),
@@ -935,7 +935,7 @@ t_encrypt (struct CadetTunnel *t, void *dst, const void *src,
935 key = GNUNET_YES == force_newest_key ? &t->e_key : select_key (t); 935 key = GNUNET_YES == force_newest_key ? &t->e_key : select_key (t);
936 #if DUMP_KEYS_TO_STDERR 936 #if DUMP_KEYS_TO_STDERR
937 LOG (GNUNET_ERROR_TYPE_INFO, " ENC with key %s\n", 937 LOG (GNUNET_ERROR_TYPE_INFO, " ENC with key %s\n",
938 GNUNET_h2s ((struct GNUNET_HashCode *) key)); 938 GNUNET_i2s ((struct GNUNET_PeerIdentity *) key));
939 #endif 939 #endif
940 GNUNET_CRYPTO_symmetric_derive_iv (&siv, key, &iv, sizeof (iv), NULL); 940 GNUNET_CRYPTO_symmetric_derive_iv (&siv, key, &iv, sizeof (iv), NULL);
941 LOG (GNUNET_ERROR_TYPE_DEBUG, " t_encrypt IV derived\n"); 941 LOG (GNUNET_ERROR_TYPE_DEBUG, " t_encrypt IV derived\n");
@@ -1055,9 +1055,9 @@ t_ax_encrypt (struct CadetTunnel *t, void *dst, const void *src, size_t size)
1055 1055
1056 #if DUMP_KEYS_TO_STDERR 1056 #if DUMP_KEYS_TO_STDERR
1057 LOG (GNUNET_ERROR_TYPE_INFO, " CKs: %s\n", 1057 LOG (GNUNET_ERROR_TYPE_INFO, " CKs: %s\n",
1058 GNUNET_h2s ((struct GNUNET_HashCode *) &ax->CKs)); 1058 GNUNET_i2s ((struct GNUNET_PeerIdentity *) &ax->CKs));
1059 LOG (GNUNET_ERROR_TYPE_INFO, " AX_ENC with key %u: %s\n", ax->Ns, 1059 LOG (GNUNET_ERROR_TYPE_INFO, " AX_ENC with key %u: %s\n", ax->Ns,
1060 GNUNET_h2s ((struct GNUNET_HashCode *) &MK)); 1060 GNUNET_i2s ((struct GNUNET_PeerIdentity *) &MK));
1061 #endif 1061 #endif
1062 1062
1063 out_size = GNUNET_CRYPTO_symmetric_encrypt (src, size, &MK, &iv, dst); 1063 out_size = GNUNET_CRYPTO_symmetric_encrypt (src, size, &MK, &iv, dst);
@@ -1097,9 +1097,9 @@ t_ax_decrypt (struct CadetTunnel *t, void *dst, const void *src, size_t size)
1097 1097
1098 #if DUMP_KEYS_TO_STDERR 1098 #if DUMP_KEYS_TO_STDERR
1099 LOG (GNUNET_ERROR_TYPE_INFO, " CKr: %s\n", 1099 LOG (GNUNET_ERROR_TYPE_INFO, " CKr: %s\n",
1100 GNUNET_h2s ((struct GNUNET_HashCode *) &ax->CKr)); 1100 GNUNET_i2s ((struct GNUNET_PeerIdentity *) &ax->CKr));
1101 LOG (GNUNET_ERROR_TYPE_INFO, " AX_DEC with key %u: %s\n", ax->Nr, 1101 LOG (GNUNET_ERROR_TYPE_INFO, " AX_DEC with key %u: %s\n", ax->Nr,
1102 GNUNET_h2s ((struct GNUNET_HashCode *) &MK)); 1102 GNUNET_i2s ((struct GNUNET_PeerIdentity *) &MK));
1103 #endif 1103 #endif
1104 1104
1105 GNUNET_assert (size >= sizeof (struct GNUNET_MessageHeader)); 1105 GNUNET_assert (size >= sizeof (struct GNUNET_MessageHeader));
@@ -1134,7 +1134,7 @@ t_h_encrypt (struct CadetTunnel *t, struct GNUNET_CADET_AX *msg)
1134 1134
1135 #if DUMP_KEYS_TO_STDERR 1135 #if DUMP_KEYS_TO_STDERR
1136 LOG (GNUNET_ERROR_TYPE_INFO, " AX_ENC_H with key %s\n", 1136 LOG (GNUNET_ERROR_TYPE_INFO, " AX_ENC_H with key %s\n",
1137 GNUNET_h2s ((struct GNUNET_HashCode *) &ax->HKs)); 1137 GNUNET_i2s ((struct GNUNET_PeerIdentity *) &ax->HKs));
1138 #endif 1138 #endif
1139 1139
1140 out_size = GNUNET_CRYPTO_symmetric_encrypt (&msg->Ns, AX_HEADER_SIZE, 1140 out_size = GNUNET_CRYPTO_symmetric_encrypt (&msg->Ns, AX_HEADER_SIZE,
@@ -1168,7 +1168,7 @@ t_h_decrypt (struct CadetTunnel *t, const struct GNUNET_CADET_AX *src,
1168 1168
1169 #if DUMP_KEYS_TO_STDERR 1169 #if DUMP_KEYS_TO_STDERR
1170 LOG (GNUNET_ERROR_TYPE_INFO, " AX_DEC_H with key %s\n", 1170 LOG (GNUNET_ERROR_TYPE_INFO, " AX_DEC_H with key %s\n",
1171 GNUNET_h2s ((struct GNUNET_HashCode *) &ax->HKr)); 1171 GNUNET_i2s ((struct GNUNET_PeerIdentity *) &ax->HKr));
1172 #endif 1172 #endif
1173 1173
1174 out_size = GNUNET_CRYPTO_symmetric_decrypt (&src->Ns, AX_HEADER_SIZE, 1174 out_size = GNUNET_CRYPTO_symmetric_decrypt (&src->Ns, AX_HEADER_SIZE,
@@ -1228,7 +1228,7 @@ t_decrypt (struct CadetTunnel *t, void *dst, const void *src,
1228 1228
1229#if DUMP_KEYS_TO_STDERR 1229#if DUMP_KEYS_TO_STDERR
1230 LOG (GNUNET_ERROR_TYPE_DEBUG, " t_decrypt with %s\n", 1230 LOG (GNUNET_ERROR_TYPE_DEBUG, " t_decrypt with %s\n",
1231 GNUNET_h2s ((struct GNUNET_HashCode *) &t->d_key)); 1231 GNUNET_i2s ((struct GNUNET_PeerIdentity *) &t->d_key));
1232#endif 1232#endif
1233 if (CADET_TUNNEL_KEY_UNINITIALIZED == t->estate) 1233 if (CADET_TUNNEL_KEY_UNINITIALIZED == t->estate)
1234 { 1234 {
@@ -1341,7 +1341,7 @@ try_old_ax_keys (struct CadetTunnel *t, struct GNUNET_CADET_AX *dst,
1341 1341
1342 #if DUMP_KEYS_TO_STDERR 1342 #if DUMP_KEYS_TO_STDERR
1343 LOG (GNUNET_ERROR_TYPE_INFO, " AX_DEC with skipped key %s\n", 1343 LOG (GNUNET_ERROR_TYPE_INFO, " AX_DEC with skipped key %s\n",
1344 GNUNET_h2s ((struct GNUNET_HashCode *) &key->MK)); 1344 GNUNET_i2s ((struct GNUNET_PeerIdentity *) &key->MK));
1345 #endif 1345 #endif
1346 1346
1347 GNUNET_assert (size > sizeof (struct GNUNET_CADET_AX)); 1347 GNUNET_assert (size > sizeof (struct GNUNET_CADET_AX));
@@ -1374,9 +1374,9 @@ store_skipped_key (struct CadetTunnel *t,
1374 t_hmac_derive_key (&t->ax->CKr, &key->MK, "0", 1); 1374 t_hmac_derive_key (&t->ax->CKr, &key->MK, "0", 1);
1375 #if DUMP_KEYS_TO_STDERR 1375 #if DUMP_KEYS_TO_STDERR
1376 LOG (GNUNET_ERROR_TYPE_INFO, " storing MK for Nr %u: %s\n", 1376 LOG (GNUNET_ERROR_TYPE_INFO, " storing MK for Nr %u: %s\n",
1377 t->ax->Nr, GNUNET_h2s ((struct GNUNET_HashCode *) &key->MK)); 1377 t->ax->Nr, GNUNET_i2s ((struct GNUNET_PeerIdentity *) &key->MK));
1378 LOG (GNUNET_ERROR_TYPE_INFO, " for CKr: %s\n", 1378 LOG (GNUNET_ERROR_TYPE_INFO, " for CKr: %s\n",
1379 GNUNET_h2s ((struct GNUNET_HashCode *) &t->ax->CKr)); 1379 GNUNET_i2s ((struct GNUNET_PeerIdentity *) &t->ax->CKr));
1380 #endif 1380 #endif
1381 t_hmac_derive_key (&t->ax->CKr, &t->ax->CKr, "1", 1); 1381 t_hmac_derive_key (&t->ax->CKr, &t->ax->CKr, "1", 1);
1382 GNUNET_CONTAINER_DLL_insert (t->ax->skipped_head, t->ax->skipped_tail, key); 1382 GNUNET_CONTAINER_DLL_insert (t->ax->skipped_head, t->ax->skipped_tail, key);
@@ -1595,14 +1595,14 @@ create_otr_keys (struct CadetTunnel *t)
1595 derive_symmertic (&t->d_key, GCP_get_id (t->peer), &my_full_id, &km); 1595 derive_symmertic (&t->d_key, GCP_get_id (t->peer), &my_full_id, &km);
1596 #if DUMP_KEYS_TO_STDERR 1596 #if DUMP_KEYS_TO_STDERR
1597 LOG (GNUNET_ERROR_TYPE_INFO, "ME: %s\n", 1597 LOG (GNUNET_ERROR_TYPE_INFO, "ME: %s\n",
1598 GNUNET_h2s ((struct GNUNET_HashCode *) &otr_kx_msg.ephemeral_key)); 1598 GNUNET_i2s ((struct GNUNET_PeerIdentity *) &otr_kx_msg.ephemeral_key));
1599 LOG (GNUNET_ERROR_TYPE_INFO, "PE: %s\n", 1599 LOG (GNUNET_ERROR_TYPE_INFO, "PE: %s\n",
1600 GNUNET_h2s ((struct GNUNET_HashCode *) &t->peers_ephemeral_key)); 1600 GNUNET_i2s ((struct GNUNET_PeerIdentity *) &t->peers_ephemeral_key));
1601 LOG (GNUNET_ERROR_TYPE_INFO, "KM: %s\n", GNUNET_h2s (&km)); 1601 LOG (GNUNET_ERROR_TYPE_INFO, "KM: %s\n", GNUNET_h2s (&km));
1602 LOG (GNUNET_ERROR_TYPE_INFO, "EK: %s\n", 1602 LOG (GNUNET_ERROR_TYPE_INFO, "EK: %s\n",
1603 GNUNET_h2s ((struct GNUNET_HashCode *) &t->e_key)); 1603 GNUNET_i2s ((struct GNUNET_PeerIdentity *) &t->e_key));
1604 LOG (GNUNET_ERROR_TYPE_INFO, "DK: %s\n", 1604 LOG (GNUNET_ERROR_TYPE_INFO, "DK: %s\n",
1605 GNUNET_h2s ((struct GNUNET_HashCode *) &t->d_key)); 1605 GNUNET_i2s ((struct GNUNET_PeerIdentity *) &t->d_key));
1606 #endif 1606 #endif
1607 return GNUNET_OK; 1607 return GNUNET_OK;
1608} 1608}
@@ -2390,7 +2390,7 @@ global_otr_rekey (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
2390 otr_kx_msg.expiration_time = GNUNET_TIME_absolute_hton (time); 2390 otr_kx_msg.expiration_time = GNUNET_TIME_absolute_hton (time);
2391 GNUNET_CRYPTO_ecdhe_key_get_public (otr_ephemeral_key, &otr_kx_msg.ephemeral_key); 2391 GNUNET_CRYPTO_ecdhe_key_get_public (otr_ephemeral_key, &otr_kx_msg.ephemeral_key);
2392 LOG (GNUNET_ERROR_TYPE_INFO, "GLOBAL OTR RE-KEY, NEW EPHM: %s\n", 2392 LOG (GNUNET_ERROR_TYPE_INFO, "GLOBAL OTR RE-KEY, NEW EPHM: %s\n",
2393 GNUNET_h2s ((struct GNUNET_HashCode *) &otr_kx_msg.ephemeral_key)); 2393 GNUNET_i2s ((struct GNUNET_PeerIdentity *) &otr_kx_msg.ephemeral_key));
2394 2394
2395 GNUNET_assert (GNUNET_OK == 2395 GNUNET_assert (GNUNET_OK ==
2396 GNUNET_CRYPTO_eddsa_sign (id_key, 2396 GNUNET_CRYPTO_eddsa_sign (id_key,
@@ -2762,9 +2762,9 @@ handle_ephemeral (struct CadetTunnel *t,
2762 { 2762 {
2763 #if DUMP_KEYS_TO_STDERR 2763 #if DUMP_KEYS_TO_STDERR
2764 LOG (GNUNET_ERROR_TYPE_INFO, "OLD: %s\n", 2764 LOG (GNUNET_ERROR_TYPE_INFO, "OLD: %s\n",
2765 GNUNET_h2s ((struct GNUNET_HashCode *) &t->peers_ephemeral_key)); 2765 GNUNET_i2s ((struct GNUNET_PeerIdentity *) &t->peers_ephemeral_key));
2766 LOG (GNUNET_ERROR_TYPE_INFO, "NEW: %s\n", 2766 LOG (GNUNET_ERROR_TYPE_INFO, "NEW: %s\n",
2767 GNUNET_h2s ((struct GNUNET_HashCode *) &msg->ephemeral_key)); 2767 GNUNET_i2s ((struct GNUNET_PeerIdentity *) &msg->ephemeral_key));
2768 #endif 2768 #endif
2769 t->peers_ephemeral_key = msg->ephemeral_key; 2769 t->peers_ephemeral_key = msg->ephemeral_key;
2770 2770
@@ -4366,29 +4366,28 @@ ax_debug (const struct CadetTunnelAxolotl *ax, enum GNUNET_ErrorType level)
4366 struct GNUNET_CRYPTO_EcdhePublicKey pub; 4366 struct GNUNET_CRYPTO_EcdhePublicKey pub;
4367 struct CadetTunnelSkippedKey *iter; 4367 struct CadetTunnelSkippedKey *iter;
4368 4368
4369
4370 LOG2 (level, "TTT RK \t %s\n", 4369 LOG2 (level, "TTT RK \t %s\n",
4371 GNUNET_h2s ((struct GNUNET_HashCode *) &ax->RK)); 4370 GNUNET_i2s ((struct GNUNET_PeerIdentity *) &ax->RK));
4372 4371
4373 LOG2 (level, "TTT HKs \t %s\n", 4372 LOG2 (level, "TTT HKs \t %s\n",
4374 GNUNET_h2s ((struct GNUNET_HashCode *) &ax->HKs)); 4373 GNUNET_i2s ((struct GNUNET_PeerIdentity *) &ax->HKs));
4375 LOG2 (level, "TTT HKr \t %s\n", 4374 LOG2 (level, "TTT HKr \t %s\n",
4376 GNUNET_h2s ((struct GNUNET_HashCode *) &ax->HKr)); 4375 GNUNET_i2s ((struct GNUNET_PeerIdentity *) &ax->HKr));
4377 LOG2 (level, "TTT NHKs\t %s\n", 4376 LOG2 (level, "TTT NHKs\t %s\n",
4378 GNUNET_h2s ((struct GNUNET_HashCode *) &ax->NHKs)); 4377 GNUNET_i2s ((struct GNUNET_PeerIdentity *) &ax->NHKs));
4379 LOG2 (level, "TTT NHKr\t %s\n", 4378 LOG2 (level, "TTT NHKr\t %s\n",
4380 GNUNET_h2s ((struct GNUNET_HashCode *) &ax->NHKr)); 4379 GNUNET_i2s ((struct GNUNET_PeerIdentity *) &ax->NHKr));
4381 4380
4382 LOG2 (level, "TTT CKs \t %s\n", 4381 LOG2 (level, "TTT CKs \t %s\n",
4383 GNUNET_h2s ((struct GNUNET_HashCode *) &ax->CKs)); 4382 GNUNET_i2s ((struct GNUNET_PeerIdentity *) &ax->CKs));
4384 LOG2 (level, "TTT CKr \t %s\n", 4383 LOG2 (level, "TTT CKr \t %s\n",
4385 GNUNET_h2s ((struct GNUNET_HashCode *) &ax->CKr)); 4384 GNUNET_i2s ((struct GNUNET_PeerIdentity *) &ax->CKr));
4386 4385
4387 GNUNET_CRYPTO_ecdhe_key_get_public (ax->DHRs, &pub); 4386 GNUNET_CRYPTO_ecdhe_key_get_public (ax->DHRs, &pub);
4388 LOG2 (level, "TTT DHRs\t %s\n", 4387 LOG2 (level, "TTT DHRs\t %s\n",
4389 GNUNET_h2s ((struct GNUNET_HashCode *) &pub)); 4388 GNUNET_i2s ((struct GNUNET_PeerIdentity *) &pub));
4390 LOG2 (level, "TTT DHRr\t %s\n", 4389 LOG2 (level, "TTT DHRr\t %s\n",
4391 GNUNET_h2s ((struct GNUNET_HashCode *) &ax->DHRr)); 4390 GNUNET_i2s ((struct GNUNET_PeerIdentity *) &ax->DHRr));
4392 4391
4393 LOG2 (level, "TTT Nr\t %u\tNs\t%u\n", ax->Nr, ax->Ns); 4392 LOG2 (level, "TTT Nr\t %u\tNs\t%u\n", ax->Nr, ax->Ns);
4394 LOG2 (level, "TTT PNs\t %u\tSkipped\t%u\n", ax->PNs, ax->skipped); 4393 LOG2 (level, "TTT PNs\t %u\tSkipped\t%u\n", ax->PNs, ax->skipped);
@@ -4397,9 +4396,9 @@ ax_debug (const struct CadetTunnelAxolotl *ax, enum GNUNET_ErrorType level)
4397 for (iter = ax->skipped_head; NULL != iter; iter = iter->next) 4396 for (iter = ax->skipped_head; NULL != iter; iter = iter->next)
4398 { 4397 {
4399 LOG2 (level, "TTT HK\t %s\n", 4398 LOG2 (level, "TTT HK\t %s\n",
4400 GNUNET_h2s ((struct GNUNET_HashCode *) &iter->HK)); 4399 GNUNET_i2s ((struct GNUNET_PeerIdentity *) &iter->HK));
4401 LOG2 (level, "TTT MK\t %s\n", 4400 LOG2 (level, "TTT MK\t %s\n",
4402 GNUNET_h2s ((struct GNUNET_HashCode *) &iter->MK)); 4401 GNUNET_i2s ((struct GNUNET_PeerIdentity *) &iter->MK));
4403 } 4402 }
4404} 4403}
4405 4404
@@ -4435,19 +4434,19 @@ GCT_debug (const struct CadetTunnel *t, enum GNUNET_ErrorType level)
4435 else 4434 else
4436 { 4435 {
4437 LOG2 (level, "TTT my EPHM\t %s\n", 4436 LOG2 (level, "TTT my EPHM\t %s\n",
4438 GNUNET_h2s ((struct GNUNET_HashCode *) &otr_kx_msg.ephemeral_key)); 4437 GNUNET_i2s ((struct GNUNET_PeerIdentity *) &otr_kx_msg.ephemeral_key));
4439 LOG2 (level, "TTT peers EPHM:\t %s\n", 4438 LOG2 (level, "TTT peers EPHM:\t %s\n",
4440 GNUNET_h2s ((struct GNUNET_HashCode *) &t->peers_ephemeral_key)); 4439 GNUNET_i2s ((struct GNUNET_PeerIdentity *) &t->peers_ephemeral_key));
4441 LOG2 (level, "TTT ENC key:\t %s\n", 4440 LOG2 (level, "TTT ENC key:\t %s\n",
4442 GNUNET_h2s ((struct GNUNET_HashCode *) &t->e_key)); 4441 GNUNET_i2s ((struct GNUNET_PeerIdentity *) &t->e_key));
4443 LOG2 (level, "TTT DEC key:\t %s\n", 4442 LOG2 (level, "TTT DEC key:\t %s\n",
4444 GNUNET_h2s ((struct GNUNET_HashCode *) &t->d_key)); 4443 GNUNET_i2s ((struct GNUNET_PeerIdentity *) &t->d_key));
4445 if (t->kx_ctx) 4444 if (t->kx_ctx)
4446 { 4445 {
4447 LOG2 (level, "TTT OLD ENC key:\t %s\n", 4446 LOG2 (level, "TTT OLD ENC key:\t %s\n",
4448 GNUNET_h2s ((struct GNUNET_HashCode *) &t->kx_ctx->e_key_old)); 4447 GNUNET_i2s ((struct GNUNET_PeerIdentity *) &t->kx_ctx->e_key_old));
4449 LOG2 (level, "TTT OLD DEC key:\t %s\n", 4448 LOG2 (level, "TTT OLD DEC key:\t %s\n",
4450 GNUNET_h2s ((struct GNUNET_HashCode *) &t->kx_ctx->d_key_old)); 4449 GNUNET_i2s ((struct GNUNET_PeerIdentity *) &t->kx_ctx->d_key_old));
4451 } 4450 }
4452 } 4451 }
4453#endif 4452#endif