diff --git a/shadowsocks-csharp/Data/libsodium.dll.gz b/shadowsocks-csharp/Data/libsodium.dll.gz deleted file mode 100755 index b4330a35..00000000 Binary files a/shadowsocks-csharp/Data/libsodium.dll.gz and /dev/null differ diff --git a/shadowsocks-csharp/Data/libsscrypto.dll.gz b/shadowsocks-csharp/Data/libsscrypto.dll.gz new file mode 100755 index 00000000..dfba9cdc Binary files /dev/null and b/shadowsocks-csharp/Data/libsscrypto.dll.gz differ diff --git a/shadowsocks-csharp/Data/polarssl.dll.gz b/shadowsocks-csharp/Data/polarssl.dll.gz deleted file mode 100755 index 04a8f0a7..00000000 Binary files a/shadowsocks-csharp/Data/polarssl.dll.gz and /dev/null differ diff --git a/shadowsocks-csharp/Encrypt/PolarSSL.cs b/shadowsocks-csharp/Encrypt/PolarSSL.cs index 94659c80..a76882b6 100755 --- a/shadowsocks-csharp/Encrypt/PolarSSL.cs +++ b/shadowsocks-csharp/Encrypt/PolarSSL.cs @@ -10,7 +10,7 @@ namespace Shadowsocks.Encrypt { public class PolarSSL { - const string DLLNAME = "polarssl"; + const string DLLNAME = "libsscrypto"; public const int AES_CTX_SIZE = 8 + 4 * 68; public const int AES_ENCRYPT = 1; @@ -19,16 +19,19 @@ namespace Shadowsocks.Encrypt static PolarSSL() { string tempPath = Path.GetTempPath(); - string dllPath = tempPath + "/polarssl.dll"; + string dllPath = tempPath + "/libsscrypto.dll"; try { - FileManager.UncompressFile(dllPath, Resources.polarssl_dll); + FileManager.UncompressFile(dllPath, Resources.libsscrypto_dll); + LoadLibrary(dllPath); } - catch (IOException e) + catch (IOException) + { + } + catch (Exception e) { Console.WriteLine(e.ToString()); } - LoadLibrary(dllPath); } [DllImport("Kernel32.dll")] diff --git a/shadowsocks-csharp/Encrypt/Sodium.cs b/shadowsocks-csharp/Encrypt/Sodium.cs index 14f75872..1fd6cc55 100755 --- a/shadowsocks-csharp/Encrypt/Sodium.cs +++ b/shadowsocks-csharp/Encrypt/Sodium.cs @@ -10,21 +10,24 @@ namespace Shadowsocks.Encrypt { public class Sodium { - const string DLLNAME = "libsodium"; + const string DLLNAME = "libsscrypto"; static Sodium() { string tempPath = Path.GetTempPath(); - string dllPath = tempPath + "/libsodium.dll"; + string dllPath = tempPath + "/libsscrypto.dll"; try { - FileManager.UncompressFile(dllPath, Resources.libsodium_dll); + FileManager.UncompressFile(dllPath, Resources.libsscrypto_dll); + LoadLibrary(dllPath); } - catch (IOException e) + catch (IOException) + { + } + catch (Exception e) { Console.WriteLine(e.ToString()); } - LoadLibrary(dllPath); } [DllImport("Kernel32.dll")] diff --git a/shadowsocks-csharp/Properties/Resources.Designer.cs b/shadowsocks-csharp/Properties/Resources.Designer.cs index ffc24b33..906e4d12 100755 --- a/shadowsocks-csharp/Properties/Resources.Designer.cs +++ b/shadowsocks-csharp/Properties/Resources.Designer.cs @@ -63,19 +63,9 @@ namespace Shadowsocks.Properties { /// /// Looks up a localized resource of type System.Byte[]. /// - internal static byte[] libsodium_dll { + internal static byte[] libsscrypto_dll { get { - object obj = ResourceManager.GetObject("libsodium_dll", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] polarssl_dll { - get { - object obj = ResourceManager.GetObject("polarssl_dll", resourceCulture); + object obj = ResourceManager.GetObject("libsscrypto_dll", resourceCulture); return ((byte[])(obj)); } } diff --git a/shadowsocks-csharp/Properties/Resources.resx b/shadowsocks-csharp/Properties/Resources.resx index 4b6f8f3e..b28e1d17 100755 --- a/shadowsocks-csharp/Properties/Resources.resx +++ b/shadowsocks-csharp/Properties/Resources.resx @@ -118,11 +118,8 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - ..\data\libsodium.dll.gz;System.Byte[], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - ..\Data\polarssl.dll.gz;System.Byte[], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + ..\data\libsscrypto.dll.gz;System.Byte[], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 ..\Data\polipo_config.txt;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;gb2312 diff --git a/shadowsocks-csharp/shadowsocks-csharp.csproj b/shadowsocks-csharp/shadowsocks-csharp.csproj index 06f5bc3a..9aca827b 100755 --- a/shadowsocks-csharp/shadowsocks-csharp.csproj +++ b/shadowsocks-csharp/shadowsocks-csharp.csproj @@ -129,6 +129,7 @@ Designer +