diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-03-02 22:40:58 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-03-02 22:40:58 +0000 |
commit | 9d1521268727d41c5c9ef30d3568125d6f0ac379 (patch) | |
tree | a5f0df9ed0bf76c2e37076baf2432937d7890805 /src/core | |
parent | 86d63901b65ec2a654bb7bb58a9fc962a6dc746d (diff) | |
download | gnunet-9d1521268727d41c5c9ef30d3568125d6f0ac379.tar.gz gnunet-9d1521268727d41c5c9ef30d3568125d6f0ac379.zip |
do not verify an ephemeral key again if it is the same as the previous key
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/gnunet-service-core_kx.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/core/gnunet-service-core_kx.c b/src/core/gnunet-service-core_kx.c index f0cc835e7..07f51cb49 100644 --- a/src/core/gnunet-service-core_kx.c +++ b/src/core/gnunet-service-core_kx.c | |||
@@ -743,6 +743,18 @@ GSC_KX_handle_ephemeral_key (struct GSC_KeyExchangeInfo *kx, | |||
743 | return; | 743 | return; |
744 | } | 744 | } |
745 | m = (const struct EphemeralKeyMessage *) msg; | 745 | m = (const struct EphemeralKeyMessage *) msg; |
746 | end_t = GNUNET_TIME_absolute_ntoh (m->expiration_time); | ||
747 | if ( ( (KX_STATE_KEY_RECEIVED == kx->status) || | ||
748 | (KX_STATE_UP == kx->status) || | ||
749 | (KX_STATE_REKEY_SENT == kx->status) ) && | ||
750 | (end_t.abs_value <= kx->foreign_key_expires.abs_value) ) | ||
751 | { | ||
752 | GNUNET_STATISTICS_update (GSC_stats, gettext_noop ("# old ephemeral keys ignored"), | ||
753 | 1, GNUNET_NO); | ||
754 | return; | ||
755 | } | ||
756 | start_t = GNUNET_TIME_absolute_ntoh (m->creation_time); | ||
757 | |||
746 | GNUNET_STATISTICS_update (GSC_stats, gettext_noop ("# ephemeral keys received"), | 758 | GNUNET_STATISTICS_update (GSC_stats, gettext_noop ("# ephemeral keys received"), |
747 | 1, GNUNET_NO); | 759 | 1, GNUNET_NO); |
748 | 760 | ||
@@ -774,8 +786,6 @@ GSC_KX_handle_ephemeral_key (struct GSC_KeyExchangeInfo *kx, | |||
774 | GNUNET_break_op (0); | 786 | GNUNET_break_op (0); |
775 | return; | 787 | return; |
776 | } | 788 | } |
777 | start_t = GNUNET_TIME_absolute_ntoh (m->creation_time); | ||
778 | end_t = GNUNET_TIME_absolute_ntoh (m->expiration_time); | ||
779 | now = GNUNET_TIME_absolute_get (); | 789 | now = GNUNET_TIME_absolute_get (); |
780 | if ( (end_t.abs_value < GNUNET_TIME_absolute_subtract (now, REKEY_TOLERANCE).abs_value) || | 790 | if ( (end_t.abs_value < GNUNET_TIME_absolute_subtract (now, REKEY_TOLERANCE).abs_value) || |
781 | (start_t.abs_value > GNUNET_TIME_absolute_add (now, REKEY_TOLERANCE).abs_value) ) | 791 | (start_t.abs_value > GNUNET_TIME_absolute_add (now, REKEY_TOLERANCE).abs_value) ) |