From 88da0e66c95027246ac1b22bfb800c4131bcd68f Mon Sep 17 00:00:00 2001 From: Aksel Skauge Mellbye Date: Tue, 28 Oct 2025 11:26:56 +0100 Subject: [PATCH] soc: silabs: Add hardware accelerated crypto for VSE devices Add hardware acceleration for PSA Crypto APIs for devices with VSE, i.e. xG22 and xG27. Signed-off-by: Aksel Skauge Mellbye --- .../hal_silabs/simplicity_sdk/CMakeLists.txt | 39 ++++++++++++++++++- soc/silabs/silabs_s2/Kconfig | 4 +- west.yml | 4 ++ 3 files changed, 45 insertions(+), 2 deletions(-) diff --git a/modules/hal_silabs/simplicity_sdk/CMakeLists.txt b/modules/hal_silabs/simplicity_sdk/CMakeLists.txt index ec8beed..cd77b62 100644 --- a/modules/hal_silabs/simplicity_sdk/CMakeLists.txt +++ b/modules/hal_silabs/simplicity_sdk/CMakeLists.txt @@ -2,6 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 set(SECURITY_DIR ${ZEPHYR_HAL_SILABS_MODULE_DIR}/simplicity_sdk/platform/security) +set(LIBCRYPTOSOC_DIR ${ZEPHYR_HAL_SILABS_EXTRA_MODULE_DIR}/simplicity_sdk/util/third_party/crypto_ip/libcryptosoc) set(MBEDTLS_DIR ${ZEPHYR_MBEDTLS_MODULE_DIR}) # Get SoC series number, i.e. translate efr32bg22 -> 22, mgm240p -> 24, simg301 -> 301 @@ -84,6 +85,42 @@ zephyr_library_sources_ifdef(CONFIG_PSA_CRYPTO_DRIVER_SILABS_HSE ) # VSE -# TODO +zephyr_include_directories_ifdef(CONFIG_PSA_CRYPTO_DRIVER_SILABS_VSE + ${LIBCRYPTOSOC_DIR}/include + ${LIBCRYPTOSOC_DIR}/src +) +zephyr_library_sources_ifdef(CONFIG_PSA_CRYPTO_DRIVER_SILABS_VSE + ${SECURITY_DIR}/sl_component/sl_psa_driver/src/cryptoacc_management.c + ${SECURITY_DIR}/sl_component/sl_psa_driver/src/sli_cryptoacc_driver_key_derivation.c + ${SECURITY_DIR}/sl_component/sl_psa_driver/src/sli_cryptoacc_driver_trng.c + ${SECURITY_DIR}/sl_component/sl_psa_driver/src/sli_cryptoacc_opaque_driver_builtin_keys.c + ${SECURITY_DIR}/sl_component/sl_psa_driver/src/sli_cryptoacc_opaque_driver_mac.c + ${SECURITY_DIR}/sl_component/sl_psa_driver/src/sli_cryptoacc_transparent_driver_aead.c + ${SECURITY_DIR}/sl_component/sl_psa_driver/src/sli_cryptoacc_transparent_driver_cipher.c + ${SECURITY_DIR}/sl_component/sl_psa_driver/src/sli_cryptoacc_transparent_driver_hash.c + ${SECURITY_DIR}/sl_component/sl_psa_driver/src/sli_cryptoacc_transparent_driver_key_derivation.c + ${SECURITY_DIR}/sl_component/sl_psa_driver/src/sli_cryptoacc_transparent_driver_key_management.c + ${SECURITY_DIR}/sl_component/sl_psa_driver/src/sli_cryptoacc_transparent_driver_mac.c + ${SECURITY_DIR}/sl_component/sl_psa_driver/src/sli_cryptoacc_transparent_driver_signature.c + + ${LIBCRYPTOSOC_DIR}/src/ba414ep_config.c + ${LIBCRYPTOSOC_DIR}/src/ba431_config.c + ${LIBCRYPTOSOC_DIR}/src/cryptodma_internal.c + ${LIBCRYPTOSOC_DIR}/src/cryptolib_types.c + ${LIBCRYPTOSOC_DIR}/src/sx_aes.c + ${LIBCRYPTOSOC_DIR}/src/sx_blk_cipher.c + ${LIBCRYPTOSOC_DIR}/src/sx_blk_cipher.h + ${LIBCRYPTOSOC_DIR}/src/sx_dh_alg.c + ${LIBCRYPTOSOC_DIR}/src/sx_ecc_curves.c + ${LIBCRYPTOSOC_DIR}/src/sx_ecc_keygen_alg.c + ${LIBCRYPTOSOC_DIR}/src/sx_ecdsa_alg.c + ${LIBCRYPTOSOC_DIR}/src/sx_hash.c + ${LIBCRYPTOSOC_DIR}/src/sx_math.c + ${LIBCRYPTOSOC_DIR}/src/sx_memcmp.c + ${LIBCRYPTOSOC_DIR}/src/sx_memcpy.c + ${LIBCRYPTOSOC_DIR}/src/sx_primitives.c + ${LIBCRYPTOSOC_DIR}/src/sx_rng.c + ${LIBCRYPTOSOC_DIR}/src/sx_trng.c +) endif() # PSA Crypto diff --git a/soc/silabs/silabs_s2/Kconfig b/soc/silabs/silabs_s2/Kconfig index 5d3c5d4..b928596 100644 --- a/soc/silabs/silabs_s2/Kconfig +++ b/soc/silabs/silabs_s2/Kconfig @@ -10,12 +10,14 @@ config PSA_CRYPTO_SW_ONLY config PSA_CRYPTO_DRIVER_SILABS_HSE bool "PSA Crypto Driver for Secure Engine" depends on $(dt_has_compat,$(DT_COMPAT_SILABS_GECKO_SEMAILBOX)) + select SILABS_SISDK_SE default y if !PSA_CRYPTO_SW_ONLY config PSA_CRYPTO_DRIVER_SILABS_VSE bool "PSA Crypto Driver for Virtual Secure Engine" depends on $(dt_has_compat,$(DT_COMPAT_SILABS_GECKO_TRNG)) - # default y if !PSA_CRYPTO_SW_ONLY + select SILABS_SISDK_SE + default y if !PSA_CRYPTO_SW_ONLY config MBEDTLS_USER_CONFIG_ENABLE default y if (PSA_CRYPTO_DRIVER_SILABS_HSE || PSA_CRYPTO_DRIVER_SILABS_VSE) diff --git a/west.yml b/west.yml index aabd22f..4543363 100644 --- a/west.yml +++ b/west.yml @@ -42,6 +42,10 @@ manifest: - picolibc - segger - zcbor + - name: zephyr-hal-silabs-extra + remote: silabs + revision: 04ea2a26baf2d0a768ce5c8970a754bbdd71e9b1 + path: modules/hal/silabs_extra - name: zephyr-mbedtls remote: silabs revision: 43bb1e577e2accfaa135464bac181ed2a0cc0489