diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2022-03-27 06:49:31 +0000 |
---|---|---|
committer | Laurent Bercot <ska@appnovation.com> | 2022-03-27 06:49:31 +0000 |
commit | 1fedaae65b56b8548cdf2d8c26e2becece5fec07 (patch) | |
tree | 018614f853867c7977aaf7cd619769fd432179c1 /src | |
parent | 73439ad0ff5363ad629086fe04ac44f5569a185e (diff) | |
download | skalibs-1fedaae65b56b8548cdf2d8c26e2becece5fec07.tar.xz |
Add sysdep for GRND_INSECURE
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/sysdeps/trygrndinsecure.c | 16 |
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 ; +} |