Gate Composite ML-DSA CNG tests on NCrypt support - #132854
Conversation
|
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. |
|
Tagging subscribers to this area: @bartonjs, @vcsjones, @dotnet/area-system-security |
There was a problem hiding this comment.
Pull request overview
This PR refines Windows gating for Composite ML-DSA tests by (1) adding a Windows build+UBR based capability check for overall Composite ML-DSA support and (2) adding an NCrypt-based check to gate CNG-specific Composite ML-DSA tests.
Changes:
- Add
PlatformDetection.IsWindowsCompositeMLDsaSupportedwhich uses Windows build + UBR thresholds to detect Composite ML-DSA availability. - Add an NCrypt probing gate (
CompositeMLDsaTestHelpers.IsCngSupported) and use it to conditionally run Composite ML-DSA CNG tests on Windows. - Update CompositeMLDsa factory/platform support tests to use the new Windows capability check.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Windows.cs | Adds a cached Windows build+UBR based check for Composite ML-DSA support. |
| src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/CompositeMLDsa/CompositeMLDsaTestHelpers.Cng.cs | Introduces an NCrypt-based gate to determine whether Composite ML-DSA is supported through CNG/NCrypt. |
| src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/CompositeMLDsa/CompositeMLDsaFactoryTests.cs | Updates Windows support expectations to use IsWindowsCompositeMLDsaSupported. |
| src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/CompositeMLDsa/CompositeMLDsaCngTests.Windows.cs | Switches CNG test gating to use the NCrypt-based gate. |
| src/libraries/Common/src/Interop/Windows/NCrypt/Interop.NCryptOpenStorageProvider.cs | Adds the NCryptIsAlgSupported interop import used by the new test gate. |
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: ec0a4077-6117-435b-a4cd-0ef8de781ca5
b09c582 to
8709896
Compare
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 11ffe761-e9d2-47c2-ace0-857272c52b10
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.
Suppressed comments (1)
src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/CompositeMLDsa/CompositeMLDsaTestHelpers.Cng.cs:120
IsCngSupportedis used as a[ConditionalClass]/[ConditionalFact]gate. IfNCryptOpenStorageProviderreturns a failure code for environmental reasons (e.g., restricted environment), the current code throws and turns a skip condition into a hard failure (and theLazy<bool>will cache the exception for all subsequent checks). Consider treating an inability to open the provider as "CNG not supported" for the purposes of gating these tests.
if (error != ErrorCode.ERROR_SUCCESS)
{
throw error.ToCryptographicException();
}
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 11ffe761-e9d2-47c2-ace0-857272c52b10
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.
Suppressed comments (1)
Previously missed (1) — in code that hasn't changed since the last review.
src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/CompositeMLDsa/CompositeMLDsaTestHelpers.Cng.cs:113
CheckCngSupportprobes NCrypt support by introducing/using a newInterop.NCrypt.NCryptIsAlgSupportedP/Invoke in product code. Since this is only used to gate tests, consider switching the probe to a pure managed check (e.g., tryCngKey.Create(CngAlgorithm.CompositeMLDsa, ...)with ephemeral parameters and return false onNTE_NOT_SUPPORTED) so you can avoid carrying a new NCrypt interop entry insrc/libraries/Common/srcsolely for tests.
ErrorCode error = Interop.NCrypt.NCryptOpenStorageProvider(
out SafeNCryptProviderHandle provider,
CngProvider.MicrosoftSoftwareKeyStorageProvider.Provider,
0);
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 11ffe761-e9d2-47c2-ace0-857272c52b10
|
/ba-g #132831 |
|
/backport to release/11.0 |
|
Started backporting to |
|
/backport to release/10.0 |
|
Started backporting to |
|
@PranavSenthilnathan backporting to git am output$ git cherry-pick caa4d61ee02e991b0592ffd9861cf052233cab4b
CONFLICT (modify/delete): src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/CompositeMLDsa/CompositeMLDsaCngTests.Windows.cs deleted in HEAD and modified in caa4d61ee02 (Gate Composite ML-DSA CNG tests on NCrypt support (#132854)). Version caa4d61ee02 (Gate Composite ML-DSA CNG tests on NCrypt support (#132854)) of src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/CompositeMLDsa/CompositeMLDsaCngTests.Windows.cs left in tree.
Auto-merging src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/CompositeMLDsa/CompositeMLDsaFactoryTests.cs
CONFLICT (content): Merge conflict in src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/CompositeMLDsa/CompositeMLDsaFactoryTests.cs
CONFLICT (modify/delete): src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/CompositeMLDsa/CompositeMLDsaTestHelpers.Cng.cs deleted in HEAD and modified in caa4d61ee02 (Gate Composite ML-DSA CNG tests on NCrypt support (#132854)). Version caa4d61ee02 (Gate Composite ML-DSA CNG tests on NCrypt support (#132854)) of src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/CompositeMLDsa/CompositeMLDsaTestHelpers.Cng.cs left in tree.
Auto-merging src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/CompositeMLDsa/CompositeMLDsaTestHelpers.cs
error: could not apply caa4d61ee02... Gate Composite ML-DSA CNG tests on NCrypt support (#132854)
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: Gate Composite ML-DSA CNG tests
Using index info to reconstruct a base tree...
M src/libraries/Common/src/Interop/Windows/NCrypt/Interop.NCryptOpenStorageProvider.cs
A src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/CompositeMLDsa/CompositeMLDsaCngTests.Windows.cs
M src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/CompositeMLDsa/CompositeMLDsaFactoryTests.cs
A src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/CompositeMLDsa/CompositeMLDsaTestHelpers.Cng.cs
M src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Windows.cs
Falling back to patching base and 3-way merge...
Auto-merging src/libraries/Common/src/Interop/Windows/NCrypt/Interop.NCryptOpenStorageProvider.cs
CONFLICT (modify/delete): src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/CompositeMLDsa/CompositeMLDsaCngTests.Windows.cs deleted in HEAD and modified in Gate Composite ML-DSA CNG tests. Version Gate Composite ML-DSA CNG tests of src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/CompositeMLDsa/CompositeMLDsaCngTests.Windows.cs left in tree.
Auto-merging src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/CompositeMLDsa/CompositeMLDsaFactoryTests.cs
CONFLICT (content): Merge conflict in src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/CompositeMLDsa/CompositeMLDsaFactoryTests.cs
CONFLICT (modify/delete): src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/CompositeMLDsa/CompositeMLDsaTestHelpers.Cng.cs deleted in HEAD and modified in Gate Composite ML-DSA CNG tests. Version Gate Composite ML-DSA CNG tests of src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/CompositeMLDsa/CompositeMLDsaTestHelpers.Cng.cs left in tree.
Auto-merging src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Windows.cs
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 Gate Composite ML-DSA CNG tests
Error: The process '/usr/bin/git' failed with exit code 128 |
|
net10.0 implements Composite ML-DSA in the managed layer, so we don't need to backport this unless we backport the native implementation as well. |
…2903) Backport of #132854 to release/11.0 Windows added BCrypt support for Composite ML-DSA which broke our tests. Fixes CI failures reported in #132830. This is a test-only fix. /cc @PranavSenthilnathan Co-authored-by: Pranav Senthilnathan <pranas@microsoft.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: ec0a4077-6117-435b-a4cd-0ef8de781ca5 Copilot-Session: 11ffe761-e9d2-47c2-ace0-857272c52b10
Fixes #132830
Gate Composite ML-DSA CNG tests when Windows exposes BCrypt support without corresponding NCrypt support.
A temporary NCrypt support check gates CNG tests until BCrypt and NCrypt support are provided together. The general Composite ML-DSA check uses specific Windows build revisions because not all machines have been serviced with support yet.
Note
GitHub Copilot helped create this PR.