Skip to content

Commit 156b156

Browse files
SebastianBoenordicjm
authored andcommitted
nrf_security: Have psa_crypto_init.c be configurable
Allow users to disable the Zephyr SYS_INIT that invokes psa_crypto_init. See kconfig help text for details. Signed-off-by: Sebastian Bøe <[email protected]>
1 parent c15fa31 commit 156b156

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

subsys/nrf_security/Kconfig.psa

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,19 @@ config PSA_ITS_ENCRYPTED
104104
help
105105
Enables authenticated encryption for PSA Internal Trusted Storage files
106106

107+
config PSA_CRYPTO_SYS_INIT
108+
bool "Invoke psa_crypto_init during system initialization"
109+
default y
110+
help
111+
Enable a Zephyr SYS_INIT that invokes psa_crypto_init. This
112+
allows PSA Crypto API users that run after POST_KERNEL to omit
113+
their psa_crypto_init calls.
114+
115+
This option can be disabled to allow finer grained control of
116+
how an error from psa_crypto_init should be handled. The
117+
SYS_INIT will invoke k_oops() when psa_crypto_init fails, which
118+
may not be desired behaviour.
119+
107120
config PSA_CRYPTO_DRIVER_ALG_PRNG_TEST
108121
bool
109122
help

subsys/nrf_security/src/zephyr/CMakeLists.txt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,12 @@ if(CONFIG_MBEDTLS_ENTROPY_POLL)
3434
)
3535
endif()
3636

37-
# Include a late initialization of psa_crypto_init just-in-case
38-
list(APPEND src_zephyr
39-
psa_crypto_init.c
40-
)
37+
if(CONFIG_PSA_CRYPTO_SYS_INIT)
38+
# Include a late initialization of psa_crypto_init just-in-case
39+
list(APPEND src_zephyr
40+
psa_crypto_init.c
41+
)
42+
endif()
4143

4244
if(CONFIG_BUILD_WITH_TFM)
4345
# For some reason $<TARGET_PROPERTY:tfm,TFM_BINARY_DIR> does not work here

0 commit comments

Comments
 (0)