diff options
-rw-r--r-- | src/cadet/cadet.h | 17 | ||||
-rw-r--r-- | src/cadet/gnunet-service-cadet_tunnel.c | 23 |
2 files changed, 26 insertions, 14 deletions
diff --git a/src/cadet/cadet.h b/src/cadet/cadet.h index 3ff93c254..049f3a85a 100644 --- a/src/cadet/cadet.h +++ b/src/cadet/cadet.h | |||
@@ -36,7 +36,22 @@ extern "C" | |||
36 | 36 | ||
37 | #include <stdint.h> | 37 | #include <stdint.h> |
38 | 38 | ||
39 | #define CADET_DEBUG GNUNET_YES | 39 | #if !defined(GNUNET_CULL_LOGGING) |
40 | #define CADET_TIMING_START \ | ||
41 | struct GNUNET_TIME_Absolute __timestamp;\ | ||
42 | __timestamp = GNUNET_TIME_absolute_get() | ||
43 | |||
44 | #define CADET_TIMING_END \ | ||
45 | struct GNUNET_TIME_Relative __duration;\ | ||
46 | __duration = GNUNET_TIME_absolute_get_duration (__timestamp);\ | ||
47 | LOG (GNUNET_ERROR_TYPE_INFO, " %s duration %s\n",\ | ||
48 | __FUNCTION__,\ | ||
49 | GNUNET_STRINGS_relative_time_to_string (__duration, GNUNET_YES)); | ||
50 | #else | ||
51 | #define CADET_TIMING_START | ||
52 | #define CADET_TIMING_END | ||
53 | #endif | ||
54 | |||
40 | 55 | ||
41 | #include "platform.h" | 56 | #include "platform.h" |
42 | #include "gnunet_util_lib.h" | 57 | #include "gnunet_util_lib.h" |
diff --git a/src/cadet/gnunet-service-cadet_tunnel.c b/src/cadet/gnunet-service-cadet_tunnel.c index a19c1523e..e47d0bc96 100644 --- a/src/cadet/gnunet-service-cadet_tunnel.c +++ b/src/cadet/gnunet-service-cadet_tunnel.c | |||
@@ -38,9 +38,9 @@ | |||
38 | #define REKEY_WAIT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 5) | 38 | #define REKEY_WAIT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 5) |
39 | 39 | ||
40 | #if !defined(GNUNET_CULL_LOGGING) | 40 | #if !defined(GNUNET_CULL_LOGGING) |
41 | #define DUMP_KEYS_TO_STDERR GNUNET_YES | 41 | #define DUMP_KEYS_TO_STDERR GNUNET_YES |
42 | #else | 42 | #else |
43 | #define DUMP_KEYS_TO_STDERR GNUNET_YES | 43 | #define DUMP_KEYS_TO_STDERR GNUNET_NO |
44 | #endif | 44 | #endif |
45 | 45 | ||
46 | #define MIN_TUNNEL_BUFFER 8 | 46 | #define MIN_TUNNEL_BUFFER 8 |
@@ -50,7 +50,6 @@ | |||
50 | #define AX_HEADER_SIZE (sizeof (uint32_t) * 2\ | 50 | #define AX_HEADER_SIZE (sizeof (uint32_t) * 2\ |
51 | + sizeof (struct GNUNET_CRYPTO_EcdhePublicKey)) | 51 | + sizeof (struct GNUNET_CRYPTO_EcdhePublicKey)) |
52 | 52 | ||
53 | |||
54 | /******************************************************************************/ | 53 | /******************************************************************************/ |
55 | /******************************** STRUCTS **********************************/ | 54 | /******************************** STRUCTS **********************************/ |
56 | /******************************************************************************/ | 55 | /******************************************************************************/ |
@@ -732,14 +731,11 @@ t_ax_encrypt (struct CadetTunnel *t, void *dst, const void *src, size_t size) | |||
732 | struct GNUNET_CRYPTO_SymmetricInitializationVector iv; | 731 | struct GNUNET_CRYPTO_SymmetricInitializationVector iv; |
733 | struct CadetTunnelAxolotl *ax; | 732 | struct CadetTunnelAxolotl *ax; |
734 | size_t out_size; | 733 | size_t out_size; |
735 | struct GNUNET_TIME_Absolute start_time; | ||
736 | struct GNUNET_TIME_Relative duration; | ||
737 | 734 | ||
738 | LOG (GNUNET_ERROR_TYPE_DEBUG, " t_ax_encrypt start\n"); | 735 | CADET_TIMING_START; |
739 | start_time = GNUNET_TIME_absolute_get (); | ||
740 | 736 | ||
737 | LOG (GNUNET_ERROR_TYPE_DEBUG, " t_ax_encrypt start\n"); | ||
741 | ax = t->ax; | 738 | ax = t->ax; |
742 | |||
743 | ax->ratchet_counter++; | 739 | ax->ratchet_counter++; |
744 | if (GNUNET_YES == ax->ratchet_allowed | 740 | if (GNUNET_YES == ax->ratchet_allowed |
745 | && (ratchet_messages <= ax->ratchet_counter | 741 | && (ratchet_messages <= ax->ratchet_counter |
@@ -788,13 +784,9 @@ t_ax_encrypt (struct CadetTunnel *t, void *dst, const void *src, size_t size) | |||
788 | #endif | 784 | #endif |
789 | 785 | ||
790 | out_size = GNUNET_CRYPTO_symmetric_encrypt (src, size, &MK, &iv, dst); | 786 | out_size = GNUNET_CRYPTO_symmetric_encrypt (src, size, &MK, &iv, dst); |
791 | |||
792 | t_hmac_derive_key (&ax->CKs, &ax->CKs, "1", 1); | 787 | t_hmac_derive_key (&ax->CKs, &ax->CKs, "1", 1); |
793 | 788 | ||
794 | duration = GNUNET_TIME_absolute_get_duration (start_time); | 789 | CADET_TIMING_END; |
795 | LOG (GNUNET_ERROR_TYPE_DEBUG, " t_ax_encrypt duration %s\n", | ||
796 | GNUNET_STRINGS_relative_time_to_string (duration, GNUNET_YES)); | ||
797 | LOG (GNUNET_ERROR_TYPE_DEBUG, " t_ax_encrypt end\n"); | ||
798 | 790 | ||
799 | return out_size; | 791 | return out_size; |
800 | } | 792 | } |
@@ -2010,6 +2002,8 @@ GCT_handle_kx (struct CadetTunnel *t, | |||
2010 | const struct GNUNET_PeerIdentity *pid; | 2002 | const struct GNUNET_PeerIdentity *pid; |
2011 | int am_I_alice; | 2003 | int am_I_alice; |
2012 | 2004 | ||
2005 | CADET_TIMING_START; | ||
2006 | |||
2013 | LOG (GNUNET_ERROR_TYPE_INFO, "<== { KX} on %s\n", GCT_2s (t)); | 2007 | LOG (GNUNET_ERROR_TYPE_INFO, "<== { KX} on %s\n", GCT_2s (t)); |
2014 | 2008 | ||
2015 | if (NULL == t->ax) | 2009 | if (NULL == t->ax) |
@@ -2130,8 +2124,11 @@ GCT_handle_kx (struct CadetTunnel *t, | |||
2130 | ax->PNs = 0; | 2124 | ax->PNs = 0; |
2131 | ax->Nr = 0; | 2125 | ax->Nr = 0; |
2132 | ax->Ns = 0; | 2126 | ax->Ns = 0; |
2127 | |||
2133 | GCT_change_estate (t, CADET_TUNNEL_KEY_PING); | 2128 | GCT_change_estate (t, CADET_TUNNEL_KEY_PING); |
2134 | send_queued_data (t); | 2129 | send_queued_data (t); |
2130 | |||
2131 | CADET_TIMING_END; | ||
2135 | } | 2132 | } |
2136 | 2133 | ||
2137 | /** | 2134 | /** |