-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This refactors the mutexes in nrf_security. The main issue with the current design is that that it doesn't use the Zephyr macro K_MUTEX_DEFINE to define the mutexes. If this macro is not used the Zephyr mutexes need to be initialized at runtime, but the Cracen code doesn't initalize them and so they don't work properly. This simplifies the nrf_security mutexes by removing the flag. This keep the design simpler and less error prone. An extra flag added to the Zephyr mutexes doesn't seem to be necessary. The nrf_security mutexes were added in order to be used by the Cracen driver and reduce the ifdef conditions inside the driver code for tfm/non tfm builds. No initialization is required for these mutexes because there are always meant to be statically defined and this removes the need for initialization as long as we use the Zephyr macros for this. The mbedtls prefixed mutexes used by the PSA core are now changed to direcly use the zephyr mutexes. This makes the design simpler again, since we remove the connection with the nrf_security mutexes. The mbedlts prefixed mutexes are always under ifdef conditions inside the PSA core. So using the mechanism of the nrf_security mutexes doesn't improve anything. Since both the nrf_security mutexes and the mbedtls prefixed mutexes indide PSA core are basically just a front end which use the Zephyr mutexes its better to keep them separated. Signed-off-by: Georgios Vasilakis <georgios.vasilakis@nordicsemi.no>
- Loading branch information
Showing
11 changed files
with
69 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
/* | ||
* Copyright (c) 2023, Arm Limited and Contributors. All rights reserved. | ||
* Copyright (c) 2024 Nordic Semiconductor ASA | ||
* | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause | ||
*/ | ||
|
||
#ifndef MBEDTLS_THREADING_ALT_H | ||
#define MBEDTLS_THREADING_ALT_H | ||
|
||
#include "mbedtls/build_info.h" | ||
#include "nrf_security_mutexes.h" | ||
#include <zephyr/kernel.h> | ||
|
||
typedef struct k_mutex mbedtls_threading_mutex_t; | ||
|
||
#endif /* MBEDTLS_THREADING_ALT_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.