Support ML-DSA-87 key pairs in the PSA API #900

Open
opened 2026-09-07 12:16:24 -05:00 by gilles-peskine-arm · 0 comments
gilles-peskine-arm commented 2026-09-07 12:16:24 -05:00 (Migrated from github.com)

Prerequisite: https://github.com/Mbed-TLS/TF-PSA-Crypto/issues/899

Support the ML-DSA-87 key pair type to the PSA API:

  • Move the definition of PSA_KEY_TYPE_ML_DSA_KEY_PAIR to include/psa/crypto_values.h.
  • Declare PSA_WANT_KEY_TYPE_ML_DSA_KEY_PAIR_BASIC, PSA_WANT_KEY_TYPE_ML_DSA_KEY_PAIR_IMPORT and PSA_WANT_KEY_TYPE_ML_DSA_KEY_PAIR_EXPORT (no GENERATE or DERIVE yet — that will come in https://github.com/Mbed-TLS/TF-PSA-Crypto/issues/901) in include/psa/crypto_config.h, default off. They will automatically be enabled in the full config.
    • Use this macro to guard code that handles ML-DSA key pairs generically.
    • Additionally guard with PSA_WANT_KEY_TYPE_ML_DSA_87 any code that is about ML-DSA-87 specifically.
  • When the corresponding key type and size is enabled, take MLDSA into account in PSA_KEY_EXPORT_xxx_SIZE macros in include/psa/crypto_sizes.h. Move and rename auxiliary macros from drivers/pqcp/**.h where useful.
  • Support MLDSA key pairs in psa_import_key().
    • Key pairs are represented as just the seed for now.
    • Validate the key data length in the core.
  • Support MLDSA key pairs in psa_export_key().
  • Support MLDSA key pairs in psa_export_public_key(). This involves a call to driver dispatch.
  • Add exceptions to tests/scripts/analyze_outcomes.py for generated tests that depend on PSA_WANT_KEY_TYPE_ML_DSA_KEY_PAIR_GENERATE or PSA_WANT_KEY_TYPE_ML_DSA_KEY_PAIR_DERIVE, since those are not supported yet.

All functions and macros must have unit tests in test_suite_psa_crypto.mldsa.data (create a new data file because the test data is big and we're trying to split up test_suite_psa_crypto.data). This should require only new test data, not new test code. We want both positive and negative tests (bad key size, not supported, buffer too small, etc. as applicable). There is no need to duplicate tests that are automatically generated.

In comments, document that the support for ML-DSA is still incomplete. No changelog entry.

Next steps: https://github.com/Mbed-TLS/TF-PSA-Crypto/issues/901 and https://github.com/Mbed-TLS/TF-PSA-Crypto/issues/902, going towards https://github.com/Mbed-TLS/TF-PSA-Crypto/issues/637

Prerequisite: https://github.com/Mbed-TLS/TF-PSA-Crypto/issues/899 Support the ML-DSA-87 key pair type to the PSA API: * Move the definition of `PSA_KEY_TYPE_ML_DSA_KEY_PAIR` to `include/psa/crypto_values.h`. * Declare `PSA_WANT_KEY_TYPE_ML_DSA_KEY_PAIR_BASIC`, `PSA_WANT_KEY_TYPE_ML_DSA_KEY_PAIR_IMPORT` and `PSA_WANT_KEY_TYPE_ML_DSA_KEY_PAIR_EXPORT` (no `GENERATE` or `DERIVE` yet — that will come in https://github.com/Mbed-TLS/TF-PSA-Crypto/issues/901) in `include/psa/crypto_config.h`, default off. They will automatically be enabled in the `full` config. * Use this macro to guard code that handles ML-DSA key pairs generically. * Additionally guard with `PSA_WANT_KEY_TYPE_ML_DSA_87` any code that is about ML-DSA-87 specifically. * When the corresponding key type and size is enabled, take MLDSA into account in `PSA_KEY_EXPORT_xxx_SIZE` macros in `include/psa/crypto_sizes.h`. Move and rename auxiliary macros from `drivers/pqcp/**.h` where useful. * Support MLDSA key pairs in `psa_import_key()`. * Key pairs are represented as just the seed for now. * Validate the key data length in the core. * Support MLDSA key pairs in `psa_export_key()`. * Support MLDSA key pairs in `psa_export_public_key()`. This involves a call to driver dispatch. * Add exceptions to `tests/scripts/analyze_outcomes.py` for generated tests that depend on `PSA_WANT_KEY_TYPE_ML_DSA_KEY_PAIR_GENERATE` or ` PSA_WANT_KEY_TYPE_ML_DSA_KEY_PAIR_DERIVE`, since those are not supported yet. All functions and macros must have unit tests in `test_suite_psa_crypto.mldsa.data` (create a new data file because the test data is big and we're trying to split up `test_suite_psa_crypto.data`). This should require only new test data, not new test code. We want both positive and negative tests (bad key size, not supported, buffer too small, etc. as applicable). There is no need to duplicate tests that are automatically generated. In comments, document that the support for ML-DSA is still incomplete. No changelog entry. Next steps: https://github.com/Mbed-TLS/TF-PSA-Crypto/issues/901 and https://github.com/Mbed-TLS/TF-PSA-Crypto/issues/902, going towards https://github.com/Mbed-TLS/TF-PSA-Crypto/issues/637
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-Mbed-TLS/TF-PSA-Crypto#900
No description provided.