aboutsummaryrefslogtreecommitdiffstats
path: root/src/wireguard/handshake
diff options
context:
space:
mode:
Diffstat (limited to 'src/wireguard/handshake')
-rw-r--r--src/wireguard/handshake/device.rs16
-rw-r--r--src/wireguard/handshake/peer.rs1
2 files changed, 10 insertions, 7 deletions
diff --git a/src/wireguard/handshake/device.rs b/src/wireguard/handshake/device.rs
index 02e6929..030c0f8 100644
--- a/src/wireguard/handshake/device.rs
+++ b/src/wireguard/handshake/device.rs
@@ -469,6 +469,10 @@ mod tests {
(pk1, dev1, pk2, dev2)
}
+ fn wait() {
+ thread::sleep(Duration::from_millis(20));
+ }
+
/* Test longest possible handshake interaction (7 messages):
*
* 1. I -> R (initation)
@@ -502,8 +506,8 @@ mod tests {
_ => panic!("unexpected response"),
}
- // avoid initation flood
- thread::sleep(Duration::from_millis(20));
+ // avoid initation flood detection
+ wait();
// 3. device-1 : create second initation
let msg_init = dev1.begin(&mut rng, &pk2).unwrap();
@@ -529,8 +533,8 @@ mod tests {
_ => panic!("unexpected response"),
}
- // avoid initation flood
- thread::sleep(Duration::from_millis(20));
+ // avoid initation flood detection
+ wait();
// 6. device-1 : create third initation
let msg_init = dev1.begin(&mut rng, &pk2).unwrap();
@@ -600,8 +604,8 @@ mod tests {
dev1.release(ks_i.send.id);
dev2.release(ks_r.send.id);
- // to avoid flood detection
- thread::sleep(Duration::from_millis(20));
+ // avoid initation flood detection
+ wait();
}
dev1.remove(pk2).unwrap();
diff --git a/src/wireguard/handshake/peer.rs b/src/wireguard/handshake/peer.rs
index abb36eb..2d69244 100644
--- a/src/wireguard/handshake/peer.rs
+++ b/src/wireguard/handshake/peer.rs
@@ -7,7 +7,6 @@ use generic_array::typenum::U32;
use generic_array::GenericArray;
use x25519_dalek::PublicKey;
-use x25519_dalek::SharedSecret;
use x25519_dalek::StaticSecret;
use clear_on_drop::clear::Clear;