random: Fix feature dependency usage
Code using sys_csrand_get should depend on CONFIG_CSPRNG_ENABLED symbol and not in ENTROPY_HAS_DRIVER since they are not using the entropy device directly. Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
This commit is contained in:
parent
646a06c9fe
commit
5d505c7b28
3 changed files with 4 additions and 5 deletions
|
@ -12,7 +12,7 @@
|
|||
|
||||
LOG_MODULE_REGISTER(net_otPlat_entropy, CONFIG_OPENTHREAD_L2_LOG_LEVEL);
|
||||
|
||||
#if !defined(CONFIG_ENTROPY_HAS_DRIVER)
|
||||
#if !defined(CONFIG_CSPRNG_ENABLED)
|
||||
#error OpenThread requires an entropy source for a TRNG
|
||||
#endif
|
||||
|
||||
|
|
|
@ -272,7 +272,7 @@ static int tls_ctr_drbg_random(void *ctx, unsigned char *buf, size_t len)
|
|||
{
|
||||
ARG_UNUSED(ctx);
|
||||
|
||||
#if defined(CONFIG_ENTROPY_HAS_DRIVER)
|
||||
#if defined(CONFIG_CSPRNG_ENABLED)
|
||||
return sys_csrand_get(buf, len);
|
||||
#else
|
||||
sys_rand_get(buf, len);
|
||||
|
@ -1681,7 +1681,7 @@ static int tls_opt_dtls_connection_id_set(struct tls_context *context,
|
|||
context->options.dtls_cid.enabled = true;
|
||||
if (context->options.dtls_cid.cid_len == 0) {
|
||||
/* generate random self cid */
|
||||
#if defined(CONFIG_ENTROPY_HAS_DRIVER)
|
||||
#if defined(CONFIG_CSPRNG_ENABLED)
|
||||
sys_csrand_get(context->options.dtls_cid.cid,
|
||||
MBEDTLS_SSL_CID_OUT_LEN_MAX);
|
||||
#else
|
||||
|
|
|
@ -22,8 +22,7 @@ static inline void z_vrfy_sys_rand_get(void *dst, size_t len)
|
|||
}
|
||||
#include <syscalls/sys_rand_get_mrsh.c>
|
||||
|
||||
#if defined(CONFIG_CTR_DRBG_CSPRNG_GENERATOR) || \
|
||||
defined(CONFIG_HARDWARE_DEVICE_CS_GENERATOR)
|
||||
#ifdef CONFIG_CSPRNG_ENABLED
|
||||
static inline int z_vrfy_sys_csrand_get(void *dst, size_t len)
|
||||
{
|
||||
Z_OOPS(Z_SYSCALL_MEMORY_WRITE(dst, len));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue