Update Composite ML-DSA import/export APIs#118600
Merged
PranavSenthilnathan merged 4 commits intodotnet:mainfrom Aug 13, 2025
Merged
Update Composite ML-DSA import/export APIs#118600PranavSenthilnathan merged 4 commits intodotnet:mainfrom
PranavSenthilnathan merged 4 commits intodotnet:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the Composite ML-DSA import/export APIs to replace the Try*Core pattern with direct export methods that return byte counts instead of boolean success indicators. The change simplifies the API design by moving error handling logic out of the core methods.
Key changes include:
- Changed core export methods from returning
boolwithout int bytesWrittento returningintdirectly - Introduced new overloads that export directly to
Span<byte>destinations - Refactored size validation logic to use min/max bounds instead of complex size range objects
- Updated test infrastructure to match the new API patterns
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/libraries/System.Security.Cryptography/ref/System.Security.Cryptography.cs | Added new export overloads and updated abstract method signatures |
| src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/CompositeMLDsaImplementation.*.cs | Updated platform-specific implementations to use new export signatures |
| src/libraries/Common/src/System/Security/Cryptography/CompositeMLDsaManaged.cs | Refactored managed implementation to use direct return values instead of out parameters |
| src/libraries/Common/src/System/Security/Cryptography/CompositeMLDsaAlgorithm.cs | Replaced complex SizeRange system with simple min/max bounds and validation methods |
| src/libraries/Common/src/System/Security/Cryptography/CompositeMLDsa.cs | Updated export methods to use new core APIs and added Span-based overloads |
| src/libraries/Common/src/System/Security/Cryptography/CryptoPool.cs | Added IsRented property for conditional buffer management |
| src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/CompositeMLDsa/*.cs | Updated tests to match new API patterns and added comprehensive test coverage |
src/libraries/Common/src/System/Security/Cryptography/CompositeMLDsaAlgorithm.cs
Outdated
Show resolved
Hide resolved
Contributor
|
Tagging subscribers to this area: @dotnet/area-system-security, @bartonjs, @vcsjones |
Member
Author
|
/cc @jeffhandley @artl93 Updating PQC APIs for RC1 based on API Review approval |
This was referenced Aug 11, 2025
bartonjs
reviewed
Aug 11, 2025
src/libraries/Common/src/System/Security/Cryptography/CompositeMLDsaAlgorithm.cs
Outdated
Show resolved
Hide resolved
src/libraries/Common/src/System/Security/Cryptography/CompositeMLDsaAlgorithm.cs
Outdated
Show resolved
Hide resolved
src/libraries/Common/src/System/Security/Cryptography/CompositeMLDsaAlgorithm.cs
Show resolved
Hide resolved
src/libraries/Common/src/System/Security/Cryptography/CompositeMLDsaAlgorithm.cs
Outdated
Show resolved
Hide resolved
...Security/Cryptography/AlgorithmImplementations/CompositeMLDsa/CompositeMLDsaContractTests.cs
Outdated
Show resolved
Hide resolved
bartonjs
approved these changes
Aug 13, 2025
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.
Closes #118320