Export TF-PSA-Crypto knowledge to Mbed TLS #764

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

Create a directory where TF-PSA-Crypto can put Python code that can be used by both TF-PSA-Crypto and Mbed TLS. This directory is intended for project knowledge, i.e. data that describes TF-PSA-Crypto in a form that Mbed TLS can consume.

Code in this directory may call standard Python functions (e.g. set/list/dict functions, re functions, …) but should generally not do I/O or import mbedtls_framework modules. This way the code is flexible with respect to how it's consumed.

We do not put tf-psa-crypto/scripts or tf-psa-crypto/tests/scripts on the Python import path in Mbed TLS because file names in these directories are likely to clash with file names in the corresponding directories of Mbed TLS, and this could cause confusion as to which module gets loaded.

To avoid any confusion between Mbed TLS knowledge modules and TF-PSA-Crypto knowledge modules when they're accessed from Mbed TLS, modules in the TF-PSA-Crypto project knowledge directory should have a name that start with tf_psa_crypto_.

In TF-PSA-Crypto:

  • Create a directory scripts/project_knowledge containing __init__.py with just a comment explaining the directory's purpose.
  • Move tests/scripts/tf_psa_crypto_test_case_info.py to scripts/project_knowledge/tf_psa_crypto_test_case_info.py.
  • Re-create tests/scripts/tf_psa_crypto_test_case_info.py containing a temporary stub that re-exports project_knowledge.tf_psa_crypto_test_case_info.INTERNAL_TEST_CASES.

Spec: https://github.com/Mbed-TLS/mbedtls-docs/pull/201

Related: https://github.com/Mbed-TLS/mbedtls/issues/10698

Follow-up:

Create a directory where TF-PSA-Crypto can put Python code that can be used by both TF-PSA-Crypto and Mbed TLS. This directory is intended for _project knowledge_, i.e. data that describes TF-PSA-Crypto in a form that Mbed TLS can consume. Code in this directory may call standard Python functions (e.g. set/list/dict functions, `re` functions, …) but should generally not do I/O or import `mbedtls_framework` modules. This way the code is flexible with respect to how it's consumed. We do not put `tf-psa-crypto/scripts` or `tf-psa-crypto/tests/scripts` on the Python import path in Mbed TLS because file names in these directories are likely to clash with file names in the corresponding directories of Mbed TLS, and this could cause confusion as to which module gets loaded. To avoid any confusion between Mbed TLS knowledge modules and TF-PSA-Crypto knowledge modules when they're accessed from Mbed TLS, modules in the TF-PSA-Crypto project knowledge directory should have a name that start with `tf_psa_crypto_`. In TF-PSA-Crypto: * Create a directory `scripts/project_knowledge` containing `__init__.py` with just a comment explaining the directory's purpose. * Move `tests/scripts/tf_psa_crypto_test_case_info.py` to `scripts/project_knowledge/tf_psa_crypto_test_case_info.py`. * Re-create `tests/scripts/tf_psa_crypto_test_case_info.py` containing a temporary stub that re-exports `project_knowledge.tf_psa_crypto_test_case_info.INTERNAL_TEST_CASES`. Spec: https://github.com/Mbed-TLS/mbedtls-docs/pull/201 Related: https://github.com/Mbed-TLS/mbedtls/issues/10698 Follow-up: * Final cleanup: https://github.com/Mbed-TLS/TF-PSA-Crypto/issues/765, https://github.com/Mbed-TLS/mbedtls/issues/10699
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#764
No description provided.