You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2020/12/13 14:49:59 UTC

[incubator-nuttx] branch master updated (ba12c6c -> 80f9fe3)

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git.


    from ba12c6c  Fix spelling
     new 859e1ce  crypto/arc4random: rename getrandom to arc4random_buf
     new 80f9fe3  syscall/csv: sort lines of syscalls

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 crypto/random_pool.c             |  4 +--
 drivers/crypto/dev_urandom.c     |  2 +-
 include/nuttx/random.h           |  5 ++-
 include/stdlib.h                 |  4 +++
 include/sys/random.h             | 77 ----------------------------------------
 include/sys/syscall_lookup.h     |  2 +-
 libs/libc/uuid/lib_uuid_create.c |  3 +-
 syscall/syscall.csv              |  8 ++---
 8 files changed, 15 insertions(+), 90 deletions(-)
 delete mode 100644 include/sys/random.h


[incubator-nuttx] 02/02: syscall/csv: sort lines of syscalls

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 80f9fe39bb56273e5571aa537fb7107237301d9e
Author: chao.an <an...@xiaomi.com>
AuthorDate: Sat Dec 12 14:33:10 2020 +0800

    syscall/csv: sort lines of syscalls
    
    Signed-off-by: chao.an <an...@xiaomi.com>
---
 syscall/syscall.csv | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/syscall/syscall.csv b/syscall/syscall.csv
index 674621c..981855a 100644
--- a/syscall/syscall.csv
+++ b/syscall/syscall.csv
@@ -5,6 +5,7 @@
 "aio_fsync","aio.h","defined(CONFIG_FS_AIO)","int","int","FAR struct aiocb *"
 "aio_read","aio.h","defined(CONFIG_FS_AIO)","int","FAR struct aiocb *"
 "aio_write","aio.h","defined(CONFIG_FS_AIO)","int","FAR struct aiocb *"
+"arc4random_buf","stdlib.h","defined(CONFIG_CRYPTO_RANDOM_POOL)","void","FAR void *","size_t"
 "atexit","stdlib.h","defined(CONFIG_SCHED_ATEXIT)","int","void (*)(void)"
 "bind","sys/socket.h","defined(CONFIG_NET)","int","int","FAR const struct sockaddr *","socklen_t"
 "boardctl","sys/boardctl.h","defined(CONFIG_LIB_BOARDCTL)","int","unsigned int","uintptr_t"
@@ -35,7 +36,6 @@
 "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"
-"arc4random_buf","stdlib.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"
@@ -44,7 +44,6 @@
 "insmod","nuttx/module.h","defined(CONFIG_MODULE)","FAR void *","FAR const char *","FAR const char *"
 "ioctl","sys/ioctl.h","","int","int","int","...","unsigned long"
 "kill","signal.h","","int","pid_t","int"
-"symlink","unistd.h","defined(CONFIG_PSEUDOFS_SOFTLINKS)","int","FAR const char *","FAR const char *"
 "listen","sys/socket.h","defined(CONFIG_NET)","int","int","int"
 "lseek","unistd.h","","off_t","int","off_t","int"
 "lstat","sys/stat.h","","int","FAR const char *","FAR struct stat *"
@@ -67,6 +66,8 @@
 "nx_pipe","nuttx/drivers/drivers.h","defined(CONFIG_PIPES) && CONFIG_DEV_PIPE_SIZE > 0","int","int [2]|FAR int *","size_t","int"
 "nx_task_spawn","nuttx/spawn.h","defined(CONFIG_LIB_SYSCALL) && !defined(CONFIG_BUILD_KERNEL)","int","FAR const struct spawn_syscall_parms_s *"
 "nx_vsyslog","nuttx/syslog/syslog.h","","int","int","FAR const IPTR char *","FAR va_list *"
+"nxsched_get_stackinfo","nuttx/sched.h","","int","pid_t","FAR struct stackinfo_s *"
+"nxsched_get_streams","nuttx/sched.h","defined(CONFIG_FILE_STREAM)","FAR struct streamlist *"
 "on_exit","stdlib.h","defined(CONFIG_SCHED_ONEXIT)","int","CODE void (*)(int, FAR void *)","FAR void *"
 "open","fcntl.h","","int","FAR const char *","int","...","mode_t"
 "opendir","dirent.h","","FAR DIR *","FAR const char *"
@@ -117,8 +118,6 @@
 "sched_getcpu","sched.h","defined(CONFIG_SMP)","int"
 "sched_getparam","sched.h","","int","pid_t","FAR struct sched_param *"
 "sched_getscheduler","sched.h","","int","pid_t"
-"nxsched_get_stackinfo","nuttx/sched.h","","int","pid_t","FAR struct stackinfo_s *"
-"nxsched_get_streams","nuttx/sched.h","defined(CONFIG_FILE_STREAM)","FAR struct streamlist *"
 "sched_lock","sched.h","","int"
 "sched_lockcount","sched.h","","int"
 "sched_rr_get_interval","sched.h","","int","pid_t","struct timespec *"
@@ -162,6 +161,7 @@
 "socket","sys/socket.h","defined(CONFIG_NET)","int","int","int","int"
 "stat","sys/stat.h","","int","FAR const char *","FAR struct stat *"
 "statfs","sys/statfs.h","","int","FAR const char *","FAR struct statfs *"
+"symlink","unistd.h","defined(CONFIG_PSEUDOFS_SOFTLINKS)","int","FAR const char *","FAR const char *"
 "task_create","sched.h","!defined(CONFIG_BUILD_KERNEL)", "int","FAR const char *","int","int","main_t","FAR char * const []|FAR char * const *"
 "task_delete","sched.h","","int","pid_t"
 "task_restart","sched.h","","int","pid_t"


