aboutsummaryrefslogtreecommitdiffstats
path: root/src/handshake/macs.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/macs.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/macs.rs')
-rw-r--r--src/handshake/macs.rs13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/handshake/macs.rs b/src/handshake/macs.rs
index 05546a7..9092daa 100644
--- a/src/handshake/macs.rs
+++ b/src/handshake/macs.rs
@@ -38,14 +38,14 @@ macro_rules! MAC {
}};
}
-struct Generator {
+pub struct Generator {
mac1_key: [u8; 32],
cookie_value: [u8; 16],
cookie_birth: Option<Instant>, // when was the cookie set?
}
impl Generator {
- fn new(pk: PublicKey) -> Generator {
+ pub fn new(pk: PublicKey) -> Generator {
Generator {
mac1_key: HASH!(LABEL_MAC1, pk.as_bytes()).into(),
cookie_value: [0u8; SIZE_COOKIE],
@@ -66,14 +66,11 @@ impl Generator {
self.cookie_value = *cookie;
}
- pub fn generate(&self, msg: &[u8]) -> MacsFooter {
- MacsFooter {
- f_mac1: self.mac1(msg),
- f_mac2: self.mac2(msg),
- }
+ pub fn generate(&self, inner: &[u8], macs : &mut MacsFooter) {
+
}
}
-struct Validator {}
+pub struct Validator {}
impl Validator {}