aboutsummaryrefslogtreecommitdiffstats
path: root/src/device.rs
diff options
context:
space:
mode:
authorMathias Hall-Andersen <mathias@hall-andersen.dk>2019-07-17 16:28:21 +0200
committerMathias Hall-Andersen <mathias@hall-andersen.dk>2019-07-17 16:28:21 +0200
commit4817ca79060eb303452730aed4f4ad7ca44b8579 (patch)
tree8790b0c4e80613bd393b6a435b4866bde5fa03f0 /src/device.rs
parentUse precomputed static-static (diff)
downloadwireguard-rs-4817ca79060eb303452730aed4f4ad7ca44b8579.tar.xz
wireguard-rs-4817ca79060eb303452730aed4f4ad7ca44b8579.zip
Better seperation and introduction of timestamp
Diffstat (limited to 'src/device.rs')
-rw-r--r--src/device.rs11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/device.rs b/src/device.rs
index 6107e34..928863a 100644
--- a/src/device.rs
+++ b/src/device.rs
@@ -9,6 +9,7 @@ use x25519_dalek::StaticSecret;
use crate::noise;
use crate::types::*;
+use crate::peer::Peer;
pub struct Device {
pub sk : StaticSecret, // static secret key
@@ -62,12 +63,10 @@ impl Device {
// map : new index -> peer
- self.peers.push(Peer {
- state : Mutex::new(State::Reset{ts : None}),
- pk : pk,
- ss : self.sk.diffie_hellman(&pk),
- psk : [0u8; 32]
- });
+ self.peers.push(Peer::new(
+ pk,
+ self.sk.diffie_hellman(&pk)
+ ));
Ok(())
}