[rtems commit] cpukit: Add _arc4random_getentropy_fail.

Sebastian Huber sebh at rtems.org
Fri Nov 17 06:28:15 UTC 2017


Module:    rtems
Branch:    master
Commit:    ddc339c51fa436e91eba083029bec3849997899e
Changeset: http://git.rtems.org/rtems/commit/?id=ddc339c51fa436e91eba083029bec3849997899e

Author:    Christian Mauderer <Christian.Mauderer at embedded-brains.de>
Date:      Mon Nov 13 09:21:28 2017 +0100

cpukit: Add _arc4random_getentropy_fail.

Add a default implementation of _arc4random_getentropy_fail with an
internal error.

Update #3239.

---

 cpukit/libcsupport/Makefile.am                      |  3 ++-
 cpukit/libcsupport/src/arc4random_getentropy_fail.c | 21 +++++++++++++++++++++
 cpukit/sapi/src/interrtext.c                        |  3 ++-
 cpukit/score/include/rtems/score/interr.h           |  3 ++-
 testsuites/sptests/spinternalerror02/init.c         |  2 +-
 5 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/cpukit/libcsupport/Makefile.am b/cpukit/libcsupport/Makefile.am
index 756526a..038ac93 100644
--- a/cpukit/libcsupport/Makefile.am
+++ b/cpukit/libcsupport/Makefile.am
@@ -116,7 +116,8 @@ TERMINAL_IDENTIFICATION_C_FILES += src/ttyname.c
 LIBC_GLUE_C_FILES = src/__getpid.c src/__gettod.c src/__times.c \
     src/truncate.c src/access.c src/stat.c src/lstat.c src/pathconf.c \
     src/newlibc_reent.c src/newlibc_exit.c \
-    src/kill_noposix.c src/utsname.c src/realpath.c
+    src/kill_noposix.c src/utsname.c src/realpath.c \
+    src/arc4random_getentropy_fail.c
 
 BSD_LIBC_C_FILES = src/strlcpy.c src/strlcat.c src/issetugid.c
 
diff --git a/cpukit/libcsupport/src/arc4random_getentropy_fail.c b/cpukit/libcsupport/src/arc4random_getentropy_fail.c
new file mode 100644
index 0000000..88aa1ca
--- /dev/null
+++ b/cpukit/libcsupport/src/arc4random_getentropy_fail.c
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2017 embedded brains GmbH.  All rights reserved.
+ *
+ *  embedded brains GmbH
+ *  Dornierstr. 4
+ *  82178 Puchheim
+ *  Germany
+ *  <rtems at embedded-brains.de>
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.org/license/LICENSE.
+ */
+
+#include <machine/_arc4random.h>
+#include <rtems/score/interr.h>
+
+void _arc4random_getentropy_fail( void )
+{
+  _Internal_error( INTERNAL_ERROR_ARC4RANDOM_GETENTROPY_FAIL );
+}
diff --git a/cpukit/sapi/src/interrtext.c b/cpukit/sapi/src/interrtext.c
index 6fada4b..79ba794 100644
--- a/cpukit/sapi/src/interrtext.c
+++ b/cpukit/sapi/src/interrtext.c
@@ -65,7 +65,8 @@ static const char *const internal_error_text[] = {
   "INTERNAL_ERROR_LIBIO_SEM_CREATE_FAILED",
   "INTERNAL_ERROR_LIBIO_STDOUT_FD_OPEN_FAILED",
   "INTERNAL_ERROR_LIBIO_STDERR_FD_OPEN_FAILED",
-  "INTERNAL_ERROR_ILLEGAL_USE_OF_FLOATING_POINT_UNIT"
+  "INTERNAL_ERROR_ILLEGAL_USE_OF_FLOATING_POINT_UNIT",
+  "INTERNAL_ERROR_ARC4RANDOM_GETENTROPY_FAIL"
 };
 
 const char *rtems_internal_error_text( rtems_fatal_code error )
diff --git a/cpukit/score/include/rtems/score/interr.h b/cpukit/score/include/rtems/score/interr.h
index ca64341..0c02c21 100644
--- a/cpukit/score/include/rtems/score/interr.h
+++ b/cpukit/score/include/rtems/score/interr.h
@@ -178,7 +178,8 @@ typedef enum {
   INTERNAL_ERROR_LIBIO_SEM_CREATE_FAILED = 35,
   INTERNAL_ERROR_LIBIO_STDOUT_FD_OPEN_FAILED = 36,
   INTERNAL_ERROR_LIBIO_STDERR_FD_OPEN_FAILED = 37,
-  INTERNAL_ERROR_ILLEGAL_USE_OF_FLOATING_POINT_UNIT = 38
+  INTERNAL_ERROR_ILLEGAL_USE_OF_FLOATING_POINT_UNIT = 38,
+  INTERNAL_ERROR_ARC4RANDOM_GETENTROPY_FAIL = 39
 } Internal_errors_Core_list;
 
 typedef CPU_Uint32ptr Internal_errors_t;
diff --git a/testsuites/sptests/spinternalerror02/init.c b/testsuites/sptests/spinternalerror02/init.c
index f1ef8f3..9ee8e6d 100644
--- a/testsuites/sptests/spinternalerror02/init.c
+++ b/testsuites/sptests/spinternalerror02/init.c
@@ -36,7 +36,7 @@ static void test_internal_error_text(void)
   } while ( text != text_last );
 
   rtems_test_assert(
-    error - 3 == INTERNAL_ERROR_ILLEGAL_USE_OF_FLOATING_POINT_UNIT
+    error - 3 == INTERNAL_ERROR_ARC4RANDOM_GETENTROPY_FAIL
   );
 }
 



More information about the vc mailing list