From 1fedaae65b56b8548cdf2d8c26e2becece5fec07 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Sun, 27 Mar 2022 06:49:31 +0000 Subject: Add sysdep for GRND_INSECURE Signed-off-by: Laurent Bercot --- configure | 1 + src/sysdeps/trygrndinsecure.c | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 src/sysdeps/trygrndinsecure.c diff --git a/configure b/configure index 430e57e..95b92f0 100755 --- a/configure +++ b/configure @@ -636,6 +636,7 @@ choose cl namespaces 'namespaces' choose cl nsgetparent 'NS_GET_PARENT' choose cl explicit_bzero 'explicit_bzero()' choose cl getrandom 'getrandom()' +choose cl grndinsecure 'GRND_INSECURE' choose cl chroot 'chroot()' # Here are the evil irreducible run-time sysdeps. 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 + +#ifdef __stub_getrandom +#error getrandom() appears to be a stub function, we won't use it. +#endif + +#include + +int main (void) +{ + char buf[4] ; + if (getrandom(buf, 4, GRND_INSECURE) < 0) return 1 ; + return 0 ; +} -- cgit v1.3.1