Skip to content

Commit

Permalink
nrf_security: Add SSF client without nrf_security
Browse files Browse the repository at this point in the history
Add configuration to allow enabling the SSF PSA client
when nrf_security is not enabled.
This is particularly useful for the applications that only
want to use the PSA rng and no other crypto. Enabling
nrf_security in these applications will result to an
increased application footprint and configuration complexity
without any reason.

The approach that I took here is to avoid doing the conversion
of Kconfig->Cmake->Header that we do in nrf_security.
First the PSA SSF client is not configurable at all so
adding configuration options doesn't give anything.

Signed-off-by: Georgios Vasilakis <[email protected]>
  • Loading branch information
Vge0rge committed Oct 1, 2024
1 parent 579a8f0 commit be24ea7
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
5 changes: 4 additions & 1 deletion subsys/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ if(NOT SYSBUILD)
endif()
endif()

add_subdirectory_ifdef(CONFIG_NRF_SECURITY nrf_security)
if(CONFIG_NRF_SECURITY OR CONFIG_PSA_SSF_CRYPTO_CLIENT)
add_subdirectory(nrf_security)
endif()

add_subdirectory_ifdef(CONFIG_TRUSTED_STORAGE trusted_storage)

add_subdirectory(net)
Expand Down
21 changes: 21 additions & 0 deletions subsys/nrf_security/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,29 @@ endif()

set(CONFIG_MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG True)

if(CONFIG_PSA_SSF_CRYPTO_CLIENT AND NOT CONFIG_NRF_SECURITY)
zephyr_compile_definitions(MBEDTLS_PSA_CRYPTO_CONFIG)
zephyr_compile_definitions(MBEDTLS_PSA_CRYPTO_CLIENT)
zephyr_compile_definitions(MBEDTLS_PSA_CRYPTO_CONFIG_FILE="ssf_crypto_config_empty.h")
zephyr_compile_definitions(MBEDTLS_CONFIG_FILE="ssf_crypto_config_empty.h")

zephyr_include_directories(
${NRF_SECURITY_ROOT}/include
# Oberon PSA headers
${ZEPHYR_OBERON_PSA_CRYPTO_MODULE_DIR}/include
${ZEPHYR_OBERON_PSA_CRYPTO_MODULE_DIR}/library
# Mbed TLS (mbedcrypto) PSA headers
${ARM_MBEDTLS_PATH}/include
${ARM_MBEDTLS_PATH}/library
)

zephyr_sources(${CMAKE_CURRENT_LIST_DIR}/src/ssf_secdom/ssf_crypto.c)

else()

# Finally adding the crypto lib
add_subdirectory(${NRFXLIB_DIR}/crypto crypto_copy)

# Add mbed TLS Libraries
add_subdirectory(src)
endif()
Empty file.

0 comments on commit be24ea7

Please sign in to comment.