Repository navigation
Fix OpenSSL 4 signature configuration and renegotiation errors - #138127
Merged
Merged
Conversation
Map the SM2 signature scheme advertised by OpenSSL 4 to its accepted name. Read failures from non-I/O renegotiation APIs through the error queue instead of consulting stale SSL_get_error I/O state. Add coverage for configuring all RSA-padding combinations. Co-authored-by: Copilot App <[email protected]>
|
Azure Pipelines: Successfully started running 4 pipeline(s). 11 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Tagging subscribers to this area: @dotnet/ncl, @bartonjs, @vcsjones |
Member
|
We should probably back port this to .NET 11 and .NET 10. While 11 and 10 will remain "preferring" OpenSSL 3 over 4, they do load OpenSSL 4 if 4 is the only one available. |
wfurt
approved these changes
Nov 23, 2026
Member
Author
|
/backport to release/11.0 |
Member
Author
|
/backport to release/10.0 |
Contributor
|
Started backporting to |
Contributor
|
Started backporting to |
Contributor
|
@rzikm backporting to git am output$ git cherry-pick e59cd983cf02cae356d135079a058a3c2b65e249
Auto-merging src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.OpenSsl.cs
CONFLICT (modify/delete): src/libraries/System.Net.Security/tests/UnitTests/OpenSslErrorTests.cs deleted in HEAD and modified in e59cd983cf0 (Fix OpenSSL 4 signature configuration and renegotiation errors (#138127)). Version e59cd983cf0 (Fix OpenSSL 4 signature configuration and renegotiation errors (#138127)) of src/libraries/System.Net.Security/tests/UnitTests/OpenSslErrorTests.cs left in tree.
Auto-merging src/native/libs/System.Security.Cryptography.Native/pal_ssl.c
CONFLICT (content): Merge conflict in src/native/libs/System.Security.Cryptography.Native/pal_ssl.c
error: could not apply e59cd983cf0... Fix OpenSSL 4 signature configuration and renegotiation errors (#138127)
hint: After resolving the conflicts, mark them with
hint: "git add/rm <pathspec>", then run
hint: "git cherry-pick --continue".
hint: You can instead skip this commit with "git cherry-pick --skip".
hint: To abort and get back to the state before "git cherry-pick",
hint: run "git cherry-pick --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
$ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch
Applying: Fix OpenSSL 4 signature configuration and renegotiation errors
Using index info to reconstruct a base tree...
M src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.OpenSsl.cs
A src/libraries/System.Net.Security/tests/UnitTests/OpenSslErrorTests.cs
M src/native/libs/System.Security.Cryptography.Native/pal_ssl.c
Falling back to patching base and 3-way merge...
Auto-merging src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.OpenSsl.cs
CONFLICT (modify/delete): src/libraries/System.Net.Security/tests/UnitTests/OpenSslErrorTests.cs deleted in HEAD and modified in Fix OpenSSL 4 signature configuration and renegotiation errors. Version Fix OpenSSL 4 signature configuration and renegotiation errors of src/libraries/System.Net.Security/tests/UnitTests/OpenSslErrorTests.cs left in tree.
Auto-merging src/native/libs/System.Security.Cryptography.Native/pal_ssl.c
CONFLICT (content): Merge conflict in src/native/libs/System.Security.Cryptography.Native/pal_ssl.c
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Patch failed at 0001 Fix OpenSSL 4 signature configuration and renegotiation errors
Error: The process '/usr/bin/git' failed with exit code 128 |
Contributor
|
@rzikm backporting to git am output$ git cherry-pick e59cd983cf02cae356d135079a058a3c2b65e249
Auto-merging src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.OpenSsl.cs
Auto-merging src/libraries/System.Net.Security/tests/UnitTests/OpenSslErrorTests.cs
CONFLICT (content): Merge conflict in src/libraries/System.Net.Security/tests/UnitTests/OpenSslErrorTests.cs
Auto-merging src/native/libs/System.Security.Cryptography.Native/pal_ssl.c
error: could not apply e59cd983cf0... Fix OpenSSL 4 signature configuration and renegotiation errors (#138127)
hint: After resolving the conflicts, mark them with
hint: "git add/rm <pathspec>", then run
hint: "git cherry-pick --continue".
hint: You can instead skip this commit with "git cherry-pick --skip".
hint: To abort and get back to the state before "git cherry-pick",
hint: run "git cherry-pick --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
$ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch
Applying: Fix OpenSSL 4 signature configuration and renegotiation errors
Using index info to reconstruct a base tree...
M src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.OpenSsl.cs
M src/libraries/System.Net.Security/tests/UnitTests/OpenSslErrorTests.cs
M src/native/libs/System.Security.Cryptography.Native/pal_ssl.c
Falling back to patching base and 3-way merge...
Auto-merging src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.OpenSsl.cs
Auto-merging src/libraries/System.Net.Security/tests/UnitTests/OpenSslErrorTests.cs
CONFLICT (content): Merge conflict in src/libraries/System.Net.Security/tests/UnitTests/OpenSslErrorTests.cs
Auto-merging src/native/libs/System.Security.Cryptography.Native/pal_ssl.c
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Patch failed at 0001 Fix OpenSSL 4 signature configuration and renegotiation errors
Error: The process '/usr/bin/git' failed with exit code 128 |
This was referenced Nov 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Prioritizing OpenSSL 4 in #137823 exposed two compatibility failures in RSA-padding configuration and post-handshake client authentication. The same Ubuntu 26.10 image previously passed the affected cases with OpenSSL 3.
0x0708) tosm2sig_sm3. The fallback string0x0708is rejected by OpenSSL 4.0.3, causing signature-list configuration to fail before authentication completes. Add a four-case theory covering the RSA-padding combinations.SSL_verify_client_post_handshakeandSSL_renegotiateas error-queue failures rather than queryingSSL_get_error. These APIs schedule work, rather than perform I/O. OpenSSL 4 no longer consults the error stack inSSL_get_error, so the old code could return a previousWANT_READand lose the queued failure reason.The PHA documentation explicitly directs callers to the error stack; the SSL_get_error documentation describes its I/O-only contract and the OpenSSL 4 change. Reporting
SSL_ERROR_SSLfrom our shim routes the failure through existing queue decoding. The actualSSL_R_EXTENSION_NOT_RECEIVEDreason and itsNoRenegotiationmapping remain unchanged.Validation
Built and tested Linux x64 in WSL using the exact CI image's OpenSSL 4.0.3 and 3.5.5 libraries, selected with
LD_LIBRARY_PATHandDOTNET_OPENSSL_VERSION_OVERRIDE. Verified the loaded library versions../build.sh clr+libs -rc release./dotnet.sh build src/native/libs/build-native.proj -p:RuntimeConfiguration=Release./dotnet.sh build src/libraries/System.Net.Security/src/System.Net.Security.csproj -p:RuntimeConfiguration=Release./dotnet.sh build src/libraries/System.Net.Security/tests/FunctionalTests/System.Net.Security.Tests.csproj /t:Test -p:RuntimeConfiguration=Release./dotnet.sh build src/libraries/System.Net.Security/tests/UnitTests/System.Net.Security.Unit.Tests.csproj /t:Test -p:RuntimeConfiguration=ReleaseAll eight affected RSA/PHA cases pass on both versions. Before the fix, the new signature theory failed all four cases and both affected PHA tests failed on OpenSSL 4. All nine existing error-layout theory cases still pass.
The unit failure is
NegotiateAuthenticationTests.Package_Unsupported_NTLM(expectedUnsupported, actualContinueNeeded). Rebuilt pristine source and reproduced that same failure on both OpenSSL versions: 125 passed, 1 failed, 12 skipped. No assertions were relaxed or tests disabled.Validation used the extracted libraries, not a complete CI-container run. OpenSSL 1.x/4.1 and other platforms were not tested.
Note
These code changes and this PR description were prepared with GitHub Copilot.