From 5058911f4641333a39780ccf366b493ee1840db0 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 1 Oct 2019 07:12:37 -0600 Subject: [PATCH] drivers/crypto/dev_urandom.c: Revert part of fe983a44715aa619f1237f7aead67c856bdbad2b. The change was ill informed and introduced warnings when CONFIG_DEV_URANDOM_RANDOM_POOL is selected. As noted by Juha Niskanen in commit comments. --- drivers/crypto/dev_urandom.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/crypto/dev_urandom.c b/drivers/crypto/dev_urandom.c index 6ac260a3d4..67bc9b6529 100644 --- a/drivers/crypto/dev_urandom.c +++ b/drivers/crypto/dev_urandom.c @@ -162,15 +162,15 @@ static inline uint32_t do_congruential(void) static ssize_t devurand_read(FAR struct file *filep, FAR char *buffer, size_t len) { - size_t n; - uint32_t rnd; - #ifdef CONFIG_DEV_URANDOM_RANDOM_POOL if (len > 0) { getrandom(buffer, len); } + #else + size_t n; + uint32_t rnd; n = len; @@ -214,7 +214,7 @@ static ssize_t devurand_read(FAR struct file *filep, FAR char *buffer, do { - *buffer++ = rnd & 0xFF; + *buffer++ = rnd & 0xff; rnd >>= 8; } while (--n > 0);