Revert "libs/libc: correct the getrandom(2) prototype"

This reverts commit 8411ef1873.

Signed-off-by: chao.an <anchao@xiaomi.com>
Change-Id: I29e90e01f3b8a0460ee53831d38d96edf7d12ef2
This commit is contained in:
chao.an
2020-12-12 12:13:19 +08:00
parent 9ac98f21dc
commit a44376ad2d
6 changed files with 8 additions and 47 deletions
+2 -18
View File
@@ -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;
}
+1 -1
View File
@@ -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
+2 -25
View File
@@ -44,21 +44,6 @@
#include <nuttx/config.h>
#include <stddef.h>
/****************************************************************************
* 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 */
+1 -1
View File
@@ -382,5 +382,5 @@ SYSCALL_LOOKUP(telldir, 1)
*/
#ifdef CONFIG_CRYPTO_RANDOM_POOL
SYSCALL_LOOKUP(getrandom, 3)
SYSCALL_LOOKUP(getrandom, 2)
#endif
+1 -1
View File
@@ -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);
+1 -1
View File
@@ -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"
1 _exit unistd.h void int
35 getitimer sys/time.h !defined(CONFIG_DISABLE_POSIX_TIMERS) int int
36 getpeername sys/socket.h defined(CONFIG_NET) int int
37 getpid unistd.h pid_t
38 getrandom sys/random.h defined(CONFIG_CRYPTO_RANDOM_POOL) ssize_t void void FAR void *
39 getsockname sys/socket.h defined(CONFIG_NET) int int
40 getsockopt sys/socket.h defined(CONFIG_NET) int int
41 getuid unistd.h defined(CONFIG_SCHED_USER_IDENTITY) uid_t