Approved catalog listing
SKILL #3934
skillshunter.net
Home / Software & Development / MbedTLS v4.1.0 / TF-PSA-Crypto Integration and Test Porting
Listing Approved Approved on: November 30, 2026

MbedTLS v4.1.0 / TF-PSA-Crypto Integration and Test Porting

Port RA4C1 PSA Crypto tests from mbedTLS v3.6.6 to mbedTLS 4.1.0 + TF-PSA-Crypto 1.1.x. Includes API migration, test porting, and environment setup for Linux (zsh) with Python 3.

Rate this skill

No ratings yet

Editor's Note

Ensure the Linux shell is zsh and use `bash -c` for multi-flag commands. Verify the RA4C1 board's data flash and memory limits in `bsp_cfg_ra4c1.h` before running tests.

When to Use It

  • Porting PSA Crypto tests from mbedTLS v3.6.6 to mbedTLS v4.1.0
  • Setting up a Linux (zsh) environment for TF-PSA-Crypto test porting
  • Migrating API types such as `psa_key_handle_t` to `psa_key_id_t`
  • Updating test runners and helper functions for PSA Crypto tests

SKILL.md

SkillsHunter provides this listing for informational purposes only. Review the skill’s source, license, and required permissions before use. You are responsible for deciding whether to install or run it. Terms of Use

↓ Download .md

FSPRA-5629 quick start

Status: compacted 2026-11-01. Session logs and completed-work lists were removed. Detail is in the companion skills below.

Scope

  • Branch: FSPRA-5629_MbedTLS_v4.1.0_TRNG_Sync.
  • Goal: port RA4C1 PSA Crypto tests from mbedTLS v3.6.6 (rm_psa_crypto) to mbedTLS 4.1.0 + TF-PSA-Crypto 1.1.x (rm_tf_psa_crypto).
  • Done: API migration for TG1 to TG4 (TG5 in progress). Test porting for TG1 (SHA) and TG2 (GCM).
  • Resolved: ECC persistent-key bus fault (TC_API_ECCGenerateKeyPairSignVerify256R1Persistent) is handled by ignoring the test on E31A boards. Root cause still open (see the littlefs notes).

Environment

  • Shell is Linux (zsh). Use python3.
  • Under zsh, $VAR does not word-split. Run multi-flag commands through bash -c.

Companion skills (invoke by name or read the file)

  1. mbedtls-v4-migration-notes/SKILL.md: API diffs, config changes, debugging recipes.
  2. mbedtls-v4-migration-notes/psa-storage-littlefs-stack.md: persistent key storage and littlefs.
  3. mbedtls-v4-migration-notes/ecc-busfault-littlefs-investigation.md: ECC bus fault.
  4. mbedtls-v4-migration-notes/changelog-3.6.6-to-4.1.0.md: v3 to v4 changelog digest.
  5. test-case-porting-guide/SKILL.md: porting checklist and common mistakes.
  6. cch-psa-driver-scaffold/SKILL.md: PSA driver architecture.

Test porting checklist

  • Copy the whole test, not just the TEST() macro. Copy its helper functions (for example cipher_example_*).
  • Update psa_crypto_tests_runner.c (RUN_TEST_CASE).
  • Migrate API types (psa_key_handle_t to psa_key_id_t).
  • Find helpers and tests: grep -n "^psa_status_t" file.c and grep -n "^TEST(" file.c.

Migration rules

  • PSA_KEY_LIFETIME_IS_PERSISTENT(l) becomes !PSA_KEY_LIFETIME_IS_VOLATILE(l). About 26 occurrences were converted.
  • psa_key_handle_t becomes psa_key_id_t.
  • mbedtls_pk_parse_key drops the RNG args (7 args become 5).
  • psa_open_key and psa_close_key are removed. Use the key ID directly.

Key files

  • Tests: ra/fsp/src/rm_tf_psa_crypto/!test/ (psa_crypto_tests_tg1.c to tg11.c, psa_crypto_tests_runner.c, psa_crypto_tests_setup.c).
  • Config: projects/rm_tf_psa_crypto.xml (macros and include dirs), test_files/ra_cfg/fsp_cfg/rm_tf_psa_crypto_cfg.h, test_files/ra_cfg/fsp_cfg/bsp/bsp_cfg_ra4c1.h.
  • v3 reference: ra/fsp/src/rm_psa_crypto/!test/ (v3 has more GCM multipart coverage).

Facts

  • Dynamic key storage (MBEDTLS_PSA_KEY_STORE_DYNAMIC) allocates a 108-byte persistent-key cache and a 640-byte volatile slice. Both are freed only by mbedtls_psa_crypto_free(). The leak check matches by size (calloc_size_array).
  • RA4C1 limits: data flash 8 KB (tight). The test config uses main stack and heap of 32 KB each. Verify these values against bsp_cfg_ra4c1.h.
  • littlefs inline_max decides when storage first allocates a block. A larger key blob crosses it.
