summaryrefslogtreecommitdiffstats
path: root/src/methods/common.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/methods/common.c')
-rw-r--r--src/methods/common.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/methods/common.c b/src/methods/common.c
index 166d3ab..17722cf 100644
--- a/src/methods/common.c
+++ b/src/methods/common.c
@@ -27,11 +27,11 @@
#include "common.h"
-void fastd_method_common_init(fastd_context_t *ctx, fastd_method_common_t *session, bool initiator) {
+void fastd_method_common_init(fastd_method_common_t *session, bool initiator) {
memset(session, 0, sizeof(*session));
- session->valid_till = fastd_in_seconds(ctx, conf.key_valid);
- session->refresh_after = fastd_in_seconds(ctx, conf.key_refresh - fastd_rand(ctx, 0, conf.key_refresh_splay));
+ session->valid_till = fastd_in_seconds(conf.key_valid);
+ session->refresh_after = fastd_in_seconds(conf.key_refresh - fastd_rand(0, conf.key_refresh_splay));
if (initiator) {
session->send_nonce[COMMON_NONCEBYTES-1] = 3;
@@ -42,7 +42,7 @@ void fastd_method_common_init(fastd_context_t *ctx, fastd_method_common_t *sessi
}
}
-bool fastd_method_is_nonce_valid(fastd_context_t *ctx, const fastd_method_common_t *session, const uint8_t nonce[COMMON_NONCEBYTES], int64_t *age) {
+bool fastd_method_is_nonce_valid(const fastd_method_common_t *session, const uint8_t nonce[COMMON_NONCEBYTES], int64_t *age) {
if ((nonce[0] & 1) != (session->receive_nonce[0] & 1))
return false;
@@ -57,7 +57,7 @@ bool fastd_method_is_nonce_valid(fastd_context_t *ctx, const fastd_method_common
*age >>= 1;
if (*age >= 0) {
- if (fastd_timed_out(ctx, &session->reorder_timeout))
+ if (fastd_timed_out(&session->reorder_timeout))
return false;
if (*age > 64)
@@ -67,7 +67,7 @@ bool fastd_method_is_nonce_valid(fastd_context_t *ctx, const fastd_method_common
return true;
}
-bool fastd_method_reorder_check(fastd_context_t *ctx, fastd_peer_t *peer, fastd_method_common_t *session, const uint8_t nonce[COMMON_NONCEBYTES], int64_t age) {
+bool fastd_method_reorder_check(fastd_peer_t *peer, fastd_method_common_t *session, const uint8_t nonce[COMMON_NONCEBYTES], int64_t age) {
if (age < 0) {
size_t shift = age < (-64) ? 64 : ((size_t)-age);
@@ -79,15 +79,15 @@ bool fastd_method_reorder_check(fastd_context_t *ctx, fastd_peer_t *peer, fastd_
session->receive_reorder_seen |= (1 << (shift-1));
memcpy(session->receive_nonce, nonce, COMMON_NONCEBYTES);
- session->reorder_timeout = fastd_in_seconds(ctx, conf.reorder_time);
+ session->reorder_timeout = fastd_in_seconds(conf.reorder_time);
return true;
}
else if (age == 0 || session->receive_reorder_seen & (1 << (age-1))) {
- pr_debug(ctx, "dropping duplicate packet from %P (age %u)", peer, (unsigned)age);
+ pr_debug("dropping duplicate packet from %P (age %u)", peer, (unsigned)age);
return false;
}
else {
- pr_debug2(ctx, "accepting reordered packet from %P (age %u)", peer, (unsigned)age);
+ pr_debug2("accepting reordered packet from %P (age %u)", peer, (unsigned)age);
session->receive_reorder_seen |= (1 << (age-1));
return true;
}