aboutsummaryrefslogtreecommitdiffstats
path: root/src/handshake/peer.rs
diff options
context:
space:
mode:
authorMathias Hall-Andersen <mathias@hall-andersen.dk>2019-08-01 11:12:30 +0200
committerMathias Hall-Andersen <mathias@hall-andersen.dk>2019-08-01 11:12:30 +0200
commitab98d9dcedf02553b8d3321cc876b066adb11dd6 (patch)
treedc8185ac0723a4fe7d77c8ca74ee98c5edd73ad6 /src/handshake/peer.rs
parentMove to nested handshake message structure (diff)
downloadwireguard-rs-ab98d9dcedf02553b8d3321cc876b066adb11dd6.tar.xz
wireguard-rs-ab98d9dcedf02553b8d3321cc876b066adb11dd6.zip
Make unit tests pass
Diffstat (limited to 'src/handshake/peer.rs')
-rw-r--r--src/handshake/peer.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/handshake/peer.rs b/src/handshake/peer.rs
index 5b01d75..309a9cf 100644
--- a/src/handshake/peer.rs
+++ b/src/handshake/peer.rs
@@ -10,6 +10,7 @@ use x25519_dalek::StaticSecret;
use super::device::Device;
use super::timestamp;
use super::types::*;
+use super::macs;
/* Represents the recomputation and state of a peer.
*
@@ -24,6 +25,9 @@ pub struct Peer<T> {
state: Mutex<State>,
timestamp: Mutex<Option<timestamp::TAI64N>>,
+ // state related to DoS mitigation fields
+ pub(crate) macs: macs::Generator,
+
// constant state
pub(crate) pk: PublicKey, // public key of peer
pub(crate) ss: SharedSecret, // precomputed DH(static, static)
@@ -69,6 +73,7 @@ where
ss: SharedSecret, // precomputed DH(static, static)
) -> Self {
Self {
+ macs: macs::Generator::new(pk),
identifier: identifier,
state: Mutex::new(State::Reset),
timestamp: Mutex::new(None),