From 3baeb11a8fbcfcdbc31976d421f17b85503b3ecd Mon Sep 17 00:00:00 2001 From: WuKong Date: Fri, 4 Sep 2015 09:25:34 +0200 Subject: init attribute-based encryption Change-Id: Iba1a3d722110abf747a0fba366f3ebc911d25b25 --- moon-abe/pbc-0.5.14/arith/init_random.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 moon-abe/pbc-0.5.14/arith/init_random.c (limited to 'moon-abe/pbc-0.5.14/arith/init_random.c') diff --git a/moon-abe/pbc-0.5.14/arith/init_random.c b/moon-abe/pbc-0.5.14/arith/init_random.c new file mode 100644 index 00000000..bd040a38 --- /dev/null +++ b/moon-abe/pbc-0.5.14/arith/init_random.c @@ -0,0 +1,18 @@ +#include +#include // for intptr_t +#include +#include +#include "pbc_utils.h" +#include "pbc_random.h" + +void pbc_init_random(void) { + FILE *fp; + fp = fopen("/dev/urandom", "rb"); + if (!fp) { + pbc_warn("could not open /dev/urandom, using deterministic random number generator"); + pbc_random_set_deterministic(0); + } else { + pbc_random_set_file("/dev/urandom"); + fclose(fp); + } +} -- cgit 1.2.3-korg