Generate multipart ML-DSA tests#300
Open
gilles-peskine-arm wants to merge 3 commits intoMbed-TLS:mainfrom
Open
Generate multipart ML-DSA tests#300gilles-peskine-arm wants to merge 3 commits intoMbed-TLS:mainfrom
gilles-peskine-arm wants to merge 3 commits intoMbed-TLS:mainfrom
Conversation
We tend to generate the signature of the same message under the same keys multiple times for different APIs (sign/verify, driver/dispatch, ...). Caching results makes the script noticeably faster. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Not done by default for smooth transition in the consuming TF-PSA-Crypto branch. It's up to the calling script `generate_mldsa_tests.py` to enable the new test cases. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This was referenced Apr 20, 2026
bjwtaylor
reviewed
Apr 23, 2026
| The number of message chunks must be at most MULTIPART_ARITY. | ||
| """ | ||
| assert len(lengths) <= self.MULTIPART_ARITY | ||
| chunks = ([bytes(i) * n for i, n in enumerate(lengths, 65)] + |
Contributor
Author
There was a problem hiding this comment.
Indeed, that's what I had meant to write. I wanted a little diversity, not a fixed message like all-bytes-zero, because that could hide some bugs.
Though looking back at it, I think it would make more sense to have multiple test cases with the same message split in different ways. Having that doesn't help catch bugs, but it could make diagnosing easier. So I'll change the message content, of course fixing it to be the intended length.
Fix a bug whereby the chunks did not actually have the desired lengths. Make the message content depend only on its length, and not how it is split into chunks. This way, it'll be easier to notice and analyze bugs that cause different outputs for different ways to split the input. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
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.
Expand the ML-DSA test case generator to multipart tests.
PR checklist