samples: psa_crypto: fix setting of TF-M's CRYPTO_ENGINE_BUF_SIZE
It used to be set as a CMake variable, but TF-M's build system does not look at such a variable. Instead, define an additional configuration header file that defines CRYPTO_ENGINE_BUF_SIZE, and pass it to TF-M's build system. Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
This commit is contained in:
parent
1eaa14090c
commit
6eccdb965a
6 changed files with 16 additions and 6 deletions
|
@ -19,11 +19,9 @@ target_include_directories(app PRIVATE
|
||||||
$<TARGET_PROPERTY:tfm,TFM_BINARY_DIR>/api_ns/interface/include
|
$<TARGET_PROPERTY:tfm,TFM_BINARY_DIR>/api_ns/interface/include
|
||||||
)
|
)
|
||||||
|
|
||||||
# In TF-M, default value of CRYPTO_ENGINE_BUF_SIZE is 0x2080. It causes
|
|
||||||
# insufficient memory failure while verifying signature. Increase it to 0x2400.
|
|
||||||
set_property(TARGET zephyr_property_target
|
set_property(TARGET zephyr_property_target
|
||||||
APPEND PROPERTY TFM_CMAKE_OPTIONS
|
APPEND PROPERTY TFM_CMAKE_OPTIONS
|
||||||
-DCRYPTO_ENGINE_BUF_SIZE=0x2400
|
-DPROJECT_CONFIG_HEADER_FILE=${CMAKE_CURRENT_SOURCE_DIR}/src/configs/config_tfm.h
|
||||||
)
|
)
|
||||||
|
|
||||||
zephyr_include_directories(${APPLICATION_SOURCE_DIR}/src/tls_config)
|
zephyr_include_directories(${APPLICATION_SOURCE_DIR}/src/configs)
|
||||||
|
|
|
@ -26,7 +26,7 @@ CONFIG_MBEDTLS_BUILTIN=y
|
||||||
CONFIG_MBEDTLS_ENABLE_HEAP=y
|
CONFIG_MBEDTLS_ENABLE_HEAP=y
|
||||||
CONFIG_MBEDTLS_HEAP_SIZE=32768
|
CONFIG_MBEDTLS_HEAP_SIZE=32768
|
||||||
CONFIG_MBEDTLS_USER_CONFIG_ENABLE=y
|
CONFIG_MBEDTLS_USER_CONFIG_ENABLE=y
|
||||||
CONFIG_MBEDTLS_USER_CONFIG_FILE="user-tls-conf.h"
|
CONFIG_MBEDTLS_USER_CONFIG_FILE="config_mbedtls.h"
|
||||||
|
|
||||||
CONFIG_MBEDTLS_PSA_CRYPTO_C=y
|
CONFIG_MBEDTLS_PSA_CRYPTO_C=y
|
||||||
CONFIG_MBEDTLS_ENTROPY_ENABLED=y
|
CONFIG_MBEDTLS_ENTROPY_ENABLED=y
|
||||||
|
|
10
samples/tfm_integration/psa_crypto/src/configs/config_tfm.h
Normal file
10
samples/tfm_integration/psa_crypto/src/configs/config_tfm.h
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2024 Nordic Semiconductor
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* In TF-M the default value of CRYPTO_ENGINE_BUF_SIZE is 0x2080.
|
||||||
|
* It causes insufficient memory failure while verifying signature.
|
||||||
|
*/
|
||||||
|
#define CRYPTO_ENGINE_BUF_SIZE 0x2400
|
|
@ -44,5 +44,7 @@ int main(void)
|
||||||
/* Dump any queued log messages, and wait for system events. */
|
/* Dump any queued log messages, and wait for system events. */
|
||||||
al_dump_log();
|
al_dump_log();
|
||||||
|
|
||||||
|
LOG_INF("Done.");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -510,7 +510,7 @@ void crp_generate_csr(void)
|
||||||
LOG_INF("Certificate Signing Request in JSON:\n");
|
LOG_INF("Certificate Signing Request in JSON:\n");
|
||||||
al_dump_log();
|
al_dump_log();
|
||||||
|
|
||||||
printf("%s\n", json_encoded_buf);
|
printf("%s\n\n", json_encoded_buf);
|
||||||
|
|
||||||
/* Close the key to free up the volatile slot. */
|
/* Close the key to free up the volatile slot. */
|
||||||
status = al_psa_status(
|
status = al_psa_status(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue