dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
14.91k stars 4.63k forks source link

STATUS_UNSUCCESSFUL in RsaCryptRoundtrip_OaepSHA1 #29683

Open danmoseley opened 5 years ago

danmoseley commented 5 years ago

Not actionable as is. https://mc.dot.net/#/user/dotnet-bot/pr~2Fdotnet~2Fcorefx~2Frefs~2Fpull~2F37960~2Fmerge/test~2Ffunctional~2Fcli~2Finnerloop~2F/20190528.20/workItem/System.Security.Cryptography.Cng.Tests/analysis/xunit/System.Security.Cryptography.Rsa.Tests.EncryptDecrypt_Span~2FRsaCryptRoundtrip_OaepSHA1

Windows.10.Amd64.ClientRS4.ES.Open-x86-Release
Get Repro environment
Unhandled Exception of Type Internal.Cryptography.CryptoThrowHelper+WindowsCryptographicException
Message :
Internal.Cryptography.CryptoThrowHelper+WindowsCryptographicException : Unknown error (0xc0000001)
Stack Trace :
   at System.Security.Cryptography.RSACng.TryEncryptOrDecrypt(SafeNCryptKeyHandle key, ReadOnlySpan`1 input, Span`1 output, AsymmetricPaddingMode paddingMode, Void* paddingInfo, Boolean encrypt, Int32& bytesWritten) in /_/src/Common/src/System/Security/Cryptography/RSACng.EncryptDecrypt.cs:line 266
   at System.Security.Cryptography.RSACng.TryEncryptOrDecrypt(ReadOnlySpan`1 data, Span`1 destination, RSAEncryptionPadding padding, Boolean encrypt, Int32& bytesWritten) in /_/src/Common/src/System/Security/Cryptography/RSACng.EncryptDecrypt.cs:line 205
   at System.Security.Cryptography.RSACng.TryDecrypt(ReadOnlySpan`1 data, Span`1 destination, RSAEncryptionPadding padding, Int32& bytesWritten) in /_/src/Common/src/System/Security/Cryptography/RSACng.EncryptDecrypt.cs:line 38
   at System.Security.Cryptography.Rsa.Tests.EncryptDecrypt_Span.<>c__DisplayClass1_0.<Decrypt>b__0(Byte[] dest) in /_/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/EncryptDecrypt.netcoreapp.cs:line 16
   at System.Security.Cryptography.Rsa.Tests.EncryptDecrypt_Span.TryWithOutputArray(Func`2 func) in /_/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/EncryptDecrypt.netcoreapp.cs:line 23
   at System.Security.Cryptography.Rsa.Tests.EncryptDecrypt_Span.Decrypt(RSA rsa, Byte[] data, RSAEncryptionPadding padding) in /_/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/EncryptDecrypt.netcoreapp.cs:line 16
   at System.Security.Cryptography.Rsa.Tests.EncryptDecrypt.RsaCryptRoundtrip(RSAEncryptionPadding paddingMode, Boolean expectSuccess) in /_/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/EncryptDecrypt.cs:line 315
   at System.Security.Cryptography.Rsa.Tests.EncryptDecrypt.RsaCryptRoundtrip_OaepSHA1() in /_/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/EncryptDecrypt.cs:line 285

UPD by @CarnaViire: I went ahead and added Build Information below, from the last occurrence on my PR -- in hopes that known-issues infra would be able to validate and attach the failures not attached yet.

Build Information

Build: https://dev.azure.com/dnceng-public/public/_build/results?buildId=565017&view=results Build error leg or test failing: System.Security.Cryptography.Rsa.Tests.EncryptDecrypt_Span.RsaCryptRoundtrip_OaepSHA512 Pull request:

Error Message

Fill the error message using step by step known issues guidance.

{
  "ErrorMessage": "CryptographicException : Unknown error (0x",
  "BuildRetry": false,
  "ExcludeConsoleLog": false
}

Report

Summary

24-Hour Hit Count 7-Day Hit Count 1-Month Count
0 0 0

Known issue validation

Build: :mag_right: https://dev.azure.com/dnceng-public/public/_build/results?buildId=565017 Error message validated: [CryptographicException : Unknown error (0x] Result validation: :white_check_mark: Known issue matched with the provided build. Validation performed at: 2/19/2024 11:07:21 AM UTC

VincentBu commented 2 years ago

Failed again in: runtime-libraries-coreclr outerloop 20220713.6

Failed test:

net7.0-Linux-Release-arm64-CoreCLR_release-(Ubuntu.2204.Arm64.Open)Ubuntu.1804.ArmArch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-22.04-helix-arm64v8-20220504035342-1b9461f

- System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.RevokeEndEntity_IssuerUnrelatedOcsp(pkiOptions: IssuerRevocationViaCrl | EndEntityRevocationViaOcsp)
- System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.RevokeEndEntity_IssuerUnrelatedOcsp(pkiOptions: IssuerRevocationViaCrl | OcspEverywhere)
- System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.RevokeEndEntity_IssuerUnrelatedOcsp(pkiOptions: OcspEverywhere)
- System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.RevokeEndEntity_RootUnrelatedOcsp(pkiOptions: IssuerRevocationViaOcsp | AllEndEntityRevocation)
- System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.RevokeEndEntity_RootUnrelatedOcsp(pkiOptions: OcspEverywhere)

net7.0-Linux-Release-x64-CoreCLR_release-(Ubuntu.2204.Amd64.Open)Ubuntu.1804.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-22.04-helix-amd64-20220504035722-1b9461f

- System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.RevokeEndEntity_IssuerUnrelatedOcsp(pkiOptions: IssuerRevocationViaCrl | EndEntityRevocationViaOcsp)
- System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.RevokeEndEntity_IssuerUnrelatedOcsp(pkiOptions: IssuerRevocationViaCrl | OcspEverywhere)
- System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.RevokeEndEntity_IssuerUnrelatedOcsp(pkiOptions: OcspEverywhere)
- System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.RevokeEndEntity_RootUnrelatedOcsp(pkiOptions: IssuerRevocationViaOcsp | AllEndEntityRevocation)
- System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.RevokeEndEntity_RootUnrelatedOcsp(pkiOptions: OcspEverywhere)

Error message:

System.AggregateException : One or more errors occurred. (Assert.Equal() Failure
↓ (pos 2)
Expected: [NoError, NoError, RevocationStatusUnknown | OfflineRevocati···
Actual:   [NoError, NoError, Revoked]
↑ (pos 2)) (Assert.Equal() Failure
↓ (pos 2)
Expected: [NoError, NoError, RevocationStatusUnknown | OfflineRevocati···
Actual:   [NoError, NoError, Revoked]
↑ (pos 2)) (Assert.Equal() Failure
↓ (pos 2)
Expected: [NoError, NoError, RevocationStatusUnknown | OfflineRevocati···
Actual:   [NoError, NoError, Revoked]
↑ (pos 2)) (Assert.Equal() Failure
↓ (pos 2)
Expected: [NoError, NoError, RevocationStatusUnknown | OfflineRevocati···
Actual:   [NoError, NoError, Revoked]
↑ (pos 2)) (Assert.Equal() Failure
↓ (pos 2)
Expected: [NoError, NoError, RevocationStatusUnknown | OfflineRevocati···
Actual:   [NoError, NoError, Revoked]
↑ (pos 2))
---- Assert.Equal() Failure
↓ (pos 2)
Expected: [NoError, NoError, RevocationStatusUnknown | OfflineRevocati···
Actual:   [NoError, NoError, Revoked]
↑ (pos 2)
---- Assert.Equal() Failure
↓ (pos 2)
Expected: [NoError, NoError, RevocationStatusUnknown | OfflineRevocati···
Actual:   [NoError, NoError, Revoked]
↑ (pos 2)
---- Assert.Equal() Failure
↓ (pos 2)
Expected: [NoError, NoError, RevocationStatusUnknown | OfflineRevocati···
Actual:   [NoError, NoError, Revoked]
↑ (pos 2)
---- Assert.Equal() Failure
↓ (pos 2)
Expected: [NoError, NoError, RevocationStatusUnknown | OfflineRevocati···
Actual:   [NoError, NoError, Revoked]
↑ (pos 2)
---- Assert.Equal() Failure
↓ (pos 2)
Expected: [NoError, NoError, RevocationStatusUnknown | OfflineRevocati···
Actual:   [NoError, NoError, Revoked]
↑ (pos 2)

Stack trace
   at System.RetryHelper.Execute(Action test, Int32 maxAttempts, Func`2 backoffFunc, Predicate`1 retryWhen, String testName) in /_/src/libraries/Common/tests/TestUtilities/System/RetryHelper.cs:line 67
   at System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.SimpleTest(PkiOptions pkiOptions, RunSimpleTest callback, String callerName, Boolean pkiOptionsInTestName) in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/DynamicRevocationTests.cs:line 1543
   at System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.RevokeEndEntity_IssuerUnrelatedOcsp(PkiOptions pkiOptions) in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/DynamicRevocationTests.cs:line 373
   at InvokeStub_DynamicRevocationTests.RevokeEndEntity_IssuerUnrelatedOcsp(Object, Object, IntPtr*)
   at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
----- Inner Stack Trace #1 (Xunit.Sdk.EqualException) -----
   at System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.AssertChainStatus(X509Chain chain, X509ChainStatusFlags rootStatus, X509ChainStatusFlags issrStatus, X509ChainStatusFlags leafStatus) in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/DynamicRevocationTests.cs:line 1572
   at System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.<>c__DisplayClass19_0.<RevokeEndEntity_IssuerUnrelatedOcsp>b__0(CertificateAuthority root, CertificateAuthority intermediate, X509Certificate2 endEntity, ChainHolder holder, RevocationResponder responder) in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/DynamicRevocationTests.cs:line 429
   at System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.<>c__DisplayClass46_0.<SimpleTest>b__0() in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/DynamicRevocationTests.cs:line 1541
   at System.RetryHelper.Execute(Action test, Int32 maxAttempts, Func`2 backoffFunc, Predicate`1 retryWhen, String testName) in /_/src/libraries/Common/tests/TestUtilities/System/RetryHelper.cs:line 67
----- Inner Stack Trace #2 (Xunit.Sdk.EqualException) -----
   at System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.AssertChainStatus(X509Chain chain, X509ChainStatusFlags rootStatus, X509ChainStatusFlags issrStatus, X509ChainStatusFlags leafStatus) in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/DynamicRevocationTests.cs:line 1572
   at System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.<>c__DisplayClass19_0.<RevokeEndEntity_IssuerUnrelatedOcsp>b__0(CertificateAuthority root, CertificateAuthority intermediate, X509Certificate2 endEntity, ChainHolder holder, RevocationResponder responder) in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/DynamicRevocationTests.cs:line 429
   at System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.<>c__DisplayClass46_0.<SimpleTest>b__0() in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/DynamicRevocationTests.cs:line 1541
   at System.RetryHelper.Execute(Action test, Int32 maxAttempts, Func`2 backoffFunc, Predicate`1 retryWhen, String testName) in /_/src/libraries/Common/tests/TestUtilities/System/RetryHelper.cs:line 67
----- Inner Stack Trace #3 (Xunit.Sdk.EqualException) -----
   at System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.AssertChainStatus(X509Chain chain, X509ChainStatusFlags rootStatus, X509ChainStatusFlags issrStatus, X509ChainStatusFlags leafStatus) in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/DynamicRevocationTests.cs:line 1572
   at System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.<>c__DisplayClass19_0.<RevokeEndEntity_IssuerUnrelatedOcsp>b__0(CertificateAuthority root, CertificateAuthority intermediate, X509Certificate2 endEntity, ChainHolder holder, RevocationResponder responder) in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/DynamicRevocationTests.cs:line 429
   at System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.<>c__DisplayClass46_0.<SimpleTest>b__0() in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/DynamicRevocationTests.cs:line 1541
   at System.RetryHelper.Execute(Action test, Int32 maxAttempts, Func`2 backoffFunc, Predicate`1 retryWhen, String testName) in /_/src/libraries/Common/tests/TestUtilities/System/RetryHelper.cs:line 67
----- Inner Stack Trace #4 (Xunit.Sdk.EqualException) -----
   at System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.AssertChainStatus(X509Chain chain, X509ChainStatusFlags rootStatus, X509ChainStatusFlags issrStatus, X509ChainStatusFlags leafStatus) in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/DynamicRevocationTests.cs:line 1572
   at System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.<>c__DisplayClass19_0.<RevokeEndEntity_IssuerUnrelatedOcsp>b__0(CertificateAuthority root, CertificateAuthority intermediate, X509Certificate2 endEntity, ChainHolder holder, RevocationResponder responder) in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/DynamicRevocationTests.cs:line 429
   at System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.<>c__DisplayClass46_0.<SimpleTest>b__0() in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/DynamicRevocationTests.cs:line 1541
   at System.RetryHelper.Execute(Action test, Int32 maxAttempts, Func`2 backoffFunc, Predicate`1 retryWhen, String testName) in /_/src/libraries/Common/tests/TestUtilities/System/RetryHelper.cs:line 67
----- Inner Stack Trace #5 (Xunit.Sdk.EqualException) -----
   at System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.AssertChainStatus(X509Chain chain, X509ChainStatusFlags rootStatus, X509ChainStatusFlags issrStatus, X509ChainStatusFlags leafStatus) in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/DynamicRevocationTests.cs:line 1572
   at System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.<>c__DisplayClass19_0.<RevokeEndEntity_IssuerUnrelatedOcsp>b__0(CertificateAuthority root, CertificateAuthority intermediate, X509Certificate2 endEntity, ChainHolder holder, RevocationResponder responder) in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/DynamicRevocationTests.cs:line 429
   at System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.<>c__DisplayClass46_0.<SimpleTest>b__0() in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/DynamicRevocationTests.cs:line 1541
   at System.RetryHelper.Execute(Action test, Int32 maxAttempts, Func`2 backoffFunc, Predicate`1 retryWhen, String testName) in /_/src/libraries/Common/tests/TestUtilities/System/RetryHelper.cs:line 67
VincentBu commented 2 years ago

Failed again in : runtime-libraries-coreclr outerloop 20220731.3

Failed test:

net7.0-Linux-Release-arm64-CoreCLR_release-(Ubuntu.2204.Arm64.Open)Ubuntu.1804.ArmArch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-22.04-helix-arm64v8-20220504035342-1b9461f

- System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.RevokeEndEntity_IssuerUnrelatedOcsp(pkiOptions: IssuerRevocationViaCrl | EndEntityRevocationViaOcsp)
- System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.RevokeEndEntity_IssuerUnrelatedOcsp(pkiOptions: IssuerRevocationViaCrl | OcspEverywhere)
- System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.RevokeEndEntity_IssuerUnrelatedOcsp(pkiOptions: OcspEverywhere)
- System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.RevokeEndEntity_RootUnrelatedOcsp(pkiOptions: IssuerRevocationViaOcsp | AllEndEntityRevocation)
- System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.RevokeEndEntity_RootUnrelatedOcsp(pkiOptions: OcspEverywhere)

Error message:

System.AggregateException : One or more errors occurred. (Assert.Equal() Failure
↓ (pos 1)
Expected: [NoError, RevocationStatusUnknown | OfflineRevocati···
Actual:   [NoError, Revoked, RevocationStatusUnknown | Offlin···
↑ (pos 1)) (Assert.Equal() Failure
↓ (pos 1)
Expected: [NoError, RevocationStatusUnknown | OfflineRevocati···
Actual:   [NoError, Revoked, RevocationStatusUnknown | Offlin···
↑ (pos 1)) (Assert.Equal() Failure
↓ (pos 1)
Expected: [NoError, RevocationStatusUnknown | OfflineRevocati···
Actual:   [NoError, Revoked, RevocationStatusUnknown | Offlin···
↑ (pos 1)) (Assert.Equal() Failure
↓ (pos 1)
Expected: [NoError, RevocationStatusUnknown | OfflineRevocati···
Actual:   [NoError, Revoked, RevocationStatusUnknown | Offlin···
↑ (pos 1)) (Assert.Equal() Failure
↓ (pos 1)
Expected: [NoError, RevocationStatusUnknown | OfflineRevocati···
Actual:   [NoError, Revoked, RevocationStatusUnknown | Offlin···
↑ (pos 1))
---- Assert.Equal() Failure
↓ (pos 1)
Expected: [NoError, RevocationStatusUnknown | OfflineRevocati···
Actual:   [NoError, Revoked, RevocationStatusUnknown | Offlin···
↑ (pos 1)
---- Assert.Equal() Failure
↓ (pos 1)
Expected: [NoError, RevocationStatusUnknown | OfflineRevocati···
Actual:   [NoError, Revoked, RevocationStatusUnknown | Offlin···
↑ (pos 1)
---- Assert.Equal() Failure
↓ (pos 1)
Expected: [NoError, RevocationStatusUnknown | OfflineRevocati···
Actual:   [NoError, Revoked, RevocationStatusUnknown | Offlin···
↑ (pos 1)
---- Assert.Equal() Failure
↓ (pos 1)
Expected: [NoError, RevocationStatusUnknown | OfflineRevocati···
Actual:   [NoError, Revoked, RevocationStatusUnknown | Offlin···
↑ (pos 1)
---- Assert.Equal() Failure
↓ (pos 1)
Expected: [NoError, RevocationStatusUnknown | OfflineRevocati···
Actual:   [NoError, Revoked, RevocationStatusUnknown | Offlin···
↑ (pos 1)

Stack trace
   at System.RetryHelper.Execute(Action test, Int32 maxAttempts, Func`2 backoffFunc, Predicate`1 retryWhen, String testName) in /_/src/libraries/Common/tests/TestUtilities/System/RetryHelper.cs:line 67
   at System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.SimpleTest(PkiOptions pkiOptions, RunSimpleTest callback, String callerName, Boolean pkiOptionsInTestName) in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/DynamicRevocationTests.cs:line 1543
   at System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.RevokeEndEntity_RootUnrelatedOcsp(PkiOptions pkiOptions) in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/DynamicRevocationTests.cs:line 458
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr) in /_/src/libraries/System.Private.CoreLib/src/System/Reflection/MethodInvoker.cs:line 69
----- Inner Stack Trace #1 (Xunit.Sdk.EqualException) -----
   at System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.AssertChainStatus(X509Chain chain, X509ChainStatusFlags rootStatus, X509ChainStatusFlags issrStatus, X509ChainStatusFlags leafStatus) in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/DynamicRevocationTests.cs:line 1572
   at System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.<>c__DisplayClass20_0.<RevokeEndEntity_RootUnrelatedOcsp>b__0(CertificateAuthority root, CertificateAuthority intermediate, X509Certificate2 endEntity, ChainHolder holder, RevocationResponder responder) in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/DynamicRevocationTests.cs:line 517
   at System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.<>c__DisplayClass46_0.<SimpleTest>b__0() in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/DynamicRevocationTests.cs:line 1541
   at System.RetryHelper.Execute(Action test, Int32 maxAttempts, Func`2 backoffFunc, Predicate`1 retryWhen, String testName) in /_/src/libraries/Common/tests/TestUtilities/System/RetryHelper.cs:line 67
----- Inner Stack Trace #2 (Xunit.Sdk.EqualException) -----
   at System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.AssertChainStatus(X509Chain chain, X509ChainStatusFlags rootStatus, X509ChainStatusFlags issrStatus, X509ChainStatusFlags leafStatus) in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/DynamicRevocationTests.cs:line 1572
   at System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.<>c__DisplayClass20_0.<RevokeEndEntity_RootUnrelatedOcsp>b__0(CertificateAuthority root, CertificateAuthority intermediate, X509Certificate2 endEntity, ChainHolder holder, RevocationResponder responder) in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/DynamicRevocationTests.cs:line 517
   at System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.<>c__DisplayClass46_0.<SimpleTest>b__0() in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/DynamicRevocationTests.cs:line 1541
   at System.RetryHelper.Execute(Action test, Int32 maxAttempts, Func`2 backoffFunc, Predicate`1 retryWhen, String testName) in /_/src/libraries/Common/tests/TestUtilities/System/RetryHelper.cs:line 67
----- Inner Stack Trace #3 (Xunit.Sdk.EqualException) -----
   at System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.AssertChainStatus(X509Chain chain, X509ChainStatusFlags rootStatus, X509ChainStatusFlags issrStatus, X509ChainStatusFlags leafStatus) in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/DynamicRevocationTests.cs:line 1572
   at System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.<>c__DisplayClass20_0.<RevokeEndEntity_RootUnrelatedOcsp>b__0(CertificateAuthority root, CertificateAuthority intermediate, X509Certificate2 endEntity, ChainHolder holder, RevocationResponder responder) in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/DynamicRevocationTests.cs:line 517
   at System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.<>c__DisplayClass46_0.<SimpleTest>b__0() in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/DynamicRevocationTests.cs:line 1541
   at System.RetryHelper.Execute(Action test, Int32 maxAttempts, Func`2 backoffFunc, Predicate`1 retryWhen, String testName) in /_/src/libraries/Common/tests/TestUtilities/System/RetryHelper.cs:line 67
----- Inner Stack Trace #4 (Xunit.Sdk.EqualException) -----
   at System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.AssertChainStatus(X509Chain chain, X509ChainStatusFlags rootStatus, X509ChainStatusFlags issrStatus, X509ChainStatusFlags leafStatus) in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/DynamicRevocationTests.cs:line 1572
   at System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.<>c__DisplayClass20_0.<RevokeEndEntity_RootUnrelatedOcsp>b__0(CertificateAuthority root, CertificateAuthority intermediate, X509Certificate2 endEntity, ChainHolder holder, RevocationResponder responder) in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/DynamicRevocationTests.cs:line 517
   at System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.<>c__DisplayClass46_0.<SimpleTest>b__0() in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/DynamicRevocationTests.cs:line 1541
   at System.RetryHelper.Execute(Action test, Int32 maxAttempts, Func`2 backoffFunc, Predicate`1 retryWhen, String testName) in /_/src/libraries/Common/tests/TestUtilities/System/RetryHelper.cs:line 67
----- Inner Stack Trace #5 (Xunit.Sdk.EqualException) -----
   at System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.AssertChainStatus(X509Chain chain, X509ChainStatusFlags rootStatus, X509ChainStatusFlags issrStatus, X509ChainStatusFlags leafStatus) in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/DynamicRevocationTests.cs:line 1572
   at System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.<>c__DisplayClass20_0.<RevokeEndEntity_RootUnrelatedOcsp>b__0(CertificateAuthority root, CertificateAuthority intermediate, X509Certificate2 endEntity, ChainHolder holder, RevocationResponder responder) in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/DynamicRevocationTests.cs:line 517
   at System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.<>c__DisplayClass46_0.<SimpleTest>b__0() in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/DynamicRevocationTests.cs:line 1541
   at System.RetryHelper.Execute(Action test, Int32 maxAttempts, Func`2 backoffFunc, Predicate`1 retryWhen, String testName) in /_/src/libraries/Common/tests/TestUtilities/System/RetryHelper.cs:line 67
VincentBu commented 2 years ago

Failed again in: runtime-libraries-coreclr outerloop 20220801.5

Failed test:

net7.0-windows-Release-x64-CoreCLR_release-(Windows.Nano.1809.Amd64.Open)windows.10.amd64.serverrs5.open@mcr.microsoft.com/dotnet-buildtools/prereqs:nanoserver-1809-helix-amd64-08e8e40-20200107182504

- System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.RevokeEndEntityWithInvalidRevocationSignature(pkiOptions: AllRevocation | IssuerAuthorityHasDesignatedOcspResponder | RootAuthorityHasDesignatedOcspResponder)

Error message:

System.Security.Cryptography.CryptographicException : Unknown error (0xc0000001)

Stack trace
   at System.Security.Cryptography.CngCommon.SignHash(SafeNCryptKeyHandle keyHandle, ReadOnlySpan`1 hash, AsymmetricPaddingMode paddingMode, Void* pPaddingInfo, Int32 estimatedSize) in /_/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/CngCommon.SignVerify.cs:line 42
   at System.Security.Cryptography.RSACng.SignHash(Byte[] hash, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding) in /_/src/libraries/Common/src/System/Security/Cryptography/RSACng.SignVerify.cs:line 83
   at System.Security.Cryptography.RSA.SignData(Byte[] data, Int32 offset, Int32 count, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding) in /_/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSA.cs:line 184
   at System.Security.Cryptography.X509Certificates.RSAPkcs1X509SignatureGenerator.SignData(Byte[] data, HashAlgorithmName hashAlgorithm) in /_/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/RSAPkcs1X509SignatureGenerator.cs:line 22
   at System.Security.Cryptography.X509Certificates.CertificateRequest.Create(X500DistinguishedName issuerName, X509SignatureGenerator generator, DateTimeOffset notBefore, DateTimeOffset notAfter, ReadOnlySpan`1 serialNumber) in /_/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/CertificateRequest.cs:line 685
   at System.Security.Cryptography.X509Certificates.CertificateRequest.CreateSelfSigned(DateTimeOffset notBefore, DateTimeOffset notAfter) in /_/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/CertificateRequest.cs:line 322
   at System.Security.Cryptography.X509Certificates.Tests.Common.CertificateAuthority.BuildPrivatePki(PkiOptions pkiOptions, RevocationResponder& responder, CertificateAuthority& rootAuthority, CertificateAuthority[]& intermediateAuthorities, X509Certificate2& endEntityCert, Int32 intermediateAuthorityCount, String testName, Boolean registerAuthorities, Boolean pkiOptionsInSubject, String subjectName, Int32 keySize, X509ExtensionCollection extensions) in /_/src/libraries/Common/tests/System/Security/Cryptography/X509Certificates/CertificateAuthority.cs:line 905
   at System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.BuildPrivatePki(PkiOptions pkiOptions, RevocationResponder& responder, CertificateAuthority& rootAuthority, CertificateAuthority& intermediateAuthority, X509Certificate2& endEntityCert, String testName, Boolean registerAuthorities, Boolean pkiOptionsInSubject) in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/DynamicRevocationTests.cs:line 1594
   at System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.SimpleTest(PkiOptions pkiOptions, RunSimpleTest callback, String callerName, Boolean pkiOptionsInTestName) in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/DynamicRevocationTests.cs:line 1543
   at System.Security.Cryptography.X509Certificates.Tests.RevocationTests.DynamicRevocationTests.RevokeEndEntityWithInvalidRevocationSignature(PkiOptions pkiOptions) in /_/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/DynamicRevocationTests.cs:line 879
   at InvokeStub_DynamicRevocationTests.RevokeEndEntityWithInvalidRevocationSignature(Object, Object, IntPtr*)
   at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
danmoseley commented 2 years ago

another example

System.Security.Cryptography.Rsa.Tests.EncryptDecrypt_Array.NonPowerOfTwoKeySizeOaepRoundtrip [[Console]](https://helixre107v0xdeko0k025g8.blob.core.windows.net/dotnet-runtime-refs-pull-74317-merge-9a6feaf6deb1423dab/System.Security.Cryptography.Cng.Tests/1/console.d1cb768f.log?helixlogtype=result) [[Details]](https://dev.azure.com/dnceng//public/_build/results?buildId=1957638&view=ms.vss-test-web.build-test-results-tab&runId=50313082&resultId=174500&paneView=debug) [[Artifacts]](https://dev.azure.com/dnceng//public/_build/results?buildId=1957638&view=ms.vss-test-web.build-test-results-tab&runId=50313082&resultId=174500&paneView=dotnet-dnceng.dnceng-build-release-tasks.helix-test-information-tab) [[0.02% failure rate]](https://dev.azure.com/dnceng//public/_build/results?buildId=1957638&view=ms.vss-test-web.build-test-results-tab&runId=50313082&resultId=174500&paneView=history)
Data Driven SubResults
❌ System.Security.Cryptography.Rsa.Tests.EncryptDecrypt_Array.NonPowerOfTwoKeySizeOaepRoundtrip(oaepPaddingMode: OaepSHA384)
Exception Message
System.Security.Cryptography.CryptographicException : Unknown error (0xc0000001)
Stack Trace
   at System.Security.Cryptography.RSACng.EncryptOrDecrypt(SafeNCryptKeyHandle key, ReadOnlySpan`1 input, AsymmetricPaddingMode paddingMode, Void* paddingInfo, Boolean encrypt) in /_/src/libraries/Common/src/System/Security/Cryptography/RSACng.EncryptDecrypt.cs:line 241
   at System.Security.Cryptography.RSACng.EncryptOrDecrypt(Byte[] data, RSAEncryptionPadding padding, Boolean encrypt) in /_/src/libraries/Common/src/System/Security/Cryptography/RSACng.EncryptDecrypt.cs:line 105
   at System.Security.Cryptography.RSACng.Decrypt(Byte[] data, RSAEncryptionPadding padding) in /_/src/libraries/Common/src/System/Security/Cryptography/RSACng.EncryptDecrypt.cs:line 25
   at System.Security.Cryptography.Rsa.Tests.EncryptDecrypt_Array.Decrypt(RSA rsa, Byte[] data, RSAEncryptionPadding padding) in /_/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/EncryptDecrypt.cs:line 16
   at System.Security.Cryptography.Rsa.Tests.EncryptDecrypt.NonPowerOfTwoKeySizeOaepRoundtrip(RSAEncryptionPadding oaepPaddingMode) in /_/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/EncryptDecrypt.cs:line 687
   at InvokeStub_EncryptDecrypt.NonPowerOfTwoKeySizeOaepRoundtrip(Object, Object, IntPtr*)
   at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
