aboutsummaryrefslogtreecommitdiffstats
path: root/src/handshake/macs.rs
diff options
context:
space:
mode:
authorMathias Hall-Andersen <mathias@hall-andersen.dk>2019-07-30 15:28:11 +0200
committerMathias Hall-Andersen <mathias@hall-andersen.dk>2019-07-30 15:28:11 +0200
commit1cfd5aea1aba4b01905414351df13e8f5d4dfb1c (patch)
tree1ddc2d7a08a486676e9cf045f31a1fe0d5714bc5 /src/handshake/macs.rs
parentBegin work on MAC field processing (diff)
downloadwireguard-rs-1cfd5aea1aba4b01905414351df13e8f5d4dfb1c.tar.xz
wireguard-rs-1cfd5aea1aba4b01905414351df13e8f5d4dfb1c.zip
Move to nested handshake message structure
Having the nested structure: Handshake Message: Noise part (zerocopy message) MAC footer part (zerocopy message) Greatly simplifies processing the MAC fields, since the MAC footer covers the noise part, which can be accessed as bytes using AsBytes.
Diffstat (limited to '')
-rw-r--r--src/handshake/macs.rs18
1 files changed, 1 insertions, 17 deletions
diff --git a/src/handshake/macs.rs b/src/handshake/macs.rs
index c8b97e3..05546a7 100644
--- a/src/handshake/macs.rs
+++ b/src/handshake/macs.rs
@@ -4,7 +4,7 @@ use blake2::Blake2s;
use subtle::ConstantTimeEq;
use x25519_dalek::PublicKey;
-use zerocopy::{AsBytes, ByteSlice, FromBytes, LayoutVerified};
+use super::messages::{CookieReply, MacsFooter};
const LABEL_MAC1: &[u8] = b"mac1----";
const LABEL_COOKIE: &[u8] = b"cookie--";
@@ -38,22 +38,6 @@ macro_rules! MAC {
}};
}
-#[repr(C)]
-#[derive(Copy, Clone, FromBytes, AsBytes)]
-pub struct MacsFooter {
- pub f_mac1: [u8; SIZE_MAC],
- pub f_mac2: [u8; SIZE_MAC],
-}
-
-impl Default for MacsFooter {
- fn default() -> Self {
- Self {
- f_mac1: [0u8; SIZE_MAC],
- f_mac2: [0u8; SIZE_MAC],
- }
- }
-}
-
struct Generator {
mac1_key: [u8; 32],
cookie_value: [u8; 16],