From dbcd04ef867d8819f26f638fd1b1fca36ddc5878 Mon Sep 17 00:00:00 2001 From: Jonathan Hui Date: Mon, 31 Jan 2022 14:33:04 -0800 Subject: [PATCH] [crypto] add feature flag around kEntropyMinThreshold (#7381) To avoid "unused variable" compiler warning. --- src/core/crypto/crypto_platform.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/core/crypto/crypto_platform.cpp b/src/core/crypto/crypto_platform.cpp index 7146151ba..7b3a77070 100644 --- a/src/core/crypto/crypto_platform.cpp +++ b/src/core/crypto/crypto_platform.cpp @@ -67,7 +67,9 @@ using namespace Crypto; #if !OPENTHREAD_RADIO static mbedtls_ctr_drbg_context sCtrDrbgContext; static mbedtls_entropy_context sEntropyContext; -static constexpr uint16_t kEntropyMinThreshold = 16; +#ifndef OT_MBEDTLS_STRONG_DEFAULT_ENTROPY_PRESENT +static constexpr uint16_t kEntropyMinThreshold = 16; +#endif #endif OT_TOOL_WEAK void otPlatCryptoInit(void) @@ -461,7 +463,7 @@ OT_TOOL_WEAK void otPlatCryptoRandomInit(void) #ifndef OT_MBEDTLS_STRONG_DEFAULT_ENTROPY_PRESENT mbedtls_entropy_add_source(&sEntropyContext, handleMbedtlsEntropyPoll, nullptr, kEntropyMinThreshold, MBEDTLS_ENTROPY_SOURCE_STRONG); -#endif // OT_MBEDTLS_STRONG_DEFAULT_ENTROPY_PRESENT +#endif mbedtls_ctr_drbg_init(&sCtrDrbgContext);