Skip to content

Generate MLDSA test cases for the driver and dispatch layers#282

Merged
gilles-peskine-arm merged 14 commits intoMbed-TLS:mainfrom
gilles-peskine-arm:mldsa-pqcp-driver-framework
Apr 8, 2026
Merged

Generate MLDSA test cases for the driver and dispatch layers#282
gilles-peskine-arm merged 14 commits intoMbed-TLS:mainfrom
gilles-peskine-arm:mldsa-pqcp-driver-framework

Conversation

@gilles-peskine-arm
Copy link
Copy Markdown
Contributor

@gilles-peskine-arm gilles-peskine-arm commented Feb 25, 2026

Framework support for Mbed-TLS/TF-PSA-Crypto#700.

Continues #278.

Needs preceding PR:

PR checklist

@gilles-peskine-arm gilles-peskine-arm added the needs-preceding-pr Requires another PR to be merged first label Feb 25, 2026
@gilles-peskine-arm gilles-peskine-arm added needs-ci Needs to pass CI tests size-s Estimated task size: small (~2d) priority-high High priority - will be reviewed soon labels Feb 25, 2026
@gilles-peskine-arm gilles-peskine-arm force-pushed the mldsa-pqcp-driver-framework branch from 1a4d56b to 44b926c Compare February 25, 2026 20:15
@gilles-peskine-arm gilles-peskine-arm force-pushed the mldsa-pqcp-driver-framework branch from 44b926c to 9d3741d Compare February 26, 2026 10:15
@gilles-peskine-arm gilles-peskine-arm force-pushed the mldsa-pqcp-driver-framework branch from 9d3741d to 5371456 Compare March 19, 2026 15:12
@gilles-peskine-arm gilles-peskine-arm added needs-work and removed needs-preceding-pr Requires another PR to be merged first labels Mar 19, 2026
@gilles-peskine-arm gilles-peskine-arm force-pushed the mldsa-pqcp-driver-framework branch from 5371456 to 94a7719 Compare March 23, 2026 15:13
@gilles-peskine-arm gilles-peskine-arm force-pushed the mldsa-pqcp-driver-framework branch from 94a7719 to 2c1ed7b Compare March 25, 2026 17:16
@gilles-peskine-arm gilles-peskine-arm added needs-review Every commit must be reviewed by at least two team members. needs-reviewer This PR needs someone to pick it up for review needs-work and removed needs-work needs-ci Needs to pass CI tests needs-review Every commit must be reviewed by at least two team members. needs-reviewer This PR needs someone to pick it up for review labels Mar 27, 2026
We don't support ML-DSA in libtestdriver1 yet, because it's a copy of the
`builtin` driver but ML-DSA is provided by the `pqcp` driver. This means
that we can't test “driver-only” ML-DSA builds, but it should be possible to
enable ML-DSA in a build that dispatches through the test driver. This is
currently impossible because pure ML-DSA is not a sign-the-hash algorithm,
but the code in the test driver for signatures assumes that all signature
algorithms are sign-the-hash. Fix this in a minimal way by making the test
driver activate the fallback mechanism of driver dispatch when the algorithm
is pure ML-DSA. (Don't do this for all algorithms that are not sign-the-hash,
because in general, we do want the test driver to fail if it's given an
algorithm that it doesn't support.)

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
When TF-PSA-Crypto has pure ML-DSA, we need to handle it in the test driver
for signatures. But we must not try to reference ML-DSA identifiers in
TF-PSA-Crypto branches where they don't exist yet, even though the
compilation option already exists (which notably includes the TF-PSA-Crypto
1.1.0 release).

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
When building Mbed TLS with test drivers, "psa_crypto_mldsa.h" is not on the
include path. Rather than get it on, which seems complicated and is not
desirable in the long term, arrange to do without this header. We just need
to define the macro PSA_ALG_IS_ML_DSA, and its behavior is defined by the
PSA Crypto API specification so pretty much set in stone.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
@gilles-peskine-arm gilles-peskine-arm force-pushed the mldsa-pqcp-driver-framework branch from 7d8c974 to b68a5c0 Compare March 31, 2026 13:20
@gilles-peskine-arm gilles-peskine-arm added needs-ci Needs to pass CI tests and removed needs-work labels Mar 31, 2026
Maintainer scripts may require a more recent Python than the version we
currently use for Python checks (3.6).

Mbed-TLS#293

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
@gilles-peskine-arm gilles-peskine-arm force-pushed the mldsa-pqcp-driver-framework branch from b68a5c0 to dcf227c Compare March 31, 2026 16:26
@gilles-peskine-arm gilles-peskine-arm added needs-review Every commit must be reviewed by at least two team members. needs-reviewer This PR needs someone to pick it up for review and removed needs-ci Needs to pass CI tests labels Mar 31, 2026
@bjwtaylor bjwtaylor self-requested a review April 1, 2026 06:45
@valeriosetti valeriosetti self-requested a review April 1, 2026 09:53
@valeriosetti valeriosetti removed the needs-reviewer This PR needs someone to pick it up for review label Apr 1, 2026
Copy link
Copy Markdown

@bjwtaylor bjwtaylor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still need to do a full review, however some initial comments. I also think it needs a rebase as currently with the upstream versions the build produces fatal error: test/fork_helpers.h: No such file or directory, though this is a minor point.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this file need the standard copyright header?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It could, but there's nothing in the file that would actually get copyright protection. (Then again, there have been copyright claims on the empty program…) I copied an existing file.

message: bytes,
descr: str) -> test_case.TestCase:
"""Construct one test case for deterministic signature."""
signature = key.sign_message(message, deterministic=True)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we 100% sure that we will never support anything but deterministic? Id not would this be better as an input variable? Other PR's seem to indicate maybe this is temporary?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are 100% sure that we will support non-deterministic signatures. But they're not implemented yet. And this method is only for deterministic signatures. Non-deterministic signature testing will have a different method because the test data looks very different.

@gilles-peskine-arm
Copy link
Copy Markdown
Contributor Author

The last CI run failed because the branch is out of date. I've pushed a merge commit with the head of main. This doesn't invalidate the existing approval.

Copy link
Copy Markdown

@bjwtaylor bjwtaylor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve subject to CI

@github-project-automation github-project-automation bot moved this from In Development to Has Approval in Roadmap pull requests (new board) Apr 7, 2026
@gilles-peskine-arm gilles-peskine-arm added approved Design and code approved - may be waiting for CI or backports needs-ci Needs to pass CI tests and removed needs-review Every commit must be reviewed by at least two team members. needs-ci Needs to pass CI tests labels Apr 7, 2026
@gilles-peskine-arm gilles-peskine-arm merged commit c6610dd into Mbed-TLS:main Apr 8, 2026
2 checks passed
@github-project-automation github-project-automation bot moved this from Has Approval to Done in Roadmap pull requests (new board) Apr 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Design and code approved - may be waiting for CI or backports priority-high High priority - will be reviewed soon size-s Estimated task size: small (~2d)

Development

Successfully merging this pull request may close these issues.

3 participants