Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions boringtun/src/noise/handshake.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) 2019 Cloudflare, Inc. All rights reserved.
// SPDX-License-Identifier: BSD-3-Clause

use super::timers::COOKIE_EXPIRATION_TIME;
use super::timers::{COOKIE_EXPIRATION_TIME, REKEY_TIMEOUT};
use super::{HandshakeInit, HandshakeResponse, PacketCookieReply};
use crate::noise::errors::WireGuardError;
use crate::noise::session::Session;
Expand Down Expand Up @@ -442,15 +442,17 @@ impl Handshake {
!matches!(self.state, HandshakeState::None | HandshakeState::Expired)
}

pub(crate) fn timer(&self) -> Option<(Instant, u32)> {
match self.state {
HandshakeState::InitSent(HandshakeInitSentState {
time_sent,
local_index,
..
}) => Some((time_sent, local_index)),
_ => None,
}
pub(crate) fn rekey_timeout(&self) -> Option<(Instant, u32)> {
let HandshakeState::InitSent(HandshakeInitSentState {
time_sent,
local_index,
..
}) = self.state
else {
return None;
};

Some((time_sent + REKEY_TIMEOUT, local_index))
}

pub(crate) fn set_expired(&mut self) {
Expand Down
Loading
Loading