mirror of
https://github.com/shadowsocks/shadowsocks-libev.git
synced 2026-10-29 04:03:45 +00:00
Fix #1154
This commit is contained in:
+4
-1
@@ -271,7 +271,7 @@ cipher_ctx_set_nonce(cipher_ctx_t *cipher_ctx, uint8_t *nonce, size_t nonce_len,
|
||||
if (cipher->method == RC4_MD5) {
|
||||
unsigned char key_nonce[32];
|
||||
memcpy(key_nonce, cipher->key, 16);
|
||||
memcpy(key_nonce + 16, cipher_ctx->nonce, 16);
|
||||
memcpy(key_nonce + 16, nonce, 16);
|
||||
true_key = crypto_md5(key_nonce, 32, NULL);
|
||||
nonce_len = 0;
|
||||
} else {
|
||||
@@ -298,6 +298,7 @@ cipher_ctx_set_nonce(cipher_ctx_t *cipher_ctx, uint8_t *nonce, size_t nonce_len,
|
||||
|
||||
#ifdef DEBUG
|
||||
dump("NONCE", (char *)nonce, nonce_len);
|
||||
dump("KEY", (char *)true_key, 32);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -350,6 +351,7 @@ stream_encrypt_all(buffer_t *plaintext, cipher_t *cipher, size_t capacity)
|
||||
#ifdef DEBUG
|
||||
dump("PLAIN", plaintext->data, plaintext->len);
|
||||
dump("CIPHER", ciphertext->data + nonce_len, ciphertext->len);
|
||||
dump("NONCE", ciphertext->data, nonce_len);
|
||||
#endif
|
||||
|
||||
stream_ctx_release(&cipher_ctx);
|
||||
@@ -471,6 +473,7 @@ stream_decrypt_all(buffer_t *ciphertext, cipher_t *cipher, size_t capacity)
|
||||
#ifdef DEBUG
|
||||
dump("PLAIN", plaintext->data, plaintext->len);
|
||||
dump("CIPHER", ciphertext->data + nonce_len, ciphertext->len - nonce_len);
|
||||
dump("NONCE", ciphertext->data, nonce_len);
|
||||
#endif
|
||||
|
||||
stream_ctx_release(&cipher_ctx);
|
||||
|
||||
Reference in New Issue
Block a user