Browse Source

merge polarssl and libsodium into a single dll

tags/2.3
clowwindy 9 years ago
parent
commit
7122f82f0b
8 changed files with 21 additions and 27 deletions
  1. BIN
      shadowsocks-csharp/Data/libsodium.dll.gz
  2. BIN
      shadowsocks-csharp/Data/libsscrypto.dll.gz
  3. BIN
      shadowsocks-csharp/Data/polarssl.dll.gz
  4. +8
    -5
      shadowsocks-csharp/Encrypt/PolarSSL.cs
  5. +8
    -5
      shadowsocks-csharp/Encrypt/Sodium.cs
  6. +2
    -12
      shadowsocks-csharp/Properties/Resources.Designer.cs
  7. +2
    -5
      shadowsocks-csharp/Properties/Resources.resx
  8. +1
    -0
      shadowsocks-csharp/shadowsocks-csharp.csproj

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


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


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


+ 8
- 5
shadowsocks-csharp/Encrypt/PolarSSL.cs View File

@@ -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")]


+ 8
- 5
shadowsocks-csharp/Encrypt/Sodium.cs View File

@@ -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")]


+ 2
- 12
shadowsocks-csharp/Properties/Resources.Designer.cs View File

@@ -63,19 +63,9 @@ namespace Shadowsocks.Properties {
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>
internal static byte[] libsodium_dll {
internal static byte[] libsscrypto_dll {
get {
object obj = ResourceManager.GetObject("libsodium_dll", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>
internal static byte[] polarssl_dll {
get {
object obj = ResourceManager.GetObject("polarssl_dll", resourceCulture);
object obj = ResourceManager.GetObject("libsscrypto_dll", resourceCulture);
return ((byte[])(obj));
}
}


+ 2
- 5
shadowsocks-csharp/Properties/Resources.resx View File

@@ -118,11 +118,8 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="libsodium_dll" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\data\libsodium.dll.gz;System.Byte[], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="polarssl_dll" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Data\polarssl.dll.gz;System.Byte[], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<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>
<data name="polipo_config" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Data\polipo_config.txt;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;gb2312</value>


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

@@ -129,6 +129,7 @@
<SubType>Designer</SubType>
</None>
<None Include="Data\libsodium.dll.gz" />
<None Include="Data\libsscrypto.dll.gz" />
<None Include="Data\polarssl.dll.gz" />
<None Include="Data\polipo.exe.gz" />
<None Include="Properties\Settings.settings">


Loading…
Cancel
Save