-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Closed
Labels
arch-arm32area-System.Securityin-prThere is an active PR which will close this issue when it is mergedThere is an active PR which will close this issue when it is mergedos-linuxLinux OS (any supported distro)Linux OS (any supported distro)
Milestone
Description
Environemnt: Linux / ARM32bit
CoreCLR: Release build
CoreFX: Release build, enable outerloop test
Starting: System.Security.Cryptography.Algorithms.Tests
System.Security.Cryptography.Encryption.Aes.Tests.AesContractTests.InvalidIVSizes(invalidIvSize: 536870928) [FAIL]
Assert.Throws() Failure
Expected: typeof(System.ArgumentException)
Actual: typeof(System.OutOfMemoryException): Exception of type 'System.OutOfMemoryException' was thrown.
Stack Trace:
at System.Object.MemberwiseClone()
at Internal.Cryptography.Helpers.CloneByteArray(Byte[] src)
at Internal.Cryptography.AesImplementation.CreateDecryptor(Byte[] rgbKey, Byte[] rgbIV)
at System.Security.Cryptography.Encryption.Aes.Tests.AesContractTests.<>c__DisplayClass4_1.<InvalidIVSizes>b__1()
Finished: System.Security.Cryptography.Algorithms.Tests
Related code
[Theory]
[InlineData(64)] // smaller than default BlockSize
[InlineData(129)] // larger than default BlockSize
[InlineData(536870928)] // number of bits overflows and wraps around to default BlockSize
public static void InvalidIVSizes(int invalidIvSize)
{
using (Aes aes = AesFactory.Create())
{
aes.GenerateKey();
byte[] key = aes.Key;
byte[] iv;
try
{
iv = new byte[invalidIvSize];
}
catch (OutOfMemoryException) // in case there isn't enough memory at test-time to allocate the large array
{
return;
}
Assert.Throws<ArgumentException>("rgbIV", () => aes.CreateEncryptor(key, iv));
Assert.Throws<ArgumentException>("rgbIV", () => aes.CreateDecryptor(key, iv));
}
}
public sealed override ICryptoTransform CreateDecryptor(byte[] rgbKey, byte[] rgbIV)
{
return CreateTransform(rgbKey, rgbIV.CloneByteArray(), encrypting: false);
}
public static byte[] CloneByteArray(this byte[] src)
{
if (src == null)
{
return null;
}
return (byte[])(src.Clone());
}
- It throws
argument exception(notout of memory exception) when I modify test code to not useAssert.Throwsfor CreateDecryptor. - Test passed when I modify test code to not call
CreateEncryptorand testCreateDecryptoronly.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
arch-arm32area-System.Securityin-prThere is an active PR which will close this issue when it is mergedThere is an active PR which will close this issue when it is mergedos-linuxLinux OS (any supported distro)Linux OS (any supported distro)