/// New noise params struct from our secret key, peers public key, and optional preshared key
New noise params struct from our secret key, peers public key, and optional preshared key
New noise params struct from our secret key peers public key and optional preshared key
fn new(
        static_private: Arc<StaticSecret>,
        peer_static_public: Arc<PublicKey>,
        preshared_key: Option<PresharedSecret>,
    ) -> Result<NoiseParams, WireGuardError> {
        // TODO: fix this hack
        let temp = StaticSecret::from(static_private.to_bytes());
        let static_public = PublicKey::from(&temp);
        // precompute static_static
        let static_static = static_private.diffie_hellman(&peer_static_public);
        let initial_sending_mac_key = HASH!(LABEL_MAC1, peer_static_public.as_bytes()[..]);
        let initial_receiving_mac_key = HASH!(LABEL_MAC1, static_public.as_bytes()[..]);
        Ok(NoiseParams {
            static_public,
            static_private,
            peer_static_public,
            static_static,
            sending_mac1_key: initial_sending_mac_key,
            receiving_mac1_key: initial_receiving_mac_key,
            preshared_key,
        })
    }
fn new ( static_private : Arc < StaticSecret > , peer_static_public : Arc < PublicKey > , preshared_key : Option < PresharedSecret > , ) -> Result < NoiseParams , WireGuardError > { // TODO: fix this hack let temp = StaticSecret :: from ( static_private . to_bytes ( ) ) ; let static_public = PublicKey :: from ( & temp ) ; // precompute static_static let static_static = static_private . diffie_hellman ( & peer_static_public ) ; let initial_sending_mac_key = HASH ! ( LABEL_MAC1 peer_static_public as_bytes ( ) [ ] ) ; let initial_receiving_mac_key = HASH ! ( LABEL_MAC1 static_public as_bytes ( ) [ ] ) ; Ok ( NoiseParams { static_public , static_private , peer_static_public , static_static , sending_mac1_key : initial_sending_mac_key , receiving_mac1_key : initial_receiving_mac_key , preshared_key , } ) }
New noise params struct from our secret key, peers public key, and optional preshared key
New noise params struct from our secret key peers public key and optional preshared key
static_private
Arc<StaticSecret>
peer_static_public
Arc<PublicKey>
preshared_key
Option<PresharedSecret>