Add AESD, AESE, AESIMC, AESMC instructions; add 4 simple Tests (closed box). (#365)

* Create CpuTestSimdCrypto.cs

* Update AOpCodeTable.cs

* Create AInstEmitSimdCrypto.cs

* Update ASoftFallback.cs

* Create ACryptoHelper.cs
This commit is contained in:
LDj3SNuD 2018-08-20 06:20:26 +02:00 committed by gdkchan
parent 726de8c46a
commit d021d5dfa9
5 changed files with 557 additions and 0 deletions

View file

@ -410,6 +410,42 @@ namespace ChocolArm64.Instruction
}
#endregion
#region "Aes"
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector128<float> Decrypt(Vector128<float> value, Vector128<float> roundKey)
{
if (!Sse.IsSupported)
{
throw new PlatformNotSupportedException();
}
return ACryptoHelper.AESInvSubBytes(ACryptoHelper.AESInvShiftRows(Sse.Xor(value, roundKey)));
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector128<float> Encrypt(Vector128<float> value, Vector128<float> roundKey)
{
if (!Sse.IsSupported)
{
throw new PlatformNotSupportedException();
}
return ACryptoHelper.AESSubBytes(ACryptoHelper.AESShiftRows(Sse.Xor(value, roundKey)));
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector128<float> InverseMixColumns(Vector128<float> value)
{
return ACryptoHelper.AESInvMixColumns(value);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector128<float> MixColumns(Vector128<float> value)
{
return ACryptoHelper.AESMixColumns(value);
}
#endregion
#region "Sha256"
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector128<float> HashLower(Vector128<float> hash_abcd, Vector128<float> hash_efgh, Vector128<float> wk)