summaryrefslogtreecommitdiffstats
path: root/src/wireguard/handshake/peer.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/wireguard/handshake/peer.rs')
-rw-r--r--src/wireguard/handshake/peer.rs15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/wireguard/handshake/peer.rs b/src/wireguard/handshake/peer.rs
index c9e1c40..abb36eb 100644
--- a/src/wireguard/handshake/peer.rs
+++ b/src/wireguard/handshake/peer.rs
@@ -33,9 +33,9 @@ pub struct Peer {
pub(crate) macs: Mutex<macs::Generator>,
// constant state
- pub(crate) pk: PublicKey, // public key of peer
- pub(crate) ss: SharedSecret, // precomputed DH(static, static)
- pub(crate) psk: Psk, // psk of peer
+ pub(crate) pk: PublicKey, // public key of peer
+ pub(crate) ss: [u8; 32], // precomputed DH(static, static)
+ pub(crate) psk: Psk, // psk of peer
}
pub enum State {
@@ -62,17 +62,14 @@ impl Drop for State {
}
impl Peer {
- pub fn new(
- pk: PublicKey, // public key of peer
- ss: SharedSecret, // precomputed DH(static, static)
- ) -> Self {
+ pub fn new(pk: PublicKey, ss: [u8; 32]) -> Self {
Self {
macs: Mutex::new(macs::Generator::new(pk)),
state: Mutex::new(State::Reset),
timestamp: Mutex::new(None),
last_initiation_consumption: Mutex::new(None),
- pk: pk,
- ss: ss,
+ pk,
+ ss,
psk: [0u8; 32],
}
}