aboutsummaryrefslogtreecommitdiffstats
path: root/src/wireguard/handshake/peer.rs
diff options
context:
space:
mode:
authorMathias Hall-Andersen <mathias@hall-andersen.dk>2019-11-08 19:00:12 +0100
committerMathias Hall-Andersen <mathias@hall-andersen.dk>2019-11-08 19:00:12 +0100
commitdd85201c15244fbd380eef8ee359a535335b7250 (patch)
tree5ccbb72702b7c5da8e6ab570bde192f66fff66bc /src/wireguard/handshake/peer.rs
parentImplement disable/enable timers (diff)
downloadwireguard-rs-dd85201c15244fbd380eef8ee359a535335b7250.tar.xz
wireguard-rs-dd85201c15244fbd380eef8ee359a535335b7250.zip
Removal of secret key in the handshake module
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],
}
}