Failing Configuration
Windows.Nano.1809.Amd64.Open
ericstj commented 10 months ago

Another case: https://[helixre107v0xdcypoyl9e7f.blob.core.windows.net/dotnet-runtime-refs-pull-93940-merge-c7413118c61b424dbc/System.Security.Cryptography.Tests/1/console.9c54d531.log?helixlogtype=result](https://helixre107v0xdcypoyl9e7f.blob.core.windows.net/dotnet-runtime-refs-pull-93940-merge-c7413118c61b424dbc/System.Security.Cryptography.Tests/1/console.9c54d531.log?helixlogtype=result)

    System.Security.Cryptography.X509Certificates.Tests.DynamicChainTests.BuildInvalidSignatureTwice(endEntityErrors: NotTimeValid | NotSignatureValid, intermediateErrors: NotTimeValid, rootErrors: NotTimeValid | UntrustedRoot) [FAIL]
      System.Security.Cryptography.CryptographicException : Unknown error (0xc1000001)
      Stack Trace:
        /_/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSABCrypt.cs(311,0): at System.Security.Cryptography.RSABCrypt.TrySignHash(ReadOnlySpan`1 hash, Span`1 destination, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding, Int32& bytesWritten)
        /_/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSA.cs(626,0): at System.Security.Cryptography.RSA.SignHash(ReadOnlySpan`1 hash, Span`1 destination, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding)
        /_/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSABCrypt.cs(149,0): at System.Security.Cryptography.RSABCrypt.SignHash(Byte[] hash, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding)
        /_/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSA.cs(398,0): at System.Security.Cryptography.RSA.SignData(Byte[] data, Int32 offset, Int32 count, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding)
        /_/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSA.cs(376,0): at System.Security.Cryptography.RSA.SignData(Byte[] data, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding)
        /_/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/RSAPkcs1X509SignatureGenerator.cs(22,0): at System.Security.Cryptography.X509Certificates.RSAPkcs1X509SignatureGenerator.SignData(Byte[] data, HashAlgorithmName hashAlgorithm)
        /_/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/CertificateRequest.cs(885,0): at System.Security.Cryptography.X509Certificates.CertificateRequest.Create(X500DistinguishedName issuerName, X509SignatureGenerator generator, DateTimeOffset notBefore, DateTimeOffset notAfter, ReadOnlySpan`1 serialNumber)
        /_/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/CertificateRequest.cs(771,0): at System.Security.Cryptography.X509Certificates.CertificateRequest.Create(X500DistinguishedName issuerName, X509SignatureGenerator generator, DateTimeOffset notBefore, DateTimeOffset notAfter, Byte[] serialNumber)
        /_/src/libraries/System.Security.Cryptography/tests/X509Certificates/TestDataGenerator.cs(150,0): at System.Security.Cryptography.X509Certificates.Tests.TestDataGenerator.MakeTestChain(ReadOnlySpan`1 keys, Span`1 certs, IEnumerable`1 endEntityExtensions, IEnumerable`1 intermediateExtensions, IEnumerable`1 rootExtensions, String testName)
        /_/src/libraries/System.Security.Cryptography/tests/X509Certificates/TestDataGenerator.cs(32,0): at System.Security.Cryptography.X509Certificates.Tests.TestDataGenerator.MakeTestChain3(X509Certificate2& endEntityCert, X509Certificate2& intermediateCert, X509Certificate2& rootCert, IEnumerable`1 endEntityExtensions, IEnumerable`1 intermediateExtensions, IEnumerable`1 rootExtensions, String testName)
        /_/src/libraries/System.Security.Cryptography/tests/X509Certificates/DynamicChainTests.cs(79,0): at System.Security.Cryptography.X509Certificates.Tests.DynamicChainTests.BuildInvalidSignatureTwice(X509ChainStatusFlags endEntityErrors, X509ChainStatusFlags intermediateErrors, X509ChainStatusFlags rootErrors)
           at InvokeStub_DynamicChainTests.BuildInvalidSignatureTwice(Object, Span`1)
           at System.Reflection.MethodBaseInvoker.InvokeWithFewArgs(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
jeffhandley commented 9 months ago

We should take another look at this since it does occasionally cause CI to fail. Adding to the 9.0.0 milestone.

jeffhandley commented 9 months ago

I chatted with @bartonjs about this and here are some notes:

The best thing we could do is seek an approach of using an xUnit hook where we could apply an attribute to tests (or test classes) indicating, "if this test fails with an exception that looks like this, retry the test once". Such an approach, if feasible, would likely stop these CI failures.

v-wenyuxu commented 6 months ago

Failed in: runtime-coreclr libraries-jitstressregs 20240303.1

Failed tests:

net9.0-windows-Release-x86-CoreCLR_checked-jitstressregs2-Windows.10.Amd64.Open
    - System.Security.Cryptography.Rsa.Tests.RSAKeyFileTests.NoFuzzyPkcs8

Error message:

 System.Security.Cryptography.CryptographicException : An internal error occurred.

Stack trace:

   at System.Security.Cryptography.CapiHelper.GetKeyPairHelper(CspAlgorithmType keyType, CspParameters parameters, Int32 keySize, SafeProvHandle safeProvHandle) in /_/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/CapiHelper.Windows.cs:line 734
   at System.Security.Cryptography.RSACryptoServiceProvider.get_SafeKeyHandle() in /_/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSACryptoServiceProvider.Windows.cs:line 134
   at System.Security.Cryptography.RSACryptoServiceProvider.ExportParameters(Boolean includePrivateParameters) in /_/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSACryptoServiceProvider.Windows.cs:line 362
   at System.Security.Cryptography.RSA.ExportRSAPublicKey() in /_/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSA.cs:line 713
   at System.Security.Cryptography.Rsa.Tests.RSAKeyFileTests.NoFuzzyPkcs8() in /_/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/RSAKeyFileTests.cs:line 1002
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args) in /_/src/coreclr/System.Private.CoreLib/src/System/Reflection/MethodBaseInvoker.CoreCLR.cs:line 36
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr) in /_/src/libraries/System.Private.CoreLib/src/System/Reflection/MethodBaseInvoker.cs:line 57