Enhance the PSA driver test jinja templates for hashing, AES, signature and key agreement functions #880

Open
oubaid-a wants to merge 4 commits from oubaid-a/dev_psa_driver_wrapper into development
oubaid-a commented 2026-08-26 09:28:23 -05:00 (Migrated from github.com)

Description

Enhance the jinja templates for the transparent driver using the MbedTLS transparent driver test:

  • Enhance OS-template-transparent.jinja to:

    • Support fallback behavior when the driver do not fully support a cryptographic mechanism
    • Handle driver ID and and operation context for multipart operations
  • Update psa_crypto_driver_wrappers.h.jinja to provide entry point for:

    • HASH operations including multi-part operations
    • AES cipher and AEAD encryption and decryption operations
    • Hash and message signature generation and verification operations
    • Key agreement operation.
  • Rename the test_driver_ctx to in crypto_driver_contexts_primitives.h to align with the transparent driver templates:

    • mbedtls_test_driver_ctx : driver.prefix + _driver_ctx

PR checklist

  • changelog not required
  • framework PR not required
  • TF-PSA-Crypto development PR provided here
  • TF-PSA-Crypto 1.1 PR provided https://github.com/Mbed-TLS/TF-PSA-Crypto/pull/880
  • mbedtls development PR not required because: crypto only
  • mbedtls 4.1 PR not required because: crypto only
  • mbedtls 3.6 PR not required
  • tests not required because: No regression, generated files are the same
## Description Enhance the jinja templates for the transparent driver using the MbedTLS transparent driver test: * Enhance OS-template-transparent.jinja to: * Support fallback behavior when the driver do not fully support a cryptographic mechanism * Handle driver ID and and operation context for multipart operations * Update psa_crypto_driver_wrappers.h.jinja to provide entry point for: * HASH operations including multi-part operations * AES cipher and AEAD encryption and decryption operations * Hash and message signature generation and verification operations * Key agreement operation. * Rename the test_driver_ctx to in crypto_driver_contexts_primitives.h to align with the transparent driver templates: * mbedtls_test_driver_ctx : driver.prefix + _driver_ctx ## PR checklist - [x] **changelog** not required - [x] **framework PR** not required - [x] **TF-PSA-Crypto development PR** provided here - [x] **TF-PSA-Crypto 1.1 PR** provided https://github.com/Mbed-TLS/TF-PSA-Crypto/pull/880 - [x] **mbedtls development PR** not required because: crypto only - [x] **mbedtls 4.1 PR** not required because: crypto only - [x] **mbedtls 3.6 PR** not required - **tests** not required because: No regression, generated files are the same
gilles-peskine-arm commented 2026-08-26 09:48:18 -05:00 (Migrated from github.com)

Thank you very much for the contribution!

Note that to allow us to take your code, you need to accept the developer certificate of origin in dco.txt by signing off your commits (git rebase --signoff …).

Also, note that we want to get rid of the Jinja dependency. We're planning to rewrite the Python script to not use a text template, and instead use the psa_wrapper.py module which is a flexible generator of C code that wraps around/inside PSA API functions. This has been a long-term wish that we didn't have time for, but we have just found out that we might have time for that next quarter, although it isn't certain yet. But it means that effort on the Jinja template and code might not be very efficient.

Thank you very much for the contribution! Note that to allow us to take your code, you need to accept the developer certificate of origin in `dco.txt` by signing off your commits (`git rebase --signoff …`). Also, note that we want to get rid of the Jinja dependency. We're planning to rewrite the Python script to not use a text template, and instead use the `psa_wrapper.py` module which is a flexible generator of C code that wraps around/inside PSA API functions. This has been a long-term wish that we didn't have time for, but we have just found out that we might have time for that next quarter, although it isn't certain yet. But it means that effort on the Jinja template and code might not be very efficient.
This pull request is broken due to missing fork information.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'oubaid-a/dev_psa_driver_wrapper:oubaid-a/dev_psa_driver_wrapper'
git switch 'oubaid-a/dev_psa_driver_wrapper'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'development'
git merge --no-ff 'oubaid-a/dev_psa_driver_wrapper'
git switch 'oubaid-a/dev_psa_driver_wrapper'
git rebase 'development'
git switch 'development'
git merge --ff-only 'oubaid-a/dev_psa_driver_wrapper'
git switch 'oubaid-a/dev_psa_driver_wrapper'
git rebase 'development'
git switch 'development'
git merge --no-ff 'oubaid-a/dev_psa_driver_wrapper'
git switch 'development'
git merge --squash 'oubaid-a/dev_psa_driver_wrapper'
git switch 'development'
git merge --ff-only 'oubaid-a/dev_psa_driver_wrapper'
git switch 'development'
git merge 'oubaid-a/dev_psa_driver_wrapper'
git push origin 'development'
Sign in to join this conversation.
No reviewers
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!880
No description provided.