diff --git a/crypto/random_pool.c b/crypto/random_pool.c index d5bdcb56126..93843a9eec7 100644 --- a/crypto/random_pool.c +++ b/crypto/random_pool.c @@ -555,21 +555,13 @@ 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: - * On success, getrandom() returns the number of bytes that were copied - * to the buffer buf. This may be less than the number of bytes - * requested via buflen if either GRND_RANDOM was specified in flags and - * insufficient entropy was present in the random source or the system - * call was interrupted by a signal. - - * On error, -1 is returned, and errno is set appropriately. + * None * ****************************************************************************/ -ssize_t getrandom(FAR void *bytes, size_t nbytes, unsigned int flags) +void getrandom(FAR void *bytes, size_t nbytes) { int ret; @@ -578,13 +570,5 @@ ssize_t getrandom(FAR void *bytes, size_t nbytes, unsigned int flags) { rng_buf_internal(bytes, nbytes); nxsem_post(&g_rng.rd_sem); - ret = nbytes; } - else - { - set_errno(-ret); - ret = ERROR; - } - - return ret; } diff --git a/drivers/crypto/dev_urandom.c b/drivers/crypto/dev_urandom.c index b6c6900501a..106f7ad527c 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, 0); + getrandom(buffer, len); } #else diff --git a/include/sys/random.h b/include/sys/random.h index d394e0f350c..65a224d0ec2 100644 --- a/include/sys/random.h +++ b/include/sys/random.h @@ -44,21 +44,6 @@ #include #include -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* Flags for getrandom(2) - * - * GRND_NONBLOCK Don't block and return EAGAIN instead - * GRND_RANDOM No effect - * GRND_INSECURE Return non-cryptographic random bytes - */ - -#define GRND_NONBLOCK 0x0001 -#define GRND_RANDOM 0x0002 -#define GRND_INSECURE 0x0004 - /**************************************************************************** * Public Function Prototypes ****************************************************************************/ @@ -79,21 +64,13 @@ * 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: - * On success, getrandom() returns the number of bytes that were copied - * to the buffer buf. This may be less than the number of bytes - * requested via buflen if either GRND_RANDOM was specified in flags and - * insufficient entropy was present in the random source or the system - * call was interrupted by a signal. - * - * On error, -1 is returned, and errno is set appropriately. + * None * ****************************************************************************/ -ssize_t getrandom(FAR void *bytes, size_t nbytes, unsigned int flags); +void getrandom(FAR void *bytes, size_t nbytes); #endif /* CONFIG_CRYPTO_RANDOM_POOL */ diff --git a/include/sys/syscall_lookup.h b/include/sys/syscall_lookup.h index 68a68031f4e..235f3068b79 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, 3) + SYSCALL_LOOKUP(getrandom, 2) #endif diff --git a/libs/libc/uuid/lib_uuid_create.c b/libs/libc/uuid/lib_uuid_create.c index 3f581642b8c..29b415f76b4 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), 0); + getrandom(u, sizeof(uuid_t)); #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 1bade984e07..7b727adcf1d 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)","ssize_t","void","FAR void *","size_t","unsigned int" +"getrandom","sys/random.h","defined(CONFIG_CRYPTO_RANDOM_POOL)","void","FAR void *","size_t" "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"