Skip to content

sim: init mbedtls allocator for KW#2616

Open
ledvinap wants to merge 1 commit intomcu-tools:mainfrom
ledvinap:sim-kw-alloc
Open

sim: init mbedtls allocator for KW#2616
ledvinap wants to merge 1 commit intomcu-tools:mainfrom
ledvinap:sim-kw-alloc

Conversation

@ledvinap
Copy link
Contributor

  • The KW unwrap path (bootloader / bootutil_aes_kw_unwrap) uses mbedtls and assumes allocators are already initialized.
  • Internal sim images call the KW wrap helper (kw_encrypt_) before the bootloader runs.
  • That helper calls mbedtls_platform_set_calloc_free(calloc, free), so the allocator is initialized.

Skipping the wrap step makes bootutil_aes_kw_unwrap fail.

- The KW unwrap path (bootloader / bootutil_aes_kw_unwrap) uses mbedtls and assumes allocators
  are already initialized.
- Internal sim images call the KW wrap helper (kw_encrypt_) before the bootloader runs.
- That helper calls mbedtls_platform_set_calloc_free(calloc, free), so the allocator is initialized.

Skipping the wrap step makes bootutil_aes_kw_unwrap fail.
@ledvinap ledvinap requested a review from d3zd3z as a code owner January 29, 2026 23:13
@ledvinap
Copy link
Contributor Author

Here is code that triggered this bug:
main...ledvinap:mcuboot:sim-imgtool-kw

@de-nordic de-nordic added the area: sim Affects the simulator label Feb 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: sim Affects the simulator

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants