Minor, cosmetic changes.

This commit is contained in:
Gregory Nutt 2019-09-23 12:58:31 -06:00
parent 5141d9f53c
commit fe983a4471
2 changed files with 7 additions and 4 deletions

View File

@ -111,7 +111,8 @@ static struct rng_s g_rng;
#ifdef CONFIG_BOARD_ENTROPY_POOL #ifdef CONFIG_BOARD_ENTROPY_POOL
/* Entropy pool structure can be provided by board source. Use for this is, /* Entropy pool structure can be provided by board source. Use for this is,
* for example, allocate entropy pool from special area of RAM which content * for example, allocate entropy pool from special area of RAM which content
* is kept over system reset. */ * is kept over system reset.
*/
# define entropy_pool board_entropy_pool # define entropy_pool board_entropy_pool
#else #else

View File

@ -162,14 +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) if (len > 0)
{ {
getrandom(buffer, len); getrandom(buffer, len);
} }
#else #else
size_t n;
uint32_t rnd;
n = len; n = len;
@ -239,6 +240,7 @@ static ssize_t devurand_write(FAR struct file *filep, FAR const char *buffer,
memcpy(&seed, buffer, len); memcpy(&seed, buffer, len);
srand(seed); srand(seed);
return len; return len;
#elif defined(CONFIG_DEV_URANDOM_RANDOM_POOL) #elif defined(CONFIG_DEV_URANDOM_RANDOM_POOL)
const unsigned int alignmask = sizeof(uint32_t) - 1; const unsigned int alignmask = sizeof(uint32_t) - 1;
const size_t initlen = len; const size_t initlen = len;