Remove unused OpenSSL Interop - #131968
Open
vcsjones wants to merge 2 commits into
Open
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 0cb4b5e8-0d6f-4dc1-91ad-2cfb4fce64c8
|
Azure Pipelines: Successfully started running 3 pipeline(s). 13 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
There was a problem hiding this comment.
Pull request overview
This PR removes unused OpenSSL interop exports from System.Security.Cryptography.Native and deletes corresponding managed LibraryImport declarations, reducing native surface area and dead code in the Unix crypto PAL.
Changes:
- Removed unused native shims/exports (
CryptoNative_X509Duplicate,CryptoNative_SetCiphers,CryptoNative_BioCtrlPending,CryptoNative_BigNumFromBinary) and their header declarations. - Updated the native export resolver table (
entrypoints.c) to drop the removed entrypoints. - Removed unused managed
LibraryImportoverloads and updated the BIGNUM export to use a Span-based signature.
Show a summary per file
| File | Description |
|---|---|
| src/native/libs/System.Security.Cryptography.Native/pal_x509.h | Removes CryptoNative_X509Duplicate declaration from the X509 PAL header. |
| src/native/libs/System.Security.Cryptography.Native/pal_x509.c | Removes the CryptoNative_X509Duplicate implementation. |
| src/native/libs/System.Security.Cryptography.Native/pal_ssl.h | Removes CryptoNative_SetCiphers declaration from the SSL PAL header. |
| src/native/libs/System.Security.Cryptography.Native/pal_ssl.c | Removes the CryptoNative_SetCiphers implementation. |
| src/native/libs/System.Security.Cryptography.Native/pal_bio.h | Removes CryptoNative_BioCtrlPending declaration from the BIO PAL header. |
| src/native/libs/System.Security.Cryptography.Native/pal_bio.c | Removes the CryptoNative_BioCtrlPending implementation. |
| src/native/libs/System.Security.Cryptography.Native/pal_bignum.h | Removes CryptoNative_BigNumFromBinary declaration from the BIGNUM PAL header. |
| src/native/libs/System.Security.Cryptography.Native/pal_bignum.c | Removes the CryptoNative_BigNumFromBinary implementation. |
| src/native/libs/System.Security.Cryptography.Native/entrypoints.c | Drops removed exports from the DllImport resolver table. |
| src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.X509.cs | Removes unused DecodeX509(IntPtr, ...) and X509Duplicate imports. |
| src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.Ssl.cs | Removes unused overload imports and SslSetCiphers. |
| src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.SetProtocolOptions.cs | Removes unused SslCtxSetProtocolOptions(IntPtr, ...) import. |
| src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.BIO.cs | Removes unused BioRead/BioCtrlPending imports. |
| src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.Bignum.cs | Removes unused BigNumFromBinary + helper and switches BigNumToBinary to Span-based import. |
Copilot's findings
- Files reviewed: 14/14 changed files
- Comments generated: 2
DeagleGross
approved these changes
Aug 10, 2026
Contributor
There was a problem hiding this comment.
Review details
Suppressed comments (1)
src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.X509.cs:55
X509Duplicatehas been removed from the OpenSSL interop surface, but there is still a comment insrc/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/OpenSslX509CertificateReader.cs(aroundCopyWithPrivateKey, lines ~643-644) that says "This could be X509Duplicate". Please update that comment to avoid referring to a deleted symbol (e.g., mention a "full clone via X509_dup" instead).
/// <summary>
/// Increment the native reference count of the certificate to protect against
/// a free from another pointer-holder.
/// </summary>
[LibraryImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_X509UpRef")]
internal static partial SafeX509Handle X509UpRef(IntPtr handle);
- Files reviewed: 14/14 changed files
- Comments generated: 0 new
- Review effort level: Lite
DeagleGross
approved these changes
Aug 11, 2026
vcsjones
enabled auto-merge (squash)
August 11, 2026 19:16
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.
There are a few interop methods and p/invoke helpers that are no longer used. Let's delete all of them.