You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ac...@apache.org on 2022/06/15 14:18:10 UTC

[incubator-nuttx] branch master updated: getrandom: fix comment contradicting code

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 449cf4d076 getrandom: fix comment contradicting code
449cf4d076 is described below

commit 449cf4d076cd67f4183b8687161107b738862379
Author: Juha Niskanen <ju...@haltian.com>
AuthorDate: Wed Jun 15 14:59:20 2022 +0300

    getrandom: fix comment contradicting code
    
    Signed-off-by: Juha Niskanen <ju...@haltian.com>
---
 include/sys/random.h           | 10 ++++------
 libs/libc/misc/lib_getrandom.c | 10 ++++------
 2 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/include/sys/random.h b/include/sys/random.h
index 0e472d2d3e..2d496c09bf 100644
--- a/include/sys/random.h
+++ b/include/sys/random.h
@@ -50,12 +50,10 @@
  * 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.
+ *   Fill a buffer of arbitrary length with randomness. This uses
+ *   either /dev/random (if GRND_RANDOM flag) or /dev/urandom device and
+ *   is therefore susceptible for things like the attacker exhausting file
+ *   descriptors on purpose.
  *
  * Input Parameters:
  *   bytes  - Buffer for returned random bytes
diff --git a/libs/libc/misc/lib_getrandom.c b/libs/libc/misc/lib_getrandom.c
index 9b288f3606..c4e38f1eac 100644
--- a/libs/libc/misc/lib_getrandom.c
+++ b/libs/libc/misc/lib_getrandom.c
@@ -36,12 +36,10 @@
  * 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.
+ *   Fill a buffer of arbitrary length with randomness. This uses
+ *   either /dev/random (if GRND_RANDOM flag) or /dev/urandom device and
+ *   is therefore susceptible for things like the attacker exhausting file
+ *   descriptors on purpose.
  *
  * Input Parameters:
  *   bytes  - Buffer for returned random bytes