Skip to content

Commit

Permalink
bump version to v1.6.3, uses faster nonce increment
Browse files Browse the repository at this point in the history
  • Loading branch information
zonyitoo committed Aug 31, 2017
1 parent 2eb089f commit ff58d06
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 15 deletions.
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "shadowsocks-rust"
version = "1.6.2"
version = "1.6.3"
authors = ["Y. T. CHUNG <[email protected]>"]
description = "shadowsocks is a fast tunnel proxy that helps you bypass firewalls."
repository = "https://github.com/zonyitoo/shadowsocks-rust"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ shadowsocks is a fast tunnel proxy that helps you <del>bypass firewalls</del>.
## Dependencies

* libcrypto (OpenSSL)
* libsodium (Required for ciphers that are provided by libsodium)
* libsodium >= 1.0.7 (Required for ciphers that are provided by libsodium)

## Usage

Expand Down
13 changes: 4 additions & 9 deletions src/crypto/aead.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ use ring::hmac::SigningKey;

use bytes::{Bytes, BytesMut};

use libsodium_ffi::sodium_increment;

/// Encryptor API for AEAD ciphers
pub trait AeadEncryptor {
/// Encrypt `input` to `output` with `tag`. `output.len()` should equals to `input.len()`.
Expand Down Expand Up @@ -102,14 +104,7 @@ pub fn make_skey(t: CipherType, key: &[u8], salt: &[u8]) -> Bytes {
///
/// AEAD ciphers requires to increase nonce after encrypt/decrypt every chunk
pub fn increase_nonce(nonce: &mut [u8]) {
let mut adding = true;
for v in nonce.iter_mut() {
if !adding {
break;
}

let (r, overflow) = v.overflowing_add(1);
*v = r;
adding = overflow;
unsafe {
sodium_increment(nonce.as_mut_ptr(), nonce.len());
}
}

0 comments on commit ff58d06

Please sign in to comment.