Add OpenSSL 1.1.0g support due to hardware acceleration

Note: If you want to compile it by yourself, please make sure
do NOT use `no-asm` configure option, since the main point of
this commit is to utilize assembly in openssl

Add OpenSSL test
This commit is contained in:
Syrone Wong
2018-02-10 08:27:32 +08:00
parent d1219bbfca
commit 4d4f1753c7
15 changed files with 693 additions and 67 deletions
+41
View File
@@ -227,6 +227,47 @@ namespace test
}
}
[TestMethod]
public void TestOpenSSLEncryption()
{
// run it once before the multi-threading test to initialize global tables
RunSingleOpenSSLEncryptionThread();
List<Thread> threads = new List<Thread>();
for (int i = 0; i < 10; i++)
{
Thread t = new Thread(new ThreadStart(RunSingleOpenSSLEncryptionThread));
threads.Add(t);
t.Start();
}
foreach (Thread t in threads)
{
t.Join();
}
RNG.Close();
Assert.IsFalse(encryptionFailed);
}
private void RunSingleOpenSSLEncryptionThread()
{
try
{
for (int i = 0; i < 100; i++)
{
var random = new Random();
IEncryptor encryptor;
IEncryptor decryptor;
encryptor = new StreamOpenSSLEncryptor("aes-256-cfb", "barfoo!");
decryptor = new StreamOpenSSLEncryptor("aes-256-cfb", "barfoo!");
RunEncryptionRound(encryptor, decryptor);
}
}
catch
{
encryptionFailed = true;
throw;
}
}
[TestMethod]
public void ParseAndGenerateShadowsocksUrl()
{