Improve ML-DSA and SLH-DSA steps for the supports() method - #76
Open
panva wants to merge 2 commits into
Open
Conversation
Expose the unconditional 255-byte context limit before sign and verify reach an unavailable key.
For example, this now returns false:
SubtleCrypto.supports("sign", {
name: "ML-DSA-44",
context: new Uint8Array(256),
})
No ML-DSA key or message can make a 256-byte context valid.
Expose the unconditional 255-byte signing context limit before the operation reaches an unavailable key.
For example, this now returns false:
SubtleCrypto.supports("sign", {
name: "SLH-DSA-SHA2-128s",
context: new Uint8Array(256),
})
No SLH-DSA key or message can make a 256-byte signing context valid. Verification remains unchanged because FIPS 205 returns false rather than an error for an oversized context.
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.
The
SubtleCrypto.supports()method determines support by executing an operation's steps until it encounters unavailable key or data, key generation, a return, or an exception.The ML-DSA sign and verify operations and the SLH-DSA sign operation currently reach an unavailable key before the 255-byte context limit can be observed. This makes
supports()returntruefor a context that cannot be accepted with any key or message.This PR makes those unconditional failures observable before
supports()reaches its stopping point. It is the Modern Algorithms counterpart to w3c/webcrypto#558.Changes
false, rather than an error, for an oversized context.Successful operations are unchanged.
Examples
Each of the following now returns
false.ML-DSA context
No ML-DSA key or message can make a 256-byte context valid.
SLH-DSA signing context
No SLH-DSA key or message can make a 256-byte signing context valid. Verification remains unchanged because FIPS 205 returns
falserather than an error for an oversized context.Preview | Diff