summaryrefslogtreecommitdiffstats
path: root/src/method_aes128_gcm.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_aes128_gcm.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_aes128_gcm.c')
-rw-r--r--src/method_aes128_gcm.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/method_aes128_gcm.c b/src/method_aes128_gcm.c
index 7dfabef..867e873 100644
--- a/src/method_aes128_gcm.c
+++ b/src/method_aes128_gcm.c
@@ -109,7 +109,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);
fastd_block128_t key;
memcpy(key.b, secret, sizeof(fastd_block128_t));