Skip to content

Multipart sign/verify: dispatch functions, dispatch to ML_DSA#775

Open
gilles-peskine-arm wants to merge 24 commits intoMbed-TLS:developmentfrom
gilles-peskine-arm:mldsa-sign-multipart-dispatch
Open

Multipart sign/verify: dispatch functions, dispatch to ML_DSA#775
gilles-peskine-arm wants to merge 24 commits intoMbed-TLS:developmentfrom
gilles-peskine-arm:mldsa-sign-multipart-dispatch

Conversation

@gilles-peskine-arm
Copy link
Copy Markdown
Contributor

@gilles-peskine-arm gilles-peskine-arm commented Apr 22, 2026

Add the driver dispatch functions for multipart signature and verification. Add dispatch to ML-DSA only, PQCP driver only.

Follow the driver interface for multipart sign/verify that I proposed in ARM-software/psa-api#350

Resolves #771

Prerequisites:

Status: feature complete. Needs the prerequisites to be merged and then a tweak to pacify Mbed TLS's outcome analysis.

PR checklist

  • changelog not required because: not user-facing yet
  • framework PR provided Generate multipart ML-DSA tests mbedtls-framework#300
  • TF-PSA-Crypto development PR here
  • TF-PSA-Crypto 1.1 PR not required because: new feature
  • mbedtls development PR not required because: crypto only
  • mbedtls 4.1 PR not required because: crypto only
  • mbedtls 3.6 PR not required because: crypto only
  • tests provided

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
In setup, only validation is implemented, not the storing of the key or the
start of the operation.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
As with the key type and algorithm macros, they are in the driver header for
now, and will move to the public API headers once MLDSA is reachable from
the API.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
In setup, only validation is implemented, not the key expansion or the
start of the operation.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This is a deviation from the application interface, which is practical given
that the core is supposed to have a copy of the key in the key store, and
is useful because it saves the driver from needing to make its own copy.

ARM-software/psa-api#350

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>
Copy the expanded private key on the heap from setup to finish.
Temporarily allocate the public key on the heap during setup.

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>
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>
There is nothing to dispatch to yet. But as a signpost, write never-enabled
boilerplate code to dispatch to test drivers (not written yet) and to the
built-in implementation (not written yet: we do not yet support any
algorithm that isn't hash-then-sign or sign-small-message).

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
There is nothing to dispatch to yet, so we're just checking that setup
returns `PSA_ERROR_NOT_SUPPORTED` and abort returns `PSA_SUCCESS`..

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
…operation

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This is a deviation from the application interface, which is practical given
that the core is supposed to have a copy of the key in the key store, and
is useful because it saves the driver from needing to make its own copy.

ARM-software/psa-api#350

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Add functions to test the whole sequence (setup, update(s), finish). Also
add test functions that focus on finish.

There are no test cases yet since no algorithm is supported yet.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
We need this to give it a driver ID for multipart operation dispatch, even
if none of the driver entry points are satisfactorily supported by
`generate_driver_wrappers.py`.

The `"export_public_key"` entry point is present in the driver and is
supported by `generate_driver_wrappers.py`. However, this is not usable
because the template `psa_crypto_driver_wrappers_no_static.c.jinja`
insists that dispatch to all non-built-in transparent drivers is guarded
by `PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT`, but dispatch to ML-DSA must
not be guarded by this macro. Sorting this out is out of scope here,
so keep using the manually written code to dispatch `"export_public_key"`
to the PQCP driver.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Reject calls to `set_context` for now. It will be implemented later.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Add tests that exercise checks done by setup and finish stages. Mostly bad
cases, with a few good cases for reference.

Copy of `tests/suites/test_suite_psa_crypto_mldsa.multipart.data`.

We test ML-DSA at the dispatch layer fairly extensively because we don't
have the API layer yet, and we expect early birds to access ML-DSA via
the dispatch layer. The tests focus on the behavior of our driver, and
may need to be revised when we start supporting third-party drives.
In other words, in the future, some of the test coverage added in this
commit will move to API layer tests, and some of the test coverage added
in this commit will become irrelevant because it's too specific to our
implementation.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
@gilles-peskine-arm gilles-peskine-arm added size-s Estimated task size: small (~2d) priority-high High priority - will be reviewed soon labels Apr 22, 2026
@gilles-peskine-arm gilles-peskine-arm added the needs-ci Needs to pass CI tests label Apr 22, 2026
# Tests that are not covered for a tracked reason, and that
# were also not covered by Mbed TLS testing as of Mbed TLS 4.1.0.
UNCOVERED_TESTS = {
'test_suite_config.crypto_combinations': [
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 also need to add this (and maybe more) to tf_psa_crypto_test_case_info.py.INTERNAL_TEST_CASES``. This requires Mbed-TLS/mbedtls#10700 (I don't want to add it yet to avoid a merge conflict).

@gilles-peskine-arm gilles-peskine-arm changed the title Mldsa sign multipart dispatch Multipart sign/verify: dispatch functions, dispatch to ML_DSA Apr 22, 2026
@gilles-peskine-arm gilles-peskine-arm added needs-work needs-preceding-pr Requires another PR to be merged first labels Apr 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ci Needs to pass CI tests needs-preceding-pr Requires another PR to be merged first needs-work priority-high High priority - will be reviewed soon size-s Estimated task size: small (~2d)

Projects

Development

Successfully merging this pull request may close these issues.

Multipart sign-message and verify-message dispatch to ML-DSA

1 participant