12static int outleft = 0;
14#define ROTATE(x,b) (((x) << (b)) | ((x) >> (32 - (b))))
15#define MUSH(i,b) x = t[i] += (((x ^ seed[i]) + sum) ^ ROTATE(x,b));
19 uint32
t[12]; uint32
x; uint32 sum = 0;
20 int r;
int i;
int loop;
22 for (i = 0; i < 12; ++i)
t[i] = in[i] ^ seed[12 + i];
23 for (i = 0; i < 8; ++i) out[i] = seed[24 + i];
25 for (loop = 0; loop < 2; ++loop) {
26 for (r = 0; r < 16; ++r) {
32 for (i = 0; i < 8; ++i) out[i] ^=
t[i + 4];
42 for (i = 0; i < 32; ++i)
43 uint32_unpack((
char *)
data + 4 * i,seed + i);
47 for (i = 0; i < 4; ++i)
48 uint32_unpack(tpack + 4 * i,in + 4 + i);
60 if (!++in[0])
if (!++in[1])
if (!++in[2]) ++in[3];
65 return out[--outleft] % n;
77 if (xlen < 1048576) i = xlen;
81 if (i < 1) { sleep(1);
continue; }
92 log_anon(
"opening /dev/urandom failed");
104 if (!++in[0])
if (!++in[1])
if (!++in[2]) ++in[3];
109 return out[--outleft] % n;
int crypto_random_init(void)
unsigned int dns_random(unsigned int n)
unsigned int crypto_random(unsigned int n)
void randombytes(uint8 *x, unsigned long long xlen)
void dns_random_init(const char data[128])
struct tcpclient t[QUERY_MAXTCP]