mirror of
https://github.com/shadowsocks/shadowsocks-rust.git
synced 2026-11-21 16:06:14 +00:00
Bump to v1.6.4, add missing sodium_init() call
This commit is contained in:
Generated
+1
-1
@@ -1,6 +1,6 @@
|
||||
[root]
|
||||
name = "shadowsocks-rust"
|
||||
version = "1.6.3"
|
||||
version = "1.6.4"
|
||||
dependencies = [
|
||||
"base64 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"byte_string 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "shadowsocks-rust"
|
||||
version = "1.6.3"
|
||||
version = "1.6.4"
|
||||
authors = ["Y. T. CHUNG <zonyitoo@gmail.com>"]
|
||||
description = "shadowsocks is a fast tunnel proxy that helps you bypass firewalls."
|
||||
repository = "https://github.com/zonyitoo/shadowsocks-rust"
|
||||
|
||||
@@ -1,15 +1,19 @@
|
||||
//! Cipher defined with libsodium
|
||||
|
||||
use std::sync::{ONCE_INIT, Once};
|
||||
|
||||
use bytes::{BufMut, BytesMut};
|
||||
|
||||
use crypto::{CipherResult, CipherType, StreamCipher};
|
||||
|
||||
use libc::c_ulonglong;
|
||||
use libsodium_ffi::{crypto_stream_aes128ctr_xor, crypto_stream_chacha20_ietf_xor_ic, crypto_stream_chacha20_xor_ic,
|
||||
crypto_stream_salsa20_xor_ic, crypto_stream_xsalsa20_xor_ic};
|
||||
crypto_stream_salsa20_xor_ic, crypto_stream_xsalsa20_xor_ic, sodium_init};
|
||||
|
||||
use crypto::cipher::Error;
|
||||
|
||||
static SODIUM_INIT_FLAG: Once = ONCE_INIT;
|
||||
|
||||
/// Cipher provided by Rust-Crypto
|
||||
pub struct SodiumCipher {
|
||||
cipher_type: CipherType,
|
||||
@@ -32,6 +36,10 @@ impl SodiumCipher {
|
||||
_ => panic!("sodium cipher does not support {:?} cipher", t),
|
||||
}
|
||||
|
||||
SODIUM_INIT_FLAG.call_once(|| unsafe {
|
||||
assert_eq!(sodium_init(), 0);
|
||||
});
|
||||
|
||||
SodiumCipher {
|
||||
cipher_type: t,
|
||||
key: key.to_owned(),
|
||||
|
||||
Reference in New Issue
Block a user