-
Notifications
You must be signed in to change notification settings - Fork 637
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[nrf noup] mbedtls: Separate psa_crypto_init in its own SYS_INIT
-This commit adds psa_init.c that contains a SYS_INIT to enforce early initialization of PSA crypto by calling psa_crypto_init() in PRE_KERNEL_1, before any other users (include entropy_psa_crypto). -This is separated from CONFIG_MBEDTLS_INIT which has a SYS_INIT that happens in POST_KERNEL and include initializing the Mbed TLS heap if this is enabled. -Removing unneeded doxygen @file entry for zephyr_init.c Signed-off-by: Frank Audun Kvamtrø <[email protected]> (Cherry-picked from commit ac42511fca09aa45e85600bc63e17b62f075c046)
- Loading branch information
Showing
3 changed files
with
27 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* Copyright (c) 2025 Nordic Semiconductor ASA | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
#include <errno.h> | ||
#include <zephyr/init.h> | ||
#include <psa/crypto.h> | ||
|
||
static int _psa_crypto_init(void) | ||
{ | ||
if (psa_crypto_init() != PSA_SUCCESS) { | ||
return -EIO; | ||
} | ||
|
||
return 0; | ||
} | ||
|
||
/* Enforcing initialization of PSA crypto before any other users | ||
* like entropy_psa_crypto (which has a higher priority number). | ||
* This is done without dependency on CONFIG_MBEDTLS_INIT. | ||
*/ | ||
SYS_INIT(_psa_crypto_init, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT); |
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