[incubator-nuttx] 01/02: crypto/arc4random: rename getrandom to arc4random_buf

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 859e1ce63a458b206623d8e41cd93588af61b62f
Author: chao.an <an...@xiaomi.com>
AuthorDate: Sat Dec 12 14:16:07 2020 +0800

    crypto/arc4random: rename getrandom to arc4random_buf
    
    Change-Id: I5c9f0c9acf5af71f01beceaf06ebe0a2c87676bc
    Signed-off-by: chao.an <an...@xiaomi.com>
---
 crypto/random_pool.c             |  4 +--
 drivers/crypto/dev_urandom.c     |  2 +-
 include/nuttx/random.h           |  5 ++-
 include/stdlib.h                 |  4 +++
 include/sys/random.h             | 77 ----------------------------------------
 include/sys/syscall_lookup.h     |  2 +-
 libs/libc/uuid/lib_uuid_create.c |  3 +-
 syscall/syscall.csv              |  2 +-
 8 files changed, 12 insertions(+), 87 deletions(-)

diff --git a/crypto/random_pool.c b/crypto/random_pool.c
index 0794105..7fdf7d0 100644
--- a/crypto/random_pool.c
+++ b/crypto/random_pool.c
@@ -542,7 +542,7 @@ void up_randompool_initialize(void)
 }
 
 /****************************************************************************
- * Name: getrandom
+ * Name: arc4random_buf
  *
  * Description:
  *   Fill a buffer of arbitrary length with randomness. This is the
@@ -561,7 +561,7 @@ void up_randompool_initialize(void)
  *
  ****************************************************************************/
 
-void getrandom(FAR void *bytes, size_t nbytes)
+void arc4random_buf(FAR void *bytes, size_t nbytes)
 {
   int ret;
 
diff --git a/drivers/crypto/dev_urandom.c b/drivers/crypto/dev_urandom.c
index 106f7ad..0ec2c91 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);
+      arc4random_buf(buffer, len);
     }
 
 #else
diff --git a/include/nuttx/random.h b/include/nuttx/random.h
index a2fee4f..6402749 100644
--- a/include/nuttx/random.h
+++ b/include/nuttx/random.h
@@ -44,8 +44,6 @@
 #include <nuttx/config.h>
 #include <stddef.h>
 
-#include <sys/random.h> /* getrandom() */
-
 /****************************************************************************
  * Pre-processor Definitions
  ****************************************************************************/
@@ -98,7 +96,8 @@ enum rnd_source_t
 #ifdef CONFIG_BOARD_ENTROPY_POOL
 /* 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
- * is kept over system reset. */
+ * is kept over system reset.
+ */
 
 extern struct entropy_pool_s board_entropy_pool;
 #endif
diff --git a/include/stdlib.h b/include/stdlib.h
index 3eaf0e2..740bd06 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -121,6 +121,10 @@ int       rand(void);
 #define   srandom(s) srand(s)
 long      random(void);
 
+#ifdef CONFIG_CRYPTO_RANDOM_POOL
+void      arc4random_buf(FAR void *bytes, size_t nbytes);
+#endif
+
 /* Environment variable support */
 
 FAR char **get_environ_ptr(void);
diff --git a/include/sys/random.h b/include/sys/random.h
deleted file mode 100644
index 65a224d..0000000
--- a/include/sys/random.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
- * include/sys/random.h
- *
- *   Copyright (C) 2015-2017 Haltian Ltd. All rights reserved.
- *   Authors: Juha Niskanen <ju...@haltian.com>
- *            Jussi Kivilinna <ju...@haltian.com>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- *    used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ****************************************************************************/
-
-#ifndef __INCLUDE_SYS_RANDOM_H
-#define __INCLUDE_SYS_RANDOM_H
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-#include <stddef.h>
-
-/****************************************************************************
- * Public Function Prototypes
- ****************************************************************************/
-
-#ifdef CONFIG_CRYPTO_RANDOM_POOL
-
-/****************************************************************************
- * Name: getrandom
- *
- * Description:
- *   Fill a buffer of arbitrary length with randomness. This is the
- *   preferred interface for getting random numbers. The traditional
- *   /dev/random approach is susceptible for things like the attacker
- *   exhausting file descriptors on purpose.
- *
- *   Note that this function cannot fail, other than by asserting.
- *
- * Input Parameters:
- *   bytes  - Buffer for returned random bytes
- *   nbytes - Number of bytes requested.
- *
- * Returned Value:
- *   None
- *
- ****************************************************************************/
-
-void getrandom(FAR void *bytes, size_t nbytes);
-
-#endif /* CONFIG_CRYPTO_RANDOM_POOL */
-
-#endif /* __INCLUDE_SYS_RANDOM_H */
diff --git a/include/sys/syscall_lookup.h b/include/sys/syscall_lookup.h
index 235f306..1b3b372 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(arc4random_buf,           2)
 #endif
diff --git a/libs/libc/uuid/lib_uuid_create.c b/libs/libc/uuid/lib_uuid_create.c
index 29b415f..d2af6e0 100644
--- a/libs/libc/uuid/lib_uuid_create.c
+++ b/libs/libc/uuid/lib_uuid_create.c
@@ -22,7 +22,6 @@
  * Included Files
  ****************************************************************************/
 
-#include <sys/random.h>
 #include <stdlib.h>
 #include <uuid.h>
 
@@ -44,7 +43,7 @@
 void uuid_create(uuid_t *u, uint32_t *status)
 {
 #ifdef CONFIG_CRYPTO_RANDOM_POOL
-  getrandom(u, sizeof(uuid_t));
+  arc4random_buf(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 7b727ad..674621c 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"
+"arc4random_buf","stdlib.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"