Browse Source

remove blowfish

tags/2.3
clowwindy 9 years ago
parent
commit
919f9b5ce3
5 changed files with 0 additions and 54 deletions
  1. BIN
      shadowsocks-csharp/Data/libeay32.dll.gz
  2. BIN
      shadowsocks-csharp/Data/ss32.ico
  3. +0
    -17
      shadowsocks-csharp/Encrypt/PolarSSL.cs
  4. +0
    -36
      shadowsocks-csharp/Encrypt/PolarSSLEncryptor.cs
  5. +0
    -1
      shadowsocks-csharp/View/ConfigForm.Designer.cs

BIN
shadowsocks-csharp/Data/libeay32.dll.gz View File


BIN
shadowsocks-csharp/Data/ss32.ico View File

Before After

+ 0
- 17
shadowsocks-csharp/Encrypt/PolarSSL.cs View File

@@ -61,22 +61,5 @@ namespace Shadowsocks.Encrypt
[DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)] [DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
public extern static int arc4_crypt(IntPtr ctx, int length, byte[] input, byte[] output); public extern static int arc4_crypt(IntPtr ctx, int length, byte[] input, byte[] output);
public const int BLOWFISH_CTX_SIZE = 4168;
public const int BLOWFISH_ENCRYPT = 1;
public const int BLOWFISH_DECRYPT = 0;
[DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
public extern static void blowfish_init(IntPtr ctx);
[DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
public extern static void blowfish_free(IntPtr ctx);
[DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
public extern static int blowfish_setkey(IntPtr ctx, byte[] key, int keysize);
[DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
public extern static int blowfish_crypt_cfb64(IntPtr ctx, int mode, int length, ref int iv_off, byte[] iv, byte[] input, byte[] output);
} }
} }

+ 0
- 36
shadowsocks-csharp/Encrypt/PolarSSLEncryptor.cs View File

@@ -12,13 +12,11 @@ namespace Shadowsocks.Encrypt
{ {
const int CIPHER_AES = 1; const int CIPHER_AES = 1;
const int CIPHER_RC4 = 2; const int CIPHER_RC4 = 2;
const int CIPHER_BF = 3;
static Dictionary<string, int[]> ciphers = new Dictionary<string, int[]> { static Dictionary<string, int[]> ciphers = new Dictionary<string, int[]> {
{"aes-128-cfb", new int[]{16, 16, CIPHER_AES, PolarSSL.AES_CTX_SIZE}}, {"aes-128-cfb", new int[]{16, 16, CIPHER_AES, PolarSSL.AES_CTX_SIZE}},
{"aes-192-cfb", new int[]{24, 16, CIPHER_AES, PolarSSL.AES_CTX_SIZE}}, {"aes-192-cfb", new int[]{24, 16, CIPHER_AES, PolarSSL.AES_CTX_SIZE}},
{"aes-256-cfb", new int[]{32, 16, CIPHER_AES, PolarSSL.AES_CTX_SIZE}}, {"aes-256-cfb", new int[]{32, 16, CIPHER_AES, PolarSSL.AES_CTX_SIZE}},
{"bf-cfb", new int[]{16, 8, CIPHER_BF, PolarSSL.BLOWFISH_CTX_SIZE}},
{"rc4", new int[]{16, 0, CIPHER_RC4, PolarSSL.ARC4_CTX_SIZE}}, {"rc4", new int[]{16, 0, CIPHER_RC4, PolarSSL.ARC4_CTX_SIZE}},
{"rc4-md5", new int[]{16, 16, CIPHER_RC4, PolarSSL.ARC4_CTX_SIZE}}, {"rc4-md5", new int[]{16, 16, CIPHER_RC4, PolarSSL.ARC4_CTX_SIZE}},
}; };
@@ -133,22 +131,6 @@ namespace Shadowsocks.Encrypt
Array.Copy(iv, _decryptIV, ivLen); Array.Copy(iv, _decryptIV, ivLen);
} }
} }
else if (_cipher == CIPHER_BF)
{
PolarSSL.blowfish_init(ctx);
// PolarSSL takes key length by bit
PolarSSL.blowfish_setkey(ctx, realkey, keyLen * 8);
if (isCipher)
{
_encryptIV = new byte[ivLen];
Array.Copy(iv, _encryptIV, ivLen);
}
else
{
_decryptIV = new byte[ivLen];
Array.Copy(iv, _decryptIV, ivLen);
}
}
else if (_cipher == CIPHER_RC4) else if (_cipher == CIPHER_RC4)
{ {
PolarSSL.arc4_init(ctx); PolarSSL.arc4_init(ctx);
@@ -180,9 +162,6 @@ namespace Shadowsocks.Encrypt
case CIPHER_AES: case CIPHER_AES:
PolarSSL.aes_crypt_cfb128(_encryptCtx, PolarSSL.AES_ENCRYPT, length, ref _encryptIVOffset, _encryptIV, buf, tempbuf); PolarSSL.aes_crypt_cfb128(_encryptCtx, PolarSSL.AES_ENCRYPT, length, ref _encryptIVOffset, _encryptIV, buf, tempbuf);
break; break;
case CIPHER_BF:
PolarSSL.blowfish_crypt_cfb64(_encryptCtx, PolarSSL.BLOWFISH_ENCRYPT, length, ref _encryptIVOffset, _encryptIV, buf, tempbuf);
break;
case CIPHER_RC4: case CIPHER_RC4:
PolarSSL.arc4_crypt(_encryptCtx, length, buf, tempbuf); PolarSSL.arc4_crypt(_encryptCtx, length, buf, tempbuf);
break; break;
@@ -204,9 +183,6 @@ namespace Shadowsocks.Encrypt
case CIPHER_AES: case CIPHER_AES:
PolarSSL.aes_crypt_cfb128(_encryptCtx, PolarSSL.AES_ENCRYPT, length, ref _encryptIVOffset, _encryptIV, buf, outbuf); PolarSSL.aes_crypt_cfb128(_encryptCtx, PolarSSL.AES_ENCRYPT, length, ref _encryptIVOffset, _encryptIV, buf, outbuf);
break; break;
case CIPHER_BF:
PolarSSL.blowfish_crypt_cfb64(_encryptCtx, PolarSSL.BLOWFISH_ENCRYPT, length, ref _encryptIVOffset, _encryptIV, buf, outbuf);
break;
case CIPHER_RC4: case CIPHER_RC4:
PolarSSL.arc4_crypt(_encryptCtx, length, buf, outbuf); PolarSSL.arc4_crypt(_encryptCtx, length, buf, outbuf);
break; break;
@@ -233,9 +209,6 @@ namespace Shadowsocks.Encrypt
case CIPHER_AES: case CIPHER_AES:
PolarSSL.aes_crypt_cfb128(_decryptCtx, PolarSSL.AES_DECRYPT, length - ivLen, ref _decryptIVOffset, _decryptIV, tempbuf, outbuf); PolarSSL.aes_crypt_cfb128(_decryptCtx, PolarSSL.AES_DECRYPT, length - ivLen, ref _decryptIVOffset, _decryptIV, tempbuf, outbuf);
break; break;
case CIPHER_BF:
PolarSSL.blowfish_crypt_cfb64(_decryptCtx, PolarSSL.BLOWFISH_DECRYPT, length - ivLen, ref _decryptIVOffset, _decryptIV, tempbuf, outbuf);
break;
case CIPHER_RC4: case CIPHER_RC4:
PolarSSL.arc4_crypt(_decryptCtx, length - ivLen, tempbuf, outbuf); PolarSSL.arc4_crypt(_decryptCtx, length - ivLen, tempbuf, outbuf);
break; break;
@@ -254,9 +227,6 @@ namespace Shadowsocks.Encrypt
case CIPHER_AES: case CIPHER_AES:
PolarSSL.aes_crypt_cfb128(_decryptCtx, PolarSSL.AES_DECRYPT, length, ref _decryptIVOffset, _decryptIV, buf, outbuf); PolarSSL.aes_crypt_cfb128(_decryptCtx, PolarSSL.AES_DECRYPT, length, ref _decryptIVOffset, _decryptIV, buf, outbuf);
break; break;
case CIPHER_BF:
PolarSSL.blowfish_crypt_cfb64(_decryptCtx, PolarSSL.BLOWFISH_DECRYPT, length, ref _decryptIVOffset, _decryptIV, buf, outbuf);
break;
case CIPHER_RC4: case CIPHER_RC4:
PolarSSL.arc4_crypt(_decryptCtx, length, buf, outbuf); PolarSSL.arc4_crypt(_decryptCtx, length, buf, outbuf);
break; break;
@@ -298,9 +268,6 @@ namespace Shadowsocks.Encrypt
case CIPHER_AES: case CIPHER_AES:
PolarSSL.aes_free(_encryptCtx); PolarSSL.aes_free(_encryptCtx);
break; break;
case CIPHER_BF:
PolarSSL.blowfish_free(_encryptCtx);
break;
case CIPHER_RC4: case CIPHER_RC4:
PolarSSL.arc4_free(_encryptCtx); PolarSSL.arc4_free(_encryptCtx);
break; break;
@@ -315,9 +282,6 @@ namespace Shadowsocks.Encrypt
case CIPHER_AES: case CIPHER_AES:
PolarSSL.aes_free(_decryptCtx); PolarSSL.aes_free(_decryptCtx);
break; break;
case CIPHER_BF:
PolarSSL.blowfish_free(_decryptCtx);
break;
case CIPHER_RC4: case CIPHER_RC4:
PolarSSL.arc4_free(_decryptCtx); PolarSSL.arc4_free(_decryptCtx);
break; break;


+ 0
- 1
shadowsocks-csharp/View/ConfigForm.Designer.cs View File

@@ -209,7 +209,6 @@
"aes-256-cfb", "aes-256-cfb",
"aes-192-cfb", "aes-192-cfb",
"aes-128-cfb", "aes-128-cfb",
"bf-cfb",
"rc4"}); "rc4"});
this.EncryptionSelect.Location = new System.Drawing.Point(74, 86); this.EncryptionSelect.Location = new System.Drawing.Point(74, 86);
this.EncryptionSelect.Name = "EncryptionSelect"; this.EncryptionSelect.Name = "EncryptionSelect";


Loading…
Cancel
Save