diff --git a/README.md b/README.md index 89d6ba03..a37bf1fd 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ [![Build status](https://ci.appveyor.com/api/projects/status/h3ny0dov7v9xioa5?svg=true)](https://ci.appveyor.com/project/zonyitoo/shadowsocks-rust-0grjf) [![License](https://img.shields.io/github/license/zonyitoo/shadowsocks-rust.svg)](https://github.com/zonyitoo/shadowsocks-rust) [![crates.io](https://img.shields.io/crates/v/shadowsocks-rust.svg)](https://crates.io/crates/shadowsocks-rust) +[![Release](https://img.shields.io/github/release/shadowsocks/shadowsocks-rust.svg)](https://github.com/shadowsocks/shadowsocks-rust/releases) This is a port of [shadowsocks](https://github.com/shadowsocks/shadowsocks). @@ -30,33 +31,38 @@ then you can find `sslocal` and `ssserver` in `$CARGO_HOME/bin`. Requirements: -* Linux x86_64 +* Linux x86\_64 -Download static-linked built from [here](https://github.com/shadowsocks/shadowsocks-rust/releases). +Download static-linked build [here](https://github.com/shadowsocks/shadowsocks-rust/releases). ### **Build from source** ```bash -cargo build +cargo build --release ``` -NOTE: If you haven't installed libsodium in your system, you can set a environment variable `SODIUM_BUILD_STATIC=yes` to let `libsodium-ffi` to build from source, which requires you to have all the required build tools (including GCC, libtools, etc.). +NOTE: If you haven't installed the correct version of `libsodium` in your system, you can set a environment variable `SODIUM_BUILD_STATIC=yes` to let `libsodium-ffi` to build `libsodium` from source, which requires you to have build tools (including GCC, libtools, etc.) installed. -Then `sslocal` and `ssserver` will appear in `./target`, it works similarly as the two binaries in -the official ShadowSocks' implementation. +```bash +SODIUM_BUILD_STATIC=yes cargo build --release +``` + +Then `sslocal` and `ssserver` will appear in `./target/(debug|release)/`, it works similarly as the two binaries in the official ShadowSocks' implementation. ### **Build standalone binaries** Requirements: -* Linux x86_64 * Docker ```bash ./build/build-release ``` -Then `sslocal`, `ssserver` and `ssurl` will be packaged in `./build/shadowsocks-latest-release.x86_64-unknown-linux-musl.tar.gz`. +Then `sslocal`, `ssserver` and `ssurl` will be packaged in + +- `./build/shadowsocks-latest-release.x86_64-unknown-linux-musl.tar.gz` +- `./build/shadowsocks-latest-release.x86_64-unknown-linux-musl.tar.xz` Read `Cargo.toml` for more details. @@ -115,12 +121,15 @@ List all available arguments with `-h`. ## Supported Ciphers +### Stream Ciphers * `aes-128-cfb`, `aes-128-cfb1`, `aes-128-cfb8`, `aes-128-cfb128` * `aes-256-cfb`, `aes-256-cfb1`, `aes-256-cfb8`, `aes-256-cfb128` * `aes-128-ctr` * `rc4`, `rc4-md5` * `chacha20`, `salsa20`, `chacha20-ietf` * `dummy` (No encryption, just for debugging) + +### AEAD Ciphers * `aes-128-gcm`, `aes-192-gcm`, `aes-256-gcm` * `chacha20-ietf-poly1305` diff --git a/src/crypto/sodium.rs b/src/crypto/sodium.rs index 296221db..674ff8c8 100644 --- a/src/crypto/sodium.rs +++ b/src/crypto/sodium.rs @@ -6,7 +6,7 @@ use bytes::{BufMut, BytesMut}; use crypto::{CipherResult, CipherType, StreamCipher}; -use libc::c_ulonglong; +use libc::{c_ulonglong, uint32_t}; 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, sodium_init}; @@ -98,7 +98,7 @@ fn crypto_stream_xor_ic(t: CipherType, data.as_ptr(), data.len() as c_ulonglong, iv.as_ptr(), - ic as u32, + ic as uint32_t, key.as_ptr()) } CipherType::Salsa20 => {