Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- humbug@home:~/zetox$ git diff | cat
- diff --git a/Cargo.toml b/Cargo.toml
- index 9206765..b4f0b15 100644
- --- a/Cargo.toml
- +++ b/Cargo.toml
- @@ -33,7 +33,7 @@ bytes = "0.4"
- byteorder = "1"
- futures = "0.1"
- log = "0.4"
- -sodiumoxide = "0.0.16"
- +sodiumoxide = "0.1"
- tokio = "0.1.7"
- tokio-codec = "0.1"
- nom = "3.2.1"
- diff --git a/src/toxcore/crypto_core.rs b/src/toxcore/crypto_core.rs
- index 8a3702b..f7cff64 100644
- --- a/src/toxcore/crypto_core.rs
- +++ b/src/toxcore/crypto_core.rs
- @@ -26,17 +26,12 @@ pub use sodiumoxide::crypto::box_::*;
- pub use sodiumoxide::crypto::hash::{sha256, sha512};
- pub use sodiumoxide::crypto::secretbox;
- -use std::sync::{Once, ONCE_INIT};
- use byteorder::{ByteOrder, NativeEndian};
- use toxcore::binary_io::*;
- // TODO: check if `#[inline]` is actually useful
- -
- -static CRYPTO_INIT_ONCE: Once = ONCE_INIT;
- -static mut CRYPTO_INIT: bool = false;
- -
- /** Run before using crypto.
- Runs [`sodiumoxide::init()`](../../../sodiumoxide/fn.init.html).
- @@ -54,14 +49,7 @@ assert_eq!(true, crypto_init());
- ```
- */
- pub fn crypto_init() -> bool {
- - // NOTE: `init()` could be run more than once, but not in parallel, and
- - // `CRYPTO_INIT` *can't* be modified while it may be read by
- - // something else.
- - CRYPTO_INIT_ONCE.call_once(|| {
- - let initialized = ::sodiumoxide::init();
- - unsafe { CRYPTO_INIT = initialized; }
- - });
- - unsafe { CRYPTO_INIT }
- + ::sodiumoxide::init().is_ok()
- }
Add Comment
Please, Sign In to add comment