drivers/crypto/dev_urandom.c: Revert part of fe983a4471. The change was ill informed and introduced warnings when CONFIG_DEV_URANDOM_RANDOM_POOL is selected. As noted by Juha Niskanen in commit comments.

This commit is contained in:
Gregory Nutt 2019-10-01 07:12:37 -06:00
parent 30021c4dee
commit 5058911f46

View file

@ -162,15 +162,15 @@ static inline uint32_t do_congruential(void)
static ssize_t devurand_read(FAR struct file *filep, FAR char *buffer, static ssize_t devurand_read(FAR struct file *filep, FAR char *buffer,
size_t len) size_t len)
{ {
size_t n;
uint32_t rnd;
#ifdef CONFIG_DEV_URANDOM_RANDOM_POOL #ifdef CONFIG_DEV_URANDOM_RANDOM_POOL
if (len > 0) if (len > 0)
{ {
getrandom(buffer, len); getrandom(buffer, len);
} }
#else #else
size_t n;
uint32_t rnd;
n = len; n = len;
@ -214,7 +214,7 @@ static ssize_t devurand_read(FAR struct file *filep, FAR char *buffer,
do do
{ {
*buffer++ = rnd & 0xFF; *buffer++ = rnd & 0xff;
rnd >>= 8; rnd >>= 8;
} }
while (--n > 0); while (--n > 0);