summaryrefslogtreecommitdiff
path: root/src/sysdeps/trygrndinsecure.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/sysdeps/trygrndinsecure.c')
-rw-r--r--src/sysdeps/trygrndinsecure.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/sysdeps/trygrndinsecure.c b/src/sysdeps/trygrndinsecure.c
new file mode 100644
index 0000000..a856ee7
--- /dev/null
+++ b/src/sysdeps/trygrndinsecure.c
@@ -0,0 +1,16 @@
+/* ISC license. */
+
+#include <features.h>
+
+#ifdef __stub_getrandom
+#error getrandom() appears to be a stub function, we won't use it.
+#endif
+
+#include <sys/random.h>
+
+int main (void)
+{
+ char buf[4] ;
+ if (getrandom(buf, 4, GRND_INSECURE) < 0) return 1 ;
+ return 0 ;
+}