View original Markdown
---
name: mbedtlsv4-tf-psa-crypto-integrated
description: Quick start for the FSPRA-5629 mbedTLS v4.1.0 / TF-PSA-Crypto integration and PSA crypto test porting. Read first when working on rm_tf_psa_crypto tests or the v3 to v4 port.
metadata:
  type: reference
  branch: FSPRA-5629_MbedTLS_v4.1.0_TRNG_Sync
  compacted: 2026-11-01
---

# FSPRA-5629 quick start

Status: compacted 2026-11-01. Session logs and completed-work lists were removed. Detail is in the companion skills below.

## Scope
- Branch: `FSPRA-5629_MbedTLS_v4.1.0_TRNG_Sync`.
- Goal: port RA4C1 PSA Crypto tests from mbedTLS v3.6.6 (`rm_psa_crypto`) to mbedTLS 4.1.0 + TF-PSA-Crypto 1.1.x (`rm_tf_psa_crypto`).
- Done: API migration for TG1 to TG4 (TG5 in progress). Test porting for TG1 (SHA) and TG2 (GCM).
- Resolved: ECC persistent-key bus fault (`TC_API_ECCGenerateKeyPairSignVerify256R1Persistent`) is handled by ignoring the test on E31A boards. Root cause still open (see the littlefs notes).

## Environment
- Shell is Linux (zsh). Use `python3`.
- Under zsh, `$VAR` does not word-split. Run multi-flag commands through `bash -c`.

## Companion skills (invoke by name or read the file)
1. `mbedtls-v4-migration-notes/SKILL.md`: API diffs, config changes, debugging recipes.
2. `mbedtls-v4-migration-notes/psa-storage-littlefs-stack.md`: persistent key storage and littlefs.
3. `mbedtls-v4-migration-notes/ecc-busfault-littlefs-investigation.md`: ECC bus fault.
4. `mbedtls-v4-migration-notes/changelog-3.6.6-to-4.1.0.md`: v3 to v4 changelog digest.
5. `test-case-porting-guide/SKILL.md`: porting checklist and common mistakes.
6. `cch-psa-driver-scaffold/SKILL.md`: PSA driver architecture.

## Test porting checklist
- Copy the whole test, not just the `TEST()` macro. Copy its helper functions (for example `cipher_example_*`).
- Update `psa_crypto_tests_runner.c` (`RUN_TEST_CASE`).
- Migrate API types (`psa_key_handle_t` to `psa_key_id_t`).
- Find helpers and tests: `grep -n "^psa_status_t" file.c` and `grep -n "^TEST(" file.c`.

## Migration rules
- `PSA_KEY_LIFETIME_IS_PERSISTENT(l)` becomes `!PSA_KEY_LIFETIME_IS_VOLATILE(l)`. About 26 occurrences were converted.
- `psa_key_handle_t` becomes `psa_key_id_t`.
- `mbedtls_pk_parse_key` drops the RNG args (7 args become 5).
- `psa_open_key` and `psa_close_key` are removed. Use the key ID directly.

## Key files
- Tests: `ra/fsp/src/rm_tf_psa_crypto/!test/` (`psa_crypto_tests_tg1.c` to `tg11.c`, `psa_crypto_tests_runner.c`, `psa_crypto_tests_setup.c`).
- Config: `projects/rm_tf_psa_crypto.xml` (macros and include dirs), `test_files/ra_cfg/fsp_cfg/rm_tf_psa_crypto_cfg.h`, `test_files/ra_cfg/fsp_cfg/bsp/bsp_cfg_ra4c1.h`.
- v3 reference: `ra/fsp/src/rm_psa_crypto/!test/` (v3 has more GCM multipart coverage).

## Facts
- Dynamic key storage (`MBEDTLS_PSA_KEY_STORE_DYNAMIC`) allocates a 108-byte persistent-key cache and a 640-byte volatile slice. Both are freed only by `mbedtls_psa_crypto_free()`. The leak check matches by size (`calloc_size_array`).
- RA4C1 limits: data flash 8 KB (tight). The test config uses main stack and heap of 32 KB each. Verify these values against `bsp_cfg_ra4c1.h`.
- littlefs `inline_max` decides when storage first allocates a block. A larger key blob crosses it.

Community Reviews & Field Notes

Tried this skill on your own project? Share the model you used and the results you got.

Add Your Review

Approved reviews appear publicly with the name or role you enter. See the Privacy Notice.