Feature-detect KMAC key size limits - #131424
Merged
Merged
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. |
Contributor
|
Tagging subscribers to this area: @bartonjs, @vcsjones, @dotnet/area-system-security |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the KMAC test infrastructure to infer OpenSSL key-size restrictions by probing whether a zero-length key can be imported, instead of attempting to identify the active/default OpenSSL provider via platform detection heuristics.
Changes:
- Replace provider-based detection of KMAC key size limits with a runtime probe (
Createwith an empty key). - Compute
PlatformKeySizeRequirementsfrom the probe result to drive test expectations and the defaultMinimalKey.
Show a summary per file
| File | Description |
|---|---|
| src/libraries/System.Security.Cryptography/tests/KmacTestDriver.cs | Adds a runtime probe to detect OpenSSL KMAC key-size limits and uses it to set PlatformKeySizeRequirements. |
Copilot's findings
- Files reviewed: 1/1 changed files
- Comments generated: 1
bartonjs
approved these changes
Jul 27, 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 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.
KMAC on OpenSSL's default provider has key size limits, the key must be in the range of [4, 512]. Windows does not have this limit, and SymCrypt-OpenSSL does not have this limit, either.
Detecting the presence of which provider is the default is tricky; we can look for a provider's presence on the system, but which is active is not always clear, and sometimes one provider defers to another.
This changes our KMAC tests to do a check it see if can import a zero-length key to determine the key size limits, rather than trying to detect provider presence.
Contributes to #129939