summaryrefslogtreecommitdiffstats
path: root/src/protocols/ec25519_fhmqvc/state.c
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2014-01-26 05:17:34 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2014-01-26 05:17:34 +0100
commit76d955efa5fcd46fd325015d6cd3a389f8d9bb93 (patch)
tree69956b73a9ca9f692a5a95759eb7dedffea62e12 /src/protocols/ec25519_fhmqvc/state.c
parent9fe7f35ce87dceb368c7ddffd7f6902dca24b97a (diff)
downloadfastd-76d955efa5fcd46fd325015d6cd3a389f8d9bb93.tar
fastd-76d955efa5fcd46fd325015d6cd3a389f8d9bb93.zip
Get rid of long_ago variable, use timeout helpers
Diffstat (limited to 'src/protocols/ec25519_fhmqvc/state.c')
-rw-r--r--src/protocols/ec25519_fhmqvc/state.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/protocols/ec25519_fhmqvc/state.c b/src/protocols/ec25519_fhmqvc/state.c
index 990d1f0..d7fd151 100644
--- a/src/protocols/ec25519_fhmqvc/state.c
+++ b/src/protocols/ec25519_fhmqvc/state.c
@@ -32,8 +32,8 @@ static void init_protocol_state(fastd_context_t *ctx) {
if (!ctx->protocol_state) {
ctx->protocol_state = calloc(1, sizeof(fastd_protocol_state_t));
- ctx->protocol_state->prev_handshake_key.preferred_till = ctx->conf->long_ago;
- ctx->protocol_state->handshake_key.preferred_till = ctx->conf->long_ago;
+ ctx->protocol_state->prev_handshake_key.preferred_till = ctx->now;
+ ctx->protocol_state->handshake_key.preferred_till = ctx->now;
}
}
@@ -58,11 +58,8 @@ void fastd_protocol_ec25519_fhmqvc_maintenance(fastd_context_t *ctx) {
new_handshake_key(ctx, &ctx->protocol_state->handshake_key.key);
- ctx->protocol_state->handshake_key.preferred_till = ctx->now;
- ctx->protocol_state->handshake_key.preferred_till.tv_sec += 15;
-
- ctx->protocol_state->handshake_key.valid_till = ctx->now;
- ctx->protocol_state->handshake_key.valid_till.tv_sec += 30;
+ ctx->protocol_state->handshake_key.preferred_till = fastd_in_seconds(ctx, 15);
+ ctx->protocol_state->handshake_key.valid_till = fastd_in_seconds(ctx, 30);
}
}