From 2cdf3e18ee017004bcb64b8ea5adb25b5d6277b4 Mon Sep 17 00:00:00 2001 From: Max Lv Date: Tue, 4 Jun 2013 08:48:07 +0800 Subject: [PATCH] support more ciphers --- configure.ac | 2 +- shadowsocks.8 | 3 ++- src/encrypt.c | 8 +++++++- src/encrypt.h | 24 +++++++++++++++--------- 4 files changed, 25 insertions(+), 12 deletions(-) diff --git a/configure.ac b/configure.ac index f78d779e..db38b78a 100755 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ dnl -*- Autoconf -*- dnl Process this file with autoconf to produce a configure script. AC_PREREQ([2.67]) -AC_INIT([shadowsocks], [1.3], [max.c.lv@gmail.com]) +AC_INIT([shadowsocks], [1.3.1], [max.c.lv@gmail.com]) AC_CONFIG_SRCDIR([src/encrypt.c]) AC_CONFIG_HEADERS([config.h]) diff --git a/shadowsocks.8 b/shadowsocks.8 index 149dd312..39b45b19 100644 --- a/shadowsocks.8 +++ b/shadowsocks.8 @@ -68,7 +68,8 @@ password. .B \-m \fIencrypt_method\fP Set the shadowsocks encryption method. Currently, shadowsocks accepts several encryption methods: table, rc4, aes-128-cfb, aes-192-cfb, aes-256-cfb, bf-cfb, -cast5-cfb and des-cfb. The default method is \fItable\fP. +camellia-128-cfb, camellia-192-cfb, camellia-256-cfb, cast5-cfb, des-cfb, +idea-cfb, rc2-cfb and seed-cfb. The default method is \fItable\fP. .TP .B \-f \fIpid_file\fP Start shadowsocks as a daemon with a specific pid file. diff --git a/src/encrypt.c b/src/encrypt.c index 276f7b20..33831a0a 100644 --- a/src/encrypt.c +++ b/src/encrypt.c @@ -35,8 +35,14 @@ static const char* supported_ciphers[8] = { "aes-192-cfb", "aes-256-cfb", "bf-cfb", + "camellia-128-cfb", + "camellia-192-cfb", + "camellia-256-cfb", "cast5-cfb", - "des-cfb" + "des-cfb", + "idea-cfb", + "rc2-cfb", + "seed-cfb" }; static int random_compare(const void *_x, const void *_y, uint32_t i, uint64_t a) { diff --git a/src/encrypt.h b/src/encrypt.h index 79fe38c9..82e436f1 100644 --- a/src/encrypt.h +++ b/src/encrypt.h @@ -19,15 +19,21 @@ #define BUF_SIZE 512 #define BLOCK_SIZE 32 -#define NONE -1 -#define TABLE 0 -#define RC4 1 -#define AES_128_CFB 2 -#define AES_192_CFB 3 -#define AES_256_CFB 4 -#define BF_CFB 5 -#define CAST5_CFB 6 -#define DES_CFB 7 +#define NONE -1 +#define TABLE 0 +#define RC4 1 +#define AES_128_CFB 2 +#define AES_192_CFB 3 +#define AES_256_CFB 4 +#define CAMELLIA_128_CFB 5 +#define CAMELLIA_192_CFB 6 +#define CAMELLIA_256_CFB 7 +#define BF_CFB 8 +#define CAST5_CFB 9 +#define DES_CFB 10 +#define IDEA_CFB 11 +#define RC2_CFB 12 +#define SEED_CFB 13 #define min(a,b) (((a)<(b))?(a):(b)) #define max(a,b) (((a)>(b))?(a):(b))