static int random_fd = -1;
void crypto_init(void) {
+ assert(random_fd == -1);
+
random_fd = open("/dev/urandom", O_RDONLY);
if(random_fd < 0) {
}
void crypto_exit(void) {
+ assert(random_fd != -1);
+
close(random_fd);
+ random_fd = -1;
}
void randomize(void *out, size_t outlen) {
+ assert(outlen);
+
char *ptr = out;
while(outlen) {
}
void randomize(void *out, size_t outlen) {
+ assert(outlen);
+
if(!CryptGenRandom(prov, outlen, out)) {
fprintf(stderr, "CryptGenRandom() failed\n");
abort();