Skip to content

Conversation

@gilles-peskine-arm
Copy link
Contributor

@gilles-peskine-arm gilles-peskine-arm commented Jan 12, 2026

  • Create a pqcp driver.
  • Add mldsa-native as a submodule.
  • Include mldsa-native in the pqcp driver build.

Resolves #628. Resolves #655 since the WIndows CI is passing.

Note to reviewers: non-goals:

  • A solid integration configuration is out of scope. We'll review that later in Review mldsa-native integration #653. I'm not sure there are any more things we should configure (except SHAKE integration, which is a separate task, and other parameter sets, which is not planned yet). But if there are, now is not the time.
  • There's no functionality goal yet. I just want a passing build that includes mldsa-native (which is enabled in the full config).

Needs preceding PR:

PR checklist

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Make it large enough for reasonable ML-DSA tests.

Keep the old value (which is just barely large enough) when ML-DSA is disabled.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
These options are transitory. Eventually we'll want to deduce the MLDSA
build options from `PSA_WANT_xxx` and `MBEDTLS_PSA_ACCEL_xxx`.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Just a stub for now, to get the build going.

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>
Point to the head of `development`, which is somewhere past the 1.0.0-alpha
upstream release, with one patch from us to adjust user-facing documentation.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Define options for mldsa-native that are visible both when building the code
and when using it inside TF-PSA-Crypto.

* Declare our namespace.
* Set up a multilevel build.
* Disable features we won't use: random, supercop.
* Use our zeroize function.

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>
This way we can have build scripts that don't know about the pqcp driver,
and they will work as long as the library configuration doesn't enable a
PQCP feature (i.e. ML-DSA).

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Currently, the libtestdriver1 build in tests/Makefile in Mbed TLS creates
empty files `everest/Makefile.inc` and `p256-m/Makefile.inc` in the
libtestdriver1 tree, but does not know about `pqcp/Makefile.inc` which came
along later. Instead of requiring these files to exist, just don't try to
include them. Either way, libtestdriver1.a can't use any code from
third-party drivers.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
When we build libtestdriver1, the generated files are already present in the
original source tree, and we copy them to the libtestdriver1 tree. Thus we
don't need to generate them in the libtestdriver1 tree. Skip all the code
that tries to generate them, including file enumeration and dependencies.

The current version of `generate_config_checks.py` doesn't work in the
libtestdriver1 tree. This caused error messages when the makefile ran
`generate_config_checks.py --list`, but the build worked anyway because the
necessary targets were already present. So the practical consequence of this
commit is to suppress a confusing but effectively harmless error trace.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
@gilles-peskine-arm
Copy link
Contributor Author

gilles-peskine-arm commented Jan 14, 2026

@ronald-cron-arm I would appreciate a design review (no need to do a code review) on the file structure and CMake build. It's passing the CI (as of e663621, the remaining CI failures are not related to the build system) but I don't know if I've done things right.

One thing I wonder is if we should have three places for headers in a driver and not just two:

  • Public headers that need to be installed with the library (e.g. definitions of context structures). This obviously goes under include.
  • Headers needed for the core to call driver entry points. include or src?
  • Headers used inside the driver. This does into src.

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 added needs-review Every commit must be reviewed by at least two team members and removed needs-work labels Jan 16, 2026
Copy link
Contributor

@valeriosetti valeriosetti left a comment

Choose a reason for hiding this comment

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

A part from the very 2 minimal typos the rest look good to me!

I noticed that you updated the framework twice, which is fine of course because you are updating it in a progressive way, but in case of conflicts it might be pain to refresh. I don't mind if you want to just update the framework once as first commit.

* \warning This option is experimental. It may change or be removed without
* notice.
*
* Module: drivers/pqca/mldsa-native
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* Module: drivers/pqca/mldsa-native
* Module: drivers/pqcp/mldsa-native

*
* Requires: TF_PSA_CRYPTO_PQCP_MLDSA_ENABLED
*
* Module: drivers/pqca/mldsa-native
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* Module: drivers/pqca/mldsa-native
* Module: drivers/pqcp/mldsa-native

TEST_CALLOC(signature, signature_size);

/* Calculate the expanded key pair from the seed */
TEST_EQUAL(tf_psa_crypto_pqcp_mldsa87_keypair_internal(
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry for the dumb question, but I cannot find the definition of tf_psa_crypto_pqcp_mldsa87_keypair_internal. What am I missing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

pqcp-config.h defines #define MLD_CONFIG_NAMESPACE_PREFIX tf_psa_crypto_pqcp_mldsa. Heavy use of the preprocessor turns this into a name in a function declaration in mldsa-native/mldsa/mldsa_native.h and in a function definition in mldsa-native/mldsa/src/*.c. I'll add some comments to explain this.

A missing include directory is fine for our own build, but breaks the build
of consuming packages (in the CMake sense), as revealed by
`all.sh test_tf_psa_crypto_as_package`.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Explain more precisely how mldsa-native functions end up being called
`tf_psa_crypto_pqcp_mldsa87_xxx`.

In `pqcp-config.h`, fix an obsolete explanation of the macros that the
wrapping code needs to define.

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 added a commit to Mbed-TLS/mbedtls-test that referenced this pull request Jan 19, 2026
This reverts commit fb5e160.

The compilation failure has been fixed upstream
(pq-code-package/mldsa-native#884),
and we're picking up the fix in the initial integration
(Mbed-TLS/TF-PSA-Crypto#652), so we won't need
this temporary workaround for our development branch after all.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
@gilles-peskine-arm gilles-peskine-arm added needs-work and removed needs-review Every commit must be reviewed by at least two team members labels Jan 19, 2026
Create a pqcp include stub

The pqcp driver doesn't need a public include yet. But `drivers.cmake`
declares an include directory. When a CMake package includes TF-PSA-Crypto
as a sub-package, this include directory must exists, otherwise it breaks
the build, as revealed by `all.sh test_tf_psa_crypto_as_package`.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
@gilles-peskine-arm
Copy link
Contributor Author

Once the CI passes and the content is approved, I will do a little history rewriting:

  • Squash all the submodule update commits.
  • Squash the fixup commits. This will also fix DCO.
  • Rebase on top of the merge of the framework prerequisite.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
@gilles-peskine-arm gilles-peskine-arm removed the needs-preceding-pr Requires another PR to be merged first label Jan 22, 2026
There are still build scripts that can't find headers in the new pqcp
driver, notably libtestdriver1. For the time being, take advantage of the
fact that pqcp is not in the default config, so we don't need to update
these build scripts yet.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
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 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.

Fix mldsa-native integration on MSVC Integrate mldsa-native

2 participants