aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/noise.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/noise.c')
-rw-r--r--src/noise.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/noise.c b/src/noise.c
index 7b3c4d6..84bde39 100644
--- a/src/noise.c
+++ b/src/noise.c
@@ -284,7 +284,7 @@ static void symmetric_key_init(struct noise_symmetric_key *key)
spin_lock_init(&key->counter.receive.lock);
atomic64_set(&key->counter.counter, 0);
memset(key->counter.receive.backtrack, 0, sizeof(key->counter.receive.backtrack));
- key->birthdate = ktime_get_boottime();
+ key->birthdate = ktime_get_boot_fast_ns();
key->is_valid = true;
}
@@ -461,7 +461,7 @@ struct wireguard_peer *noise_handshake_consume_initiation(struct message_handsha
down_read(&handshake->lock);
replay_attack = memcmp(t, handshake->latest_timestamp, NOISE_TIMESTAMP_LEN) <= 0;
- flood_attack = ktime_after(ktime_add_ns(handshake->last_initiation_consumption, NSEC_PER_SEC / INITIATIONS_PER_SECOND), ktime_get_boottime());
+ flood_attack = handshake->last_initiation_consumption + NSEC_PER_SEC / INITIATIONS_PER_SECOND > ktime_get_boot_fast_ns();
up_read(&handshake->lock);
if (replay_attack || flood_attack) {
peer_put(wg_peer);
@@ -476,7 +476,7 @@ struct wireguard_peer *noise_handshake_consume_initiation(struct message_handsha
memcpy(handshake->hash, hash, NOISE_HASH_LEN);
memcpy(handshake->chaining_key, chaining_key, NOISE_HASH_LEN);
handshake->remote_index = src->sender_index;
- handshake->last_initiation_consumption = ktime_get_boottime();
+ handshake->last_initiation_consumption = ktime_get_boot_fast_ns();
handshake->state = HANDSHAKE_CONSUMED_INITIATION;
up_write(&handshake->lock);