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.1*
|
||||
*sodium
|
||||
|
|
|
@ -5,6 +5,10 @@ pub enum Crypto {
|
|||
}
|
||||
|
||||
impl Crypto {
|
||||
pub fn init() {
|
||||
|
||||
}
|
||||
|
||||
pub fn method(&self) -> u8 {
|
||||
0
|
||||
}
|
||||
|
|
|
@ -18,6 +18,10 @@ fn inc_nonce(nonce: [u8; 8]) -> [u8; 8] {
|
|||
}
|
||||
|
||||
impl Crypto {
|
||||
pub fn init() {
|
||||
unsafe { sodium_init() };
|
||||
}
|
||||
|
||||
pub fn method(&self) -> u8 {
|
||||
match self {
|
||||
&Crypto::None => 0,
|
||||
|
@ -40,6 +44,7 @@ impl Crypto {
|
|||
}
|
||||
|
||||
pub fn from_shared_key(password: &str) -> Self {
|
||||
|
||||
let salt = "vpncloudVPNCLOUDvpncl0udVpnCloud".as_bytes();
|
||||
assert_eq!(salt.len(), crypto_pwhash_scryptsalsa208sha256_SALTBYTES);
|
||||
let mut key = [0; crypto_pwhash_scryptsalsa208sha256_STRBYTES];
|
||||
|
|
|
@ -111,6 +111,7 @@ fn run<T: Protocol> (args: Args) {
|
|||
name.hash(&mut s);
|
||||
s.finish()
|
||||
});
|
||||
Crypto::init();
|
||||
let crypto = match args.flag_shared_key {
|
||||
Some(key) => Crypto::from_shared_key(&key),
|
||||
None => Crypto::None
|
||||
|
|
Loading…
Reference in New Issue