From 62a3780b48f67364d7ae072e41aabdf9d17f7736 Mon Sep 17 00:00:00 2001 From: Simon Wicky Date: Wed, 17 Apr 2024 16:13:53 +0200 Subject: [PATCH] qol changes --- src/crypto/mod.rs | 9 +++++---- src/header/keys.rs | 2 -- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/crypto/mod.rs b/src/crypto/mod.rs index eb15647..a03081d 100644 --- a/src/crypto/mod.rs +++ b/src/crypto/mod.rs @@ -18,10 +18,11 @@ use digest::generic_array::{ArrayLength, GenericArray}; use digest::{BlockInput, FixedOutput, Reset, Update}; use hmac::{crypto_mac, Hmac, Mac, NewMac}; -pub use x25519_dalek::{ - PublicKey, PublicKey as SharedSecret, StaticSecret as PrivateKey, - StaticSecret as EphemeralSecret, -}; +//type export and aliasing to keep compatibility +pub use x25519_dalek::PublicKey; +pub type SharedSecret = x25519_dalek::PublicKey; +pub type PrivateKey = x25519_dalek::StaticSecret; +pub type EphemeralSecret = x25519_dalek::StaticSecret; pub const STREAM_CIPHER_KEY_SIZE: usize = 16; pub const STREAM_CIPHER_INIT_VECTOR: [u8; 16] = [0u8; 16]; diff --git a/src/header/keys.rs b/src/header/keys.rs index 85498e5..513777e 100644 --- a/src/header/keys.rs +++ b/src/header/keys.rs @@ -112,8 +112,6 @@ impl KeyMaterial { let mut blinding_factors = vec![initial_secret.clone()]; for (i, node) in route.iter().enumerate() { - // (((pub^a)^b)^...) = pub^{a * b * ...} - // rhs is faster, but leads to security vulnerability, hence lhs is done let shared_key = blinding_factors .iter() .fold(node.pub_key, |acc, blinding_factor| {