Repository navigation
improve error handling in OpenSSL init code - #125324
Merged
Merged
Conversation
Contributor
|
Tagging subscribers to this area: @dotnet/ncl, @bartonjs, @vcsjones |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adjusts the native OpenSSL initialization and SSL context creation paths in System.Security.Cryptography.Native to reduce the chance of hard failures (e.g., segfaults) when OpenSSL configuration/initialization is problematic, aligning with the investigation in #122303.
Changes:
- Add a fallback
OPENSSL_init_sslattempt withoutOPENSSL_INIT_LOAD_CONFIGwhen initialization with config loading fails. - Make
CryptoNative_SslCtxCreateexplicitly handle a nullSSL_METHOD*input (returning NULL instead of passing it toSSL_CTX_new). - Remove the debug
assertonTLS_method()return value inCryptoNative_SslV2_3Method.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/native/libs/System.Security.Cryptography.Native/pal_ssl.c | Adds a guard for null SSL_METHOD* in SSL context creation to avoid invalid calls into OpenSSL. |
| src/native/libs/System.Security.Cryptography.Native/openssl.c | Adds checked initialization and a retry path to reduce fragility when OpenSSL config loading fails. |
You can also share your feedback on Copilot code review. Take the survey.
ManickaP
approved these changes
Mar 17, 2026
rzikm
approved these changes
Mar 18, 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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
contributes to #122303. I don't have smoking gone. This was suggested by copilot and it looks reasonable to em. After analyzing the core dump, it claims it comes from JIT-compiled stub.