aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/interface/peer_server.rs4
-rw-r--r--src/peer.rs8
2 files changed, 1 insertions, 11 deletions
diff --git a/src/interface/peer_server.rs b/src/interface/peer_server.rs
index 780871f..9616ba2 100644
--- a/src/interface/peer_server.rs
+++ b/src/interface/peer_server.rs
@@ -181,8 +181,6 @@ impl PeerServer {
}
fn handle_ingress_handshake_init(&mut self, addr: Endpoint, packet: &Initiation) -> Result<(), Error> {
- ensure!(packet.len() == 148, "handshake init packet length is incorrect");
-
let shared_state = self.shared_state.clone();
let mut state = shared_state.borrow_mut();
let (mac_in, mac_out) = packet.split_at(116);
@@ -227,8 +225,6 @@ impl PeerServer {
}
fn handle_ingress_handshake_resp(&mut self, addr: Endpoint, packet: &Response) -> Result<(), Error> {
- ensure!(packet.len() == 92, "handshake resp packet length is incorrect");
-
let (mac_in, mac_out) = packet.split_at(60);
self.cookie.verify_mac1(&mac_in[..], &mac_out[..16])?;
diff --git a/src/peer.rs b/src/peer.rs
index 0208418..a6cc215 100644
--- a/src/peer.rs
+++ b/src/peer.rs
@@ -271,13 +271,7 @@ impl Peer {
ensure!(&timestamp > last_tai64n, "handshake timestamp earlier than last handshake's timestamp");
}
- // TODO: hacked up API until it's officially supported in snow.
- match noise {
- snow::Session::Handshake(ref mut handshake_state) => {
- handshake_state.set_psk(2, &self.info.psk.unwrap_or_else(|| [0u8; 32]));
- },
- _ => unreachable!()
- }
+ noise.set_psk(2, &self.info.psk.unwrap_or_else(|| [0u8; 32]))?;
let mut next_session = Session::with_their_index(noise, index, their_index);
next_session.birthday = Timestamp::now();