Skip to content

Commit ff58d06

Browse files
committed
bump version to v1.6.3, uses faster nonce increment
1 parent 2eb089f commit ff58d06

File tree

4 files changed

+10
-15
lines changed

4 files changed

+10
-15
lines changed

Cargo.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "shadowsocks-rust"
3-
version = "1.6.2"
3+
version = "1.6.3"
44
authors = ["Y. T. CHUNG <zonyitoo@gmail.com>"]
55
description = "shadowsocks is a fast tunnel proxy that helps you bypass firewalls."
66
repository = "https://github.com/zonyitoo/shadowsocks-rust"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ shadowsocks is a fast tunnel proxy that helps you <del>bypass firewalls</del>.
1212
## Dependencies
1313

1414
* libcrypto (OpenSSL)
15-
* libsodium (Required for ciphers that are provided by libsodium)
15+
* libsodium >= 1.0.7 (Required for ciphers that are provided by libsodium)
1616

1717
## Usage
1818

src/crypto/aead.rs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ use ring::hmac::SigningKey;
1010

1111
use bytes::{Bytes, BytesMut};
1212

13+
use libsodium_ffi::sodium_increment;
14+
1315
/// Encryptor API for AEAD ciphers
1416
pub trait AeadEncryptor {
1517
/// Encrypt `input` to `output` with `tag`. `output.len()` should equals to `input.len()`.
@@ -102,14 +104,7 @@ pub fn make_skey(t: CipherType, key: &[u8], salt: &[u8]) -> Bytes {
102104
///
103105
/// AEAD ciphers requires to increase nonce after encrypt/decrypt every chunk
104106
pub fn increase_nonce(nonce: &mut [u8]) {
105-
let mut adding = true;
106-
for v in nonce.iter_mut() {
107-
if !adding {
108-
break;
109-
}
110-
111-
let (r, overflow) = v.overflowing_add(1);
112-
*v = r;
113-
adding = overflow;
107+
unsafe {
108+
sodium_increment(nonce.as_mut_ptr(), nonce.len());
114109
}
115110
}

0 commit comments

Comments
 (0)