13 static void randombytes_weak(unsigned char *x
, size_t xlen
)
19 fdw
= open(LOW_ENTROPY_SOURCE
, O_RDONLY
);
32 ret
= read(fdw
, x
, ret
);
43 static void randombytes_strong(unsigned char *x
, size_t xlen
)
47 fds
= open_or_die(HIG_ENTROPY_SOURCE
, O_RDONLY
);
49 ret
= read_exact(fds
, x
, xlen
, 0);
50 if (ret
!= (int) xlen
)
51 panic("Error reading from entropy source!\n");
60 randombytes_weak((void *) &ret
, sizeof(ret
));
65 void gen_key_bytes(unsigned char *area
, size_t len
)
67 randombytes_strong(area
, len
);