Browse Source

Combine libsscrypto.dll and libsslcrypto2.dll

tags/3.0
Gang Zhuo 9 years ago
parent
commit
ab1f366049
6 changed files with 5 additions and 44 deletions
  1. BIN
      shadowsocks-csharp/Data/libsscrypto.dll.gz
  2. BIN
      shadowsocks-csharp/Data/libsscrypto2.dll.gz
  3. +5
    -30
      shadowsocks-csharp/Encryption/Sodium.cs
  4. +0
    -10
      shadowsocks-csharp/Properties/Resources.Designer.cs
  5. +0
    -3
      shadowsocks-csharp/Properties/Resources.resx
  6. +0
    -1
      shadowsocks-csharp/shadowsocks-csharp.csproj

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


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


+ 5
- 30
shadowsocks-csharp/Encryption/Sodium.cs View File

@@ -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,


+ 0
- 10
shadowsocks-csharp/Properties/Resources.Designer.cs View File

@@ -110,16 +110,6 @@ namespace Shadowsocks.Properties {
}
}
/// <summary>
/// 查找 System.Byte[] 类型的本地化资源。
/// </summary>
internal static byte[] libsscrypto2_dll {
get {
object obj = ResourceManager.GetObject("libsscrypto2_dll", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// 查找 System.Byte[] 类型的本地化资源。
/// </summary>


+ 0
- 3
shadowsocks-csharp/Properties/Resources.resx View File

@@ -124,9 +124,6 @@
<data name="cn" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\data\cn.txt;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</data>
<data name="libsscrypto2_dll" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Data\libsscrypto2.dll.gz;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="libsscrypto_dll" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\data\libsscrypto.dll.gz;System.Byte[], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>


+ 0
- 1
shadowsocks-csharp/shadowsocks-csharp.csproj View File

@@ -205,7 +205,6 @@
</None>
<None Include="Data\abp.js.gz" />
<None Include="Data\libsscrypto.dll.gz" />
<None Include="Data\libsscrypto2.dll.gz" />
<None Include="Data\mgwz.dll.gz" />
<None Include="Data\privoxy.exe.gz" />
<None Include="Data\proxy.pac.txt.gz" />


Loading…
Cancel
Save