diff --git a/crypto/random_pool.c b/crypto/random_pool.c index 93843a9eec7..e7846901da0 100644 --- a/crypto/random_pool.c +++ b/crypto/random_pool.c @@ -555,13 +555,15 @@ void up_randompool_initialize(void) * Input Parameters: * bytes - Buffer for returned random bytes * nbytes - Number of bytes requested. + * flags - Bit mask that can contain zero or more of the ORed values + * together. * * Returned Value: * None * ****************************************************************************/ -void getrandom(FAR void *bytes, size_t nbytes) +void getrandom(FAR void *bytes, size_t nbytes, unsigned int flags) { int ret; diff --git a/drivers/crypto/dev_urandom.c b/drivers/crypto/dev_urandom.c index 106f7ad527c..b6c6900501a 100644 --- a/drivers/crypto/dev_urandom.c +++ b/drivers/crypto/dev_urandom.c @@ -165,7 +165,7 @@ static ssize_t devurand_read(FAR struct file *filep, FAR char *buffer, #ifdef CONFIG_DEV_URANDOM_RANDOM_POOL if (len > 0) { - getrandom(buffer, len); + getrandom(buffer, len, 0); } #else diff --git a/include/sys/random.h b/include/sys/random.h index 65a224d0ec2..401146b4ee3 100644 --- a/include/sys/random.h +++ b/include/sys/random.h @@ -64,13 +64,15 @@ * Input Parameters: * bytes - Buffer for returned random bytes * nbytes - Number of bytes requested. + * flags - Bit mask that can contain zero or more of the ORed values + * together. * * Returned Value: * None * ****************************************************************************/ -void getrandom(FAR void *bytes, size_t nbytes); +void getrandom(FAR void *bytes, size_t nbytes, unsigned int flags); #endif /* CONFIG_CRYPTO_RANDOM_POOL */ diff --git a/include/sys/syscall_lookup.h b/include/sys/syscall_lookup.h index 235f3068b79..68a68031f4e 100644 --- a/include/sys/syscall_lookup.h +++ b/include/sys/syscall_lookup.h @@ -382,5 +382,5 @@ SYSCALL_LOOKUP(telldir, 1) */ #ifdef CONFIG_CRYPTO_RANDOM_POOL - SYSCALL_LOOKUP(getrandom, 2) + SYSCALL_LOOKUP(getrandom, 3) #endif diff --git a/libs/libc/uuid/lib_uuid_create.c b/libs/libc/uuid/lib_uuid_create.c index 29b415f76b4..3f581642b8c 100644 --- a/libs/libc/uuid/lib_uuid_create.c +++ b/libs/libc/uuid/lib_uuid_create.c @@ -44,7 +44,7 @@ void uuid_create(uuid_t *u, uint32_t *status) { #ifdef CONFIG_CRYPTO_RANDOM_POOL - getrandom(u, sizeof(uuid_t)); + getrandom(u, sizeof(uuid_t), 0); #else unsigned long *beg = (unsigned long *)u; unsigned long *end = (unsigned long *)(u + 1); diff --git a/syscall/syscall.csv b/syscall/syscall.csv index 7b727adcf1d..7d4a401a021 100644 --- a/syscall/syscall.csv +++ b/syscall/syscall.csv @@ -35,7 +35,7 @@ "getitimer","sys/time.h","!defined(CONFIG_DISABLE_POSIX_TIMERS)","int","int","FAR struct itimerval *" "getpeername","sys/socket.h","defined(CONFIG_NET)","int","int","FAR struct sockaddr *","FAR socklen_t *" "getpid","unistd.h","","pid_t" -"getrandom","sys/random.h","defined(CONFIG_CRYPTO_RANDOM_POOL)","void","FAR void *","size_t" +"getrandom","sys/random.h","defined(CONFIG_CRYPTO_RANDOM_POOL)","void","FAR void *","size_t","unsigned int" "getsockname","sys/socket.h","defined(CONFIG_NET)","int","int","FAR struct sockaddr *","FAR socklen_t *" "getsockopt","sys/socket.h","defined(CONFIG_NET)","int","int","int","int","FAR void *","FAR socklen_t *" "getuid","unistd.h","defined(CONFIG_SCHED_USER_IDENTITY)","uid_t"