diff --git a/shadowsocks-csharp/Data/libsscrypto.dll.gz b/shadowsocks-csharp/Data/libsscrypto.dll.gz
index 66a1185e..75fe39ba 100755
Binary files a/shadowsocks-csharp/Data/libsscrypto.dll.gz and b/shadowsocks-csharp/Data/libsscrypto.dll.gz differ
diff --git a/shadowsocks-csharp/Data/libsscrypto2.dll.gz b/shadowsocks-csharp/Data/libsscrypto2.dll.gz
deleted file mode 100644
index 83f7aab1..00000000
Binary files a/shadowsocks-csharp/Data/libsscrypto2.dll.gz and /dev/null differ
diff --git a/shadowsocks-csharp/Encryption/Sodium.cs b/shadowsocks-csharp/Encryption/Sodium.cs
index 14403267..c2c22839 100755
--- a/shadowsocks-csharp/Encryption/Sodium.cs
+++ b/shadowsocks-csharp/Encryption/Sodium.cs
@@ -12,40 +12,14 @@ namespace Shadowsocks.Encryption
public class Sodium
{
const string DLLNAME = "libsscrypto";
- const string DLLNAME2 = "libsscrypto2";
static Sodium()
- {
- LoadSSCryptoLibrary();
- LoadSSCrypto2Library();
- }
-
- static void LoadSSCryptoLibrary()
{
string tempPath = Utils.GetTempPath();
string dllPath = tempPath + "/libsscrypto.dll";
try
{
FileManager.UncompressFile(dllPath, Resources.libsscrypto_dll);
- LoadLibrary(dllPath);
- }
- catch (IOException)
- {
- }
- catch (Exception e)
- {
- Console.WriteLine(e.ToString());
- }
- }
-
- static void LoadSSCrypto2Library()
- {
- string tempPath = Utils.GetTempPath();
- string dllPath = tempPath + "/libsscrypto2.dll";
- try
- {
- FileManager.UncompressFile(dllPath, Resources.libsscrypto2_dll);
- LoadLibrary(dllPath);
}
catch (IOException)
{
@@ -54,22 +28,23 @@ namespace Shadowsocks.Encryption
{
Console.WriteLine(e.ToString());
}
+ LoadLibrary(dllPath);
}
[DllImport("Kernel32.dll")]
private static extern IntPtr LoadLibrary(string path);
[DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
- public extern static void crypto_stream_salsa20_xor_ic(byte[] c, byte[] m, ulong mlen, byte[] n, ulong ic, byte[] k);
+ public extern static int crypto_stream_salsa20_xor_ic(byte[] c, byte[] m, ulong mlen, byte[] n, ulong ic, byte[] k);
[DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
- public extern static void crypto_stream_chacha20_xor_ic(byte[] c, byte[] m, ulong mlen, byte[] n, ulong ic, byte[] k);
+ public extern static int crypto_stream_chacha20_xor_ic(byte[] c, byte[] m, ulong mlen, byte[] n, ulong ic, byte[] k);
- [DllImport(DLLNAME2, CallingConvention = CallingConvention.Cdecl)]
+ [DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
public extern static int ss_gen_crc(byte[] buf, ref int buf_offset, ref int data_len,
byte[] crc_buf, ref int crc_idx, int buf_size);
- [DllImport(DLLNAME2, CallingConvention = CallingConvention.Cdecl)]
+ [DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
public extern static int ss_onetimeauth(byte[] auth,
byte[] msg, int msg_len,
byte[] iv, int iv_len,
diff --git a/shadowsocks-csharp/Properties/Resources.Designer.cs b/shadowsocks-csharp/Properties/Resources.Designer.cs
index a5891002..57242844 100644
--- a/shadowsocks-csharp/Properties/Resources.Designer.cs
+++ b/shadowsocks-csharp/Properties/Resources.Designer.cs
@@ -110,16 +110,6 @@ namespace Shadowsocks.Properties {
}
}
- ///
- /// 查找 System.Byte[] 类型的本地化资源。
- ///
- internal static byte[] libsscrypto2_dll {
- get {
- object obj = ResourceManager.GetObject("libsscrypto2_dll", resourceCulture);
- return ((byte[])(obj));
- }
- }
-
///
/// 查找 System.Byte[] 类型的本地化资源。
///
diff --git a/shadowsocks-csharp/Properties/Resources.resx b/shadowsocks-csharp/Properties/Resources.resx
index 36dc1386..aa0c2f63 100755
--- a/shadowsocks-csharp/Properties/Resources.resx
+++ b/shadowsocks-csharp/Properties/Resources.resx
@@ -124,9 +124,6 @@
..\data\cn.txt;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8
-
- ..\Data\libsscrypto2.dll.gz;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
..\data\libsscrypto.dll.gz;System.Byte[], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
diff --git a/shadowsocks-csharp/shadowsocks-csharp.csproj b/shadowsocks-csharp/shadowsocks-csharp.csproj
index 89389fab..8200aa07 100644
--- a/shadowsocks-csharp/shadowsocks-csharp.csproj
+++ b/shadowsocks-csharp/shadowsocks-csharp.csproj
@@ -205,7 +205,6 @@
-