2019-11-19 02:31:06 +01:00
|
|
|
|
using LibHac.Crypto;
|
2019-11-09 08:32:13 +01:00
|
|
|
|
using Xunit;
|
|
|
|
|
|
|
|
|
|
namespace LibHac.Tests.CryptoTests
|
|
|
|
|
{
|
|
|
|
|
public class AesCtrTests
|
|
|
|
|
{
|
2019-11-25 21:11:40 +01:00
|
|
|
|
public static TheoryData<EncryptionTestVector> TestVectors = RspReader.ReadEncryptionTestVectors(true, "CTR128.rsp");
|
2019-11-09 08:32:13 +01:00
|
|
|
|
|
|
|
|
|
[Theory]
|
|
|
|
|
[MemberData(nameof(TestVectors))]
|
|
|
|
|
public static void Transform(EncryptionTestVector tv)
|
|
|
|
|
{
|
2019-11-19 02:20:21 +01:00
|
|
|
|
Common.CipherTestCore(tv.PlainText, tv.CipherText, Aes.CreateCtrEncryptor(tv.Key, tv.Iv, true));
|
2019-11-09 08:32:13 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[AesIntrinsicsRequiredTheory]
|
|
|
|
|
[MemberData(nameof(TestVectors))]
|
|
|
|
|
public static void TransformIntrinsics(EncryptionTestVector tv)
|
|
|
|
|
{
|
2019-11-19 02:20:21 +01:00
|
|
|
|
Common.CipherTestCore(tv.PlainText, tv.CipherText, Aes.CreateCtrEncryptor(tv.Key, tv.Iv));
|
2019-11-09 08:32:13 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|