Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crypto: Moving threading_alt.h to the CC3XX platform #1627

Merged
merged 1 commit into from
Jan 14, 2025

Conversation

Vge0rge
Copy link
Contributor

@Vge0rge Vge0rge commented Jan 6, 2025

The CC3XX platform contains the functions for mbedtls mutex handling:

  • mbedtls_mutex_init
  • mbedtls_mutex_free
  • mbedtls_mutex_lock
  • mbedtls_mutex_unlock

These functions are not only used by the legacy mbedTLS APIs. They are also used by the PSA APIs for the PSA core mutexes:

  • mbedtls_threading_key_slot_mutex
  • mbedtls_threading_psa_globaldata_mutex
  • mbedtls_threading_psa_rngdata_mutex

This means that even when the CC3XX legacy/PSA driver is not used, as long as the CC3XX platform is enabled the mutex handling will be provided by the CC3XX platform library. Since the CC3XX platform library provides the implementation and the threading_alt.h provides the definitions for the mutexes it makes sense to be in one place.

This commit moves the threading_alt.h to the platform folder so that it can be included by applications which don't use the CC3XX mbedcrypto driver but they use Oberon PSA driver.

Ref: NCSDK-31155

The CC3XX platform contains the functions for mbedtls mutex
handling:
- mbedtls_mutex_init
- mbedtls_mutex_free
- mbedtls_mutex_lock
- mbedtls_mutex_unlock

These functions are not only used by the legacy mbedTLS APIs.
They are also used by the PSA APIs for the PSA core mutexes:
- mbedtls_threading_key_slot_mutex
- mbedtls_threading_psa_globaldata_mutex
- mbedtls_threading_psa_rngdata_mutex

This means that even when the CC3XX legacy/PSA driver is not
used, as long as the CC3XX platform is enabled the mutex
handling will be provided by the CC3XX platform library.
Since the CC3XX platform library provides the implementation
and the threading_alt.h provides the definitions for the mutexes
it makes sense to be in one place.

This commit moves the threading_alt.h to the platform folder
so that it can be included by applications which don't use
the CC3XX mbedcrypto driver but they use Oberon PSA driver.

Ref: NCSDK-31155

Signed-off-by: Georgios Vasilakis <[email protected]>
Copy link
Contributor

@frkv frkv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

This is one of the few files in Mbed TLS that don't require scoping (mbedtls/ psa/) so the movement shouldn't be any problem

@nordicjm nordicjm merged commit de671be into nrfconnect:main Jan 14, 2025
5 checks passed
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.

5 participants