Common theme: The buffer supplied to a function was too small
<collection total="8" passed="4" failed="4" skipped="0" name="Test collection for System.Security.Cryptography.Rsa.Tests.EncryptDecrypt" time="0.374">
<test name="System.Security.Cryptography.Rsa.Tests.EncryptDecrypt.LargeKeyCryptRoundtrip" type="System.Security.Cryptography.Rsa.Tests.EncryptDecrypt" method="LargeKeyCryptRoundtrip" time="0.1166504" result="Fail">
<failure exception-type="Internal.Cryptography.CryptoThrowHelper+WindowsCryptographicException">
<message><![CDATA[Internal.Cryptography.CryptoThrowHelper+WindowsCryptographicException : The buffer supplied to a function was too small]]></message>
<stack-trace><![CDATA[ at System.Security.Cryptography.RSACng.EncryptOrDecrypt(SafeNCryptKeyHandle key, Byte[] input, AsymmetricPaddingMode paddingMode, Void* paddingInfo, EncryptOrDecryptAction encryptOrDecrypt)
at System.Security.Cryptography.RSACng.EncryptOrDecrypt(Byte[] data, RSAEncryptionPadding padding, EncryptOrDecryptAction encryptOrDecrypt)
at System.Security.Cryptography.RSACng.Encrypt(Byte[] data, RSAEncryptionPadding padding)
at System.Security.Cryptography.Rsa.Tests.EncryptDecrypt.LargeKeyCryptRoundtrip() in S:\c1\src\Common\tests\System\Security\Cryptography\AlgorithmImplementations\RSA\EncryptDecrypt.cs:line 190]]></stack-trace>
</failure>
</test>
<test name="System.Security.Cryptography.Rsa.Tests.EncryptDecrypt.DecryptSavedAnswer_OaepSHA384" type="System.Security.Cryptography.Rsa.Tests.EncryptDecrypt" method="DecryptSavedAnswer_OaepSHA384" time="0.0066196" result="Pass" />
<test name="System.Security.Cryptography.Rsa.Tests.EncryptDecrypt.RsaDecryptAfterExport" type="System.Security.Cryptography.Rsa.Tests.EncryptDecrypt" method="RsaDecryptAfterExport" time="0.0752024" result="Fail">
<failure exception-type="Internal.Cryptography.CryptoThrowHelper+WindowsCryptographicException">
<message><![CDATA[Internal.Cryptography.CryptoThrowHelper+WindowsCryptographicException : The buffer supplied to a function was too small]]></message>
<stack-trace><![CDATA[ at System.Security.Cryptography.RSACng.EncryptOrDecrypt(SafeNCryptKeyHandle key, Byte[] input, AsymmetricPaddingMode paddingMode, Void* paddingInfo, EncryptOrDecryptAction encryptOrDecrypt)
at System.Security.Cryptography.RSACng.EncryptOrDecrypt(Byte[] data, RSAEncryptionPadding padding, EncryptOrDecryptAction encryptOrDecrypt)
at System.Security.Cryptography.RSACng.Encrypt(Byte[] data, RSAEncryptionPadding padding)
at System.Security.Cryptography.Rsa.Tests.EncryptDecrypt.RsaDecryptAfterExport() in S:\c1\src\Common\tests\System\Security\Cryptography\AlgorithmImplementations\RSA\EncryptDecrypt.cs:line 163]]></stack-trace>
</failure>
</test>
<test name="System.Security.Cryptography.Rsa.Tests.EncryptDecrypt.UnusualExponentCryptRoundtrip" type="System.Security.Cryptography.Rsa.Tests.EncryptDecrypt" method="UnusualExponentCryptRoundtrip" time="0.0055478" result="Fail">
<failure exception-type="Internal.Cryptography.CryptoThrowHelper+WindowsCryptographicException">
<message><![CDATA[Internal.Cryptography.CryptoThrowHelper+WindowsCryptographicException : The buffer supplied to a function was too small]]></message>
<stack-trace><![CDATA[ at System.Security.Cryptography.RSACng.EncryptOrDecrypt(SafeNCryptKeyHandle key, Byte[] input, AsymmetricPaddingMode paddingMode, Void* paddingInfo, EncryptOrDecryptAction encryptOrDecrypt)
at System.Security.Cryptography.RSACng.EncryptOrDecrypt(Byte[] data, RSAEncryptionPadding padding, EncryptOrDecryptAction encryptOrDecrypt)
at System.Security.Cryptography.RSACng.Encrypt(Byte[] data, RSAEncryptionPadding padding)
at System.Security.Cryptography.Rsa.Tests.EncryptDecrypt.UnusualExponentCryptRoundtrip() in S:\c1\src\Common\tests\System\Security\Cryptography\AlgorithmImplementations\RSA\EncryptDecrypt.cs:line 210]]></stack-trace>
</failure>
</test>
<test name="System.Security.Cryptography.Rsa.Tests.EncryptDecrypt.RsaCryptRoundtrip" type="System.Security.Cryptography.Rsa.Tests.EncryptDecrypt" method="RsaCryptRoundtrip" time="0.146889" result="Fail">
<failure exception-type="Internal.Cryptography.CryptoThrowHelper+WindowsCryptographicException">
<message><![CDATA[Internal.Cryptography.CryptoThrowHelper+WindowsCryptographicException : The buffer supplied to a function was too small]]></message>
<stack-trace><![CDATA[ at System.Security.Cryptography.RSACng.EncryptOrDecrypt(SafeNCryptKeyHandle key, Byte[] input, AsymmetricPaddingMode paddingMode, Void* paddingInfo, EncryptOrDecryptAction encryptOrDecrypt)
at System.Security.Cryptography.RSACng.EncryptOrDecrypt(Byte[] data, RSAEncryptionPadding padding, EncryptOrDecryptAction encryptOrDecrypt)
at System.Security.Cryptography.RSACng.Encrypt(Byte[] data, RSAEncryptionPadding padding)
at System.Security.Cryptography.Rsa.Tests.EncryptDecrypt.RsaCryptRoundtrip() in S:\c1\src\Common\tests\System\Security\Cryptography\AlgorithmImplementations\RSA\EncryptDecrypt.cs:line 148]]></stack-trace>
</failure>
</test>
<test name="System.Security.Cryptography.Rsa.Tests.EncryptDecrypt.NotSupportedValueMethods" type="System.Security.Cryptography.Rsa.Tests.EncryptDecrypt" method="NotSupportedValueMethods" time="0.0013223" result="Pass" />
<test name="System.Security.Cryptography.Rsa.Tests.EncryptDecrypt.DecryptSavedAnswer" type="System.Security.Cryptography.Rsa.Tests.EncryptDecrypt" method="DecryptSavedAnswer" time="0.0191846" result="Pass" />
<test name="System.Security.Cryptography.Rsa.Tests.EncryptDecrypt.DecryptSavedAnswerUnusualExponent" type="System.Security.Cryptography.Rsa.Tests.EncryptDecrypt" method="DecryptSavedAnswerUnusualExponent" time="0.0026907" result="Pass" />
</collection>
@bartonjs, @steveharter PTAL
Flighted Windows build: 14994
Also:
<test name="System.Security.Cryptography.X509Certificates.Tests.PfxTests.TestPrivateKey(keyStorageFlags: EphemeralKeySet)" type="System.Security.Cryptography.X509Certificates.Tests.PfxTests" method="TestPrivateKey" time="0.0122396" result="Fail">
<failure exception-type="Internal.Cryptography.CryptoThrowHelper+WindowsCryptographicException">
<message><![CDATA[Internal.Cryptography.CryptoThrowHelper+WindowsCryptographicException : The buffer supplied to a function was too small]]></message>
<stack-trace><![CDATA[ at Internal.Cryptography.CngCommon.SignHash(SafeNCryptKeyHandle keyHandle, Byte[] hash, AsymmetricPaddingMode paddingMode, Void* pPaddingInfo, Int32 estimatedSize)
at System.Security.Cryptography.RSACng.<>c__DisplayClass28_0.<SignHash>b__0(AsymmetricPaddingMode paddingMode, Void* pPaddingInfo)
at System.Security.Cryptography.RSACng.SignOrVerify(RSASignaturePadding padding, HashAlgorithmName hashAlgorithm, Byte[] hash, SignOrVerifyAction signOrVerify)
at System.Security.Cryptography.RSACng.SignHash(Byte[] hash, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding)
at System.Security.Cryptography.X509Certificates.Tests.PfxTests.VerifyPrivateKey(RSA rsa) in S:\c1\src\System.Security.Cryptography.X509Certificates\tests\PfxTests.cs:line 148
at System.Security.Cryptography.X509Certificates.Tests.PfxTests.TestPrivateKey(X509KeyStorageFlags keyStorageFlags) in S:\c1\src\System.Security.Cryptography.X509Certificates\tests\PfxTests.cs:line 118]]></stack-trace>
</failure>
</test>
<test name="System.Security.Cryptography.X509Certificates.Tests.PfxTests.TestPrivateKeyProperty" type="System.Security.Cryptography.X509Certificates.Tests.PfxTests" method="TestPrivateKeyProperty" time="0.0114803" result="Fail">
<failure exception-type="Internal.Cryptography.CryptoThrowHelper+WindowsCryptographicException">
<message><![CDATA[Internal.Cryptography.CryptoThrowHelper+WindowsCryptographicException : The buffer supplied to a function was too small]]></message>
<stack-trace><![CDATA[ at Internal.Cryptography.CngCommon.SignHash(SafeNCryptKeyHandle keyHandle, Byte[] hash, AsymmetricPaddingMode paddingMode, Void* pPaddingInfo, Int32 estimatedSize)
at System.Security.Cryptography.RSACng.<>c__DisplayClass28_0.<SignHash>b__0(AsymmetricPaddingMode paddingMode, Void* pPaddingInfo)
at System.Security.Cryptography.RSACng.SignOrVerify(RSASignaturePadding padding, HashAlgorithmName hashAlgorithm, Byte[] hash, SignOrVerifyAction signOrVerify)
at System.Security.Cryptography.RSACng.SignHash(Byte[] hash, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding)
at System.Security.Cryptography.X509Certificates.Tests.PfxTests.VerifyPrivateKey(RSA rsa) in S:\c1\src\System.Security.Cryptography.X509Certificates\tests\PfxTests.cs:line 148
at System.Security.Cryptography.X509Certificates.Tests.PfxTests.TestPrivateKeyProperty() in S:\c1\src\System.Security.Cryptography.X509Certificates\tests\PfxTests.cs:line 136]]></stack-trace>
</failure>
</test>
<test name="System.Security.Cryptography.X509Certificates.Tests.CtorTests.TestCopyConstructor_Lifetime_Cloned" type="System.Security.Cryptography.X509Certificates.Tests.CtorTests" method="TestCopyConstructor_Lifetime_Cloned" time="0.0421525" result="Fail">
<failure exception-type="Internal.Cryptography.CryptoThrowHelper+WindowsCryptographicException">
<message><![CDATA[Internal.Cryptography.CryptoThrowHelper+WindowsCryptographicException : The buffer supplied to a function was too small]]></message>
<stack-trace><![CDATA[ at Internal.Cryptography.CngCommon.SignHash(SafeNCryptKeyHandle keyHandle, Byte[] hash, AsymmetricPaddingMode paddingMode, Void* pPaddingInfo, Int32 estimatedSize)
at System.Security.Cryptography.RSACng.<>c__DisplayClass28_0.<SignHash>b__0(AsymmetricPaddingMode paddingMode, Void* pPaddingInfo)
at System.Security.Cryptography.RSACng.SignOrVerify(RSASignaturePadding padding, HashAlgorithmName hashAlgorithm, Byte[] hash, SignOrVerifyAction signOrVerify)
at System.Security.Cryptography.RSACng.SignHash(Byte[] hash, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding)
at System.Security.Cryptography.X509Certificates.Tests.CtorTests.TestPrivateKey(X509Certificate2 c, Boolean expectSuccess) in S:\c1\src\System.Security.Cryptography.X509Certificates\tests\CtorTests.cs:line 284
at System.Security.Cryptography.X509Certificates.Tests.CtorTests.TestCopyConstructor_Lifetime_Cloned() in S:\c1\src\System.Security.Cryptography.X509Certificates\tests\CtorTests.cs:line 238]]></stack-trace>
</failure>
</test>
<test name="System.Security.Cryptography.X509Certificates.Tests.CtorTests.TestCopyConstructor_NoPal" type="System.Security.Cryptography.X509Certificates.Tests.CtorTests" method="TestCopyConstructor_NoPal" time="0.001624" result="Pass" />
<test name="System.Security.Cryptography.X509Certificates.Tests.CtorTests.TestCopyConstructor_Lifetime_Independent" type="System.Security.Cryptography.X509Certificates.Tests.CtorTests" method="TestCopyConstructor_Lifetime_Independent" time="0.1750199" result="Fail">
<failure exception-type="Internal.Cryptography.CryptoThrowHelper+WindowsCryptographicException">
<message><![CDATA[Internal.Cryptography.CryptoThrowHelper+WindowsCryptographicException : The buffer supplied to a function was too small]]></message>
<stack-trace><![CDATA[ at Internal.Cryptography.CngCommon.SignHash(SafeNCryptKeyHandle keyHandle, Byte[] hash, AsymmetricPaddingMode paddingMode, Void* pPaddingInfo, Int32 estimatedSize)
at System.Security.Cryptography.RSACng.<>c__DisplayClass28_0.<SignHash>b__0(AsymmetricPaddingMode paddingMode, Void* pPaddingInfo)
at System.Security.Cryptography.RSACng.SignOrVerify(RSASignaturePadding padding, HashAlgorithmName hashAlgorithm, Byte[] hash, SignOrVerifyAction signOrVerify)
at System.Security.Cryptography.RSACng.SignHash(Byte[] hash, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding)
at System.Security.Cryptography.X509Certificates.Tests.CtorTests.TestCopyConstructor_Lifetime_Independent() in S:\c1\src\System.Security.Cryptography.X509Certificates\tests\CtorTests.cs:line 214]]></stack-trace>
</failure>
</test>
<test name="System.Security.Cryptography.X509Certificates.Tests.CtorTests.InvalidStorageFlags_PersistedEphemeral" type="System.Security.Cryptography.X509Certificates.Tests.CtorTests" method="InvalidStorageFlags_PersistedEphemeral" time="0.0020795" result="Pass" />
<test name="System.Security.Cryptography.X509Certificates.Tests.CtorTests.TestConstructor_PEM" type="System.Security.Cryptography.X509Certificates.Tests.CtorTests" method="TestConstructor_PEM" time="0.0417778" result="Pass" />
<test name="System.Security.Cryptography.X509Certificates.Tests.CtorTests.TestSerializeDeserialize_DER" type="System.Security.Cryptography.X509Certificates.Tests.CtorTests" method="TestSerializeDeserialize_DER" time="0.0608378" result="Pass" />
<test name="System.Security.Cryptography.X509Certificates.Tests.CtorTests.TestCopyConstructor_Lifetime_Cloned_Reversed" type="System.Security.Cryptography.X509Certificates.Tests.CtorTests" method="TestCopyConstructor_Lifetime_Cloned_Reversed" time="0.0313479" result="Fail">
<failure exception-type="Internal.Cryptography.CryptoThrowHelper+WindowsCryptographicException">
<message><![CDATA[Internal.Cryptography.CryptoThrowHelper+WindowsCryptographicException : The buffer supplied to a function was too small]]></message>
<stack-trace><![CDATA[ at Internal.Cryptography.CngCommon.SignHash(SafeNCryptKeyHandle keyHandle, Byte[] hash, AsymmetricPaddingMode paddingMode, Void* pPaddingInfo, Int32 estimatedSize)
at System.Security.Cryptography.RSACng.<>c__DisplayClass28_0.<SignHash>b__0(AsymmetricPaddingMode paddingMode, Void* pPaddingInfo)
at System.Security.Cryptography.RSACng.SignOrVerify(RSASignaturePadding padding, HashAlgorithmName hashAlgorithm, Byte[] hash, SignOrVerifyAction signOrVerify)
at System.Security.Cryptography.RSACng.SignHash(Byte[] hash, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding)
at System.Security.Cryptography.X509Certificates.Tests.CtorTests.TestPrivateKey(X509Certificate2 c, Boolean expectSuccess) in S:\c1\src\System.Security.Cryptography.X509Certificates\tests\CtorTests.cs:line 284
at System.Security.Cryptography.X509Certificates.Tests.CtorTests.TestCopyConstructor_Lifetime_Cloned_Reversed() in S:\c1\src\System.Security.Cryptography.X509Certificates\tests\CtorTests.cs:line 260]]></stack-trace>
</failure>
@bartonjs @steveharter thoughts?
@CIPop If they were previously passing this indicates some sort of breaking change on the part of Windows CNG. I'll try to dig into it on Monday to see where it's failing. Sent out a feeler to Windows and they didn't have an "oh, yeah, you obviously were doing [blank] and should instead do [blank]" type answer.
Started a thread with the Windows Crypto team. NCryptEncrypt has started behaving differently when passed undersized buffers between Win10-current-released and Win10-latest-nightlies.
Nice find. Wonder if we should be running all our tests on flights. @CIPop do you regularly kick off all the tests on your box eg when going home for the night?
@CIPop do you regularly kick off all the tests on your box
Part of my regular workflow is to clean and build/test all before updating my master branch. This usually happens before I start working on a new project (or if my master is very old). Both my office machines run auto-updated flighted builds.
eg when going home for the night
Usually mornings: not during the night since that's when the flighted builds usually install.
Taking off the label to put this issue aside as it's tracking fixes going in the next version of Windows. Meantime these tests will be known failures when run on builds impacted by their bug.
If they don't fix the bug/s we should do something on our side to make the tests pass.
@CIPop Are these tests still failing for you?
I just tried all the corefx tests from master (InnerLoop) on Win10 Creators Update with all tests passing; and at least one of the reporting-failed tests is in that set. So looks like we did help Windows prevent a regression :smile:.
@CIPop Are these tests still failing for you?
Must have missed this... No, I'm not seeing these failures anymore.
Thanks @bartonjs !