[rtems-libbsd commit] random: Implement read_random via getentropy.

Christian Mauderer christianm at rtems.org
Mon Aug 6 13:14:45 UTC 2018


Module:    rtems-libbsd
Branch:    master
Commit:    9ea8664ba2c53e3abae6359530f3bdc414b22f46
Changeset: http://git.rtems.org/rtems-libbsd/commit/?id=9ea8664ba2c53e3abae6359530f3bdc414b22f46

Author:    Christian Mauderer <christian.mauderer at embedded-brains.de>
Date:      Tue Jun 26 13:54:08 2018 +0200

random: Implement read_random via getentropy.

---

 freebsd/sys/sys/random.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/freebsd/sys/sys/random.h b/freebsd/sys/sys/random.h
index 396ec2b..996ca5c 100644
--- a/freebsd/sys/sys/random.h
+++ b/freebsd/sys/sys/random.h
@@ -50,11 +50,21 @@ read_random_uio(void *a __unused, u_int b __unused)
 {
 	return (0);
 }
+#ifndef __rtems__
 static __inline u_int
 read_random(void *a __unused, u_int b __unused)
 {
 	return (0);
 }
+#else /* __rtems__ */
+#include <unistd.h>
+static __inline u_int
+read_random(void *ptr, u_int n)
+{
+	getentropy(ptr, n);
+	return (n);
+}
+#endif /* __rtems__ */
 #endif
 
 /*




More information about the vc mailing list