From 1cfd5aea1aba4b01905414351df13e8f5d4dfb1c Mon Sep 17 00:00:00 2001 From: Mathias Hall-Andersen Date: Tue, 30 Jul 2019 15:28:11 +0200 Subject: 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. --- src/handshake/macs.rs | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) (limited to 'src/handshake/macs.rs') 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], -- cgit v1.2.3-59-g8ed1b