Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Signed-off-by: Adrian Gielniewski <[email protected]>
  • Loading branch information
adigie committed Feb 20, 2025
1 parent 468aca9 commit 8ba33eb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/platform/Zephyr/PlatformManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ PlatformManagerImpl PlatformManagerImpl::sInstance{ sChipThreadStack };

static k_timer sOperationalHoursSavingTimer;

#if !defined(CONFIG_NRF_SECURITY) && !defined(CONFIG_MBEDTLS_ZEPHYR_ENTROPY)
#if !defined(CONFIG_NRF_SECURITY) && !defined(CONFIG_MBEDTLS_ENTROPY_POLL_ZEPHYR)
static bool sChipStackEntropySourceAdded = false;
static int app_entropy_source(void * data, unsigned char * output, size_t len, size_t * olen)
{
Expand All @@ -72,7 +72,7 @@ static int app_entropy_source(void * data, unsigned char * output, size_t len, s

return ret;
}
#endif // !defined(CONFIG_NRF_SECURITY) && !defined(CONFIG_MBEDTLS_ZEPHYR_ENTROPY)
#endif // !defined(CONFIG_NRF_SECURITY) && !defined(CONFIG_MBEDTLS_ENTROPY_POLL_ZEPHYR)

void PlatformManagerImpl::OperationalHoursSavingTimerEventHandler(k_timer * timer)
{
Expand Down Expand Up @@ -117,24 +117,24 @@ CHIP_ERROR PlatformManagerImpl::_InitChipStack(void)
{
CHIP_ERROR err;

#if !defined(CONFIG_NRF_SECURITY) && !defined(CONFIG_MBEDTLS_ZEPHYR_ENTROPY)
#if !defined(CONFIG_NRF_SECURITY) && !defined(CONFIG_MBEDTLS_ENTROPY_POLL_ZEPHYR)
// Minimum required from source before entropy is released ( with mbedtls_entropy_func() ) (in bytes)
const size_t kThreshold = 16;
#endif // !defined(CONFIG_NRF_SECURITY) && !defined(CONFIG_MBEDTLS_ZEPHYR_ENTROPY)
#endif // !defined(CONFIG_NRF_SECURITY) && !defined(CONFIG_MBEDTLS_ENTROPY_POLL_ZEPHYR)

// Initialize the configuration system.
err = Internal::ZephyrConfig::Init();
SuccessOrExit(err);

#if !defined(CONFIG_NRF_SECURITY) && !defined(CONFIG_MBEDTLS_ZEPHYR_ENTROPY)
#if !defined(CONFIG_NRF_SECURITY) && !defined(CONFIG_MBEDTLS_ENTROPY_POLL_ZEPHYR)
if (!sChipStackEntropySourceAdded)
{
// Add entropy source based on Zephyr entropy driver
err = chip::Crypto::add_entropy_source(app_entropy_source, NULL, kThreshold);
SuccessOrExit(err);
sChipStackEntropySourceAdded = true;
}
#endif // !defined(CONFIG_NRF_SECURITY) && !defined(CONFIG_MBEDTLS_ZEPHYR_ENTROPY)
#endif // !defined(CONFIG_NRF_SECURITY) && !defined(CONFIG_MBEDTLS_ENTROPY_POLL_ZEPHYR)

// Call _InitChipStack() on the generic implementation base class to finish the initialization process.
err = Internal::GenericPlatformManagerImpl_Zephyr<PlatformManagerImpl>::_InitChipStack();
Expand Down
1 change: 1 addition & 0 deletions src/test_driver/nrfconnect/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ CONFIG_MBEDTLS_PSA_KEY_SLOT_COUNT=64
CONFIG_MBEDTLS_USER_CONFIG_ENABLE=y
CONFIG_MBEDTLS_USER_CONFIG_FILE="app_mbedtls_config.h"
CONFIG_MBEDTLS_ENTROPY_POLL_ZEPHYR=y
CONFIG_MBEDTLS_ENTROPY_C=y
CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED=y
CONFIG_MBEDTLS_PSA_CRYPTO_C=y
CONFIG_MBEDTLS_MEMORY_DEBUG=y
Expand Down

0 comments on commit 8ba33eb

Please sign in to comment.