mirror of https://github.com/dswd/vpncloud.git
Forgot to call sodium_init (re #1)
This commit is contained in:
parent
f6d5c7bbee
commit
1d82c2b017
|
@ -2,3 +2,4 @@ target
|
||||||
vpncloud-oldnodes
|
vpncloud-oldnodes
|
||||||
._*
|
._*
|
||||||
vpncloud.1*
|
vpncloud.1*
|
||||||
|
*sodium
|
||||||
|
|
|
@ -5,6 +5,10 @@ pub enum Crypto {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Crypto {
|
impl Crypto {
|
||||||
|
pub fn init() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
pub fn method(&self) -> u8 {
|
pub fn method(&self) -> u8 {
|
||||||
0
|
0
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,10 @@ fn inc_nonce(nonce: [u8; 8]) -> [u8; 8] {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Crypto {
|
impl Crypto {
|
||||||
|
pub fn init() {
|
||||||
|
unsafe { sodium_init() };
|
||||||
|
}
|
||||||
|
|
||||||
pub fn method(&self) -> u8 {
|
pub fn method(&self) -> u8 {
|
||||||
match self {
|
match self {
|
||||||
&Crypto::None => 0,
|
&Crypto::None => 0,
|
||||||
|
@ -40,6 +44,7 @@ impl Crypto {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn from_shared_key(password: &str) -> Self {
|
pub fn from_shared_key(password: &str) -> Self {
|
||||||
|
|
||||||
let salt = "vpncloudVPNCLOUDvpncl0udVpnCloud".as_bytes();
|
let salt = "vpncloudVPNCLOUDvpncl0udVpnCloud".as_bytes();
|
||||||
assert_eq!(salt.len(), crypto_pwhash_scryptsalsa208sha256_SALTBYTES);
|
assert_eq!(salt.len(), crypto_pwhash_scryptsalsa208sha256_SALTBYTES);
|
||||||
let mut key = [0; crypto_pwhash_scryptsalsa208sha256_STRBYTES];
|
let mut key = [0; crypto_pwhash_scryptsalsa208sha256_STRBYTES];
|
||||||
|
|
|
@ -111,6 +111,7 @@ fn run<T: Protocol> (args: Args) {
|
||||||
name.hash(&mut s);
|
name.hash(&mut s);
|
||||||
s.finish()
|
s.finish()
|
||||||
});
|
});
|
||||||
|
Crypto::init();
|
||||||
let crypto = match args.flag_shared_key {
|
let crypto = match args.flag_shared_key {
|
||||||
Some(key) => Crypto::from_shared_key(&key),
|
Some(key) => Crypto::from_shared_key(&key),
|
||||||
None => Crypto::None
|
None => Crypto::None
|
||||||
|
|
Loading…
Reference in New Issue