summaryrefslogtreecommitdiffstats
path: root/src/method_xsalsa20_poly1305.c
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2013-02-23 20:16:13 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2013-02-23 20:16:13 +0100
commit54c6ff1c419fffcb12ae33e45208b6dbe8914c02 (patch)
tree2b09b7804d19871551b763bdcede76e414d09281 /src/method_xsalsa20_poly1305.c
parent48a3812435c15c77c1ae752322cff63c8e0b092d (diff)
downloadfastd-54c6ff1c419fffcb12ae33e45208b6dbe8914c02.tar
fastd-54c6ff1c419fffcb12ae33e45208b6dbe8914c02.zip
Subtract splay time to key refresh interval
A random splay time of up to 5 minutes will ensure that simultaneous handshakes with many peers are desynchronized as fast as possible.
Diffstat (limited to 'src/method_xsalsa20_poly1305.c')
-rw-r--r--src/method_xsalsa20_poly1305.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/method_xsalsa20_poly1305.c b/src/method_xsalsa20_poly1305.c
index 655f61b..4cadca9 100644
--- a/src/method_xsalsa20_poly1305.c
+++ b/src/method_xsalsa20_poly1305.c
@@ -102,7 +102,7 @@ static fastd_method_session_state_t* method_session_init(fastd_context_t *ctx, u
session->valid_till.tv_sec += ctx->conf->key_valid;
session->refresh_after = ctx->now;
- session->refresh_after.tv_sec += ctx->conf->key_refresh;
+ session->refresh_after.tv_sec += ctx->conf->key_refresh - fastd_rand(ctx, 0, ctx->conf->key_refresh_splay);
memcpy(session->key, secret, crypto_secretbox_xsalsa20poly1305_KEYBYTES);