From 6f3e9754ef9446cb8a9f98e593aed23a730c4c10 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Thu, 15 Sep 2016 11:48:18 +0000 Subject: Add s6-fillurandompool --- src/minutils/deps-exe/s6-fillurandompool | 1 + src/minutils/s6-fillurandompool.c | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 src/minutils/deps-exe/s6-fillurandompool create mode 100644 src/minutils/s6-fillurandompool.c (limited to 'src') diff --git a/src/minutils/deps-exe/s6-fillurandompool b/src/minutils/deps-exe/s6-fillurandompool new file mode 100644 index 0000000..e7187fe --- /dev/null +++ b/src/minutils/deps-exe/s6-fillurandompool @@ -0,0 +1 @@ +-lskarnet diff --git a/src/minutils/s6-fillurandompool.c b/src/minutils/s6-fillurandompool.c new file mode 100644 index 0000000..775f289 --- /dev/null +++ b/src/minutils/s6-fillurandompool.c @@ -0,0 +1,26 @@ +/* ISC license. */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE +#endif + +#include +#include +#include +#include + +#define USAGE "s6-fillurandompool" + +static int getrandom (void *buf, size_t buflen, unsigned int flags) +{ + return syscall(SYS_getrandom, buf, buflen, flags) ; +} + +int main (void) +{ + char buf[256] ; + PROG = "s6-fillurandompool" ; + if (getrandom(buf, 256, 0) != 256) + strerr_diefu1sys(111, "getrandom") ; + return 0 ; +} -- cgit 1.4.1