Skip to content

Prioritize loading OpenSSL 4.x - #137823

Merged
vcsjones merged 2 commits into
dotnet:mainfrom
vcsjones:ossl4x-loaders
Nov 21, 2026
Merged

vcsjones merged 2 commits into
dotnet:mainfrom
vcsjones:ossl4x-loaders

Conversation

@vcsjones

Copy link
Copy Markdown
Member
  1. OpenSSL 3.x was preferentially loaded before 4.x because at the time 4.x was not stable. That is no longer true, so lets' probe for OpenSSL 4.x first, and prefer it if both are present.

  2. The OpenBSD and FreeBSD SO names were not present for OpenSSL 4.1 from Ports, so let's catch them up.

    Recall that OpenBSD loads by directory name, not by an SONAME suffix, then by highest SHLIBVER in the directory.

  3. OpenSSL from 3.6 via Ports was also missing, so let's add it. It's no longer supported, but FreeBSD still has it with an SONAME suffix of 18. https://cgit.freebsd.org/ports/plain/security/openssl36/version.mk

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
12 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @bartonjs, @vcsjones, @dotnet/area-system-security
See info in area-owners.md if you want to be subscribed.

@vcsjones
vcsjones requested a review from bartonjs November 18, 2026 14:59
@vcsjones vcsjones added this to the 12.0.0 milestone Nov 18, 2026
@vcsjones
vcsjones merged commit a42ac8d into dotnet:main Nov 21, 2026
67 of 69 checks passed
@vcsjones
vcsjones deleted the ossl4x-loaders branch November 21, 2026 02:28
rzikm added a commit that referenced this pull request Nov 24, 2026
<!-- -->
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.

- Map the advertised SM2 signature scheme (`0x0708`) to `sm2sig_sm3`.
The fallback string `0x0708` is 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.
- Treat failures from `SSL_verify_client_post_handshake` and
`SSL_renegotiate` as error-queue failures rather than querying
`SSL_get_error`. These APIs schedule work, rather than perform I/O.
OpenSSL 4 no longer consults the error stack in `SSL_get_error`, so the
old code could return a previous `WANT_READ` and lose the queued failure
reason.

The [PHA
documentation](https://docs.openssl.org/4.0/man3/SSL_CTX_set_verify/#return-values)
explicitly directs callers to the error stack; the [SSL_get_error
documentation](https://docs.openssl.org/4.0/man3/SSL_get_error/)
describes its I/O-only contract and the OpenSSL 4 change. Reporting
`SSL_ERROR_SSL` from our shim routes the failure through existing queue
decoding. The actual `SSL_R_EXTENSION_NOT_RECEIVED` reason and its
`NoRenegotiation` mapping 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_PATH` and
`DOTNET_OPENSSL_VERSION_OVERRIDE`. Verified the loaded library versions.

| Command | Result |
| --- | --- |
| `./build.sh clr+libs -rc release` | Passed |
| `./dotnet.sh build src/native/libs/build-native.proj
-p:RuntimeConfiguration=Release` | Passed |
| `./dotnet.sh build
src/libraries/System.Net.Security/src/System.Net.Security.csproj
-p:RuntimeConfiguration=Release` | Passed |
| `./dotnet.sh build
src/libraries/System.Net.Security/tests/FunctionalTests/System.Net.Security.Tests.csproj
/t:Test -p:RuntimeConfiguration=Release` | Both OpenSSL versions: 5,164
passed, 0 failed, 8 skipped |
| `./dotnet.sh build
src/libraries/System.Net.Security/tests/UnitTests/System.Net.Security.Unit.Tests.csproj
/t:Test -p:RuntimeConfiguration=Release` | Both versions: 129 passed, 1
pre-existing failure, 12 skipped |

All 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` (expected
`Unsupported`, actual `ContinueNeeded`). 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.

Co-authored-by: Copilot App <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-System.Security cryptographic-docs-impact Issues impacting cryptographic docs. Cleared and reused after documentation is updated each release.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants