Skip to content

Conversation

@multiplemonomials
Copy link
Collaborator

Summary of changes

I can't build Mbed for targets using PSA with the latest GCC, because they appear to have upgraded a pointer-related warning into an error. It seems that there are several places in the code that pass a pointer to a psa_key_id_t (equivalent to uint32_t) to places expecting a psa_key_handle_t * (equivalent to uint16_t *), and the compiler will no longer compile this code. Honestly I don't know the deeper meaning behind these two different types, but I believe it was working because there was still enough room in the type it was passing to store the handle. So, I changed all the erroring locations to use the psa_key_handle_t type. This should not affect the behavior of the code, but fixes the compiler error.

Note that I did check upstream in the latest version of Mbed TLS 3 (which we really need to upgrade to at some point) and this error seems to appear there too, but not 100% sure due to them moving a lot of files around in the latest release. So we may have to file a bug upstream when we finally upgrade Mbed TLS.

I was able to find one reference to this issue in the Mbed TLS changelog: https://github.com/Mbed-TLS/mbedtls/blob/216c1950f33cc81677ae4e915a94d7fe4fcc689c/ChangeLog#L2335

Looks like this might be a holdover from supporting an older version of PSA, and they consider these two types to be equivalent, even though they actually aren't.

Impact of changes

Migration actions required

Documentation


Pull request type

[X] Patch update (Bug fix / Target update / Docs update / Test update / Refactor)
[] Feature update (New feature / Functionality change / New API)
[] Major update (Breaking change E.g. Return code change / API behaviour change)

Test results

[] No Tests required for this change (E.g docs only update)
[] Covered by existing mbed-os tests (Greentea or Unittest)
[] Tests / results supplied as part of this PR

@multiplemonomials multiplemonomials merged commit 360de14 into master Dec 19, 2025
50 checks passed
@multiplemonomials multiplemonomials deleted the bugfix/fix-psa-build-on-latest-gcc branch December 19, 2025 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants