26 #if HAVE_CRYPTGENRANDOM
47 int fd = open(file, O_RDONLY);
52 err = read(fd, dst,
sizeof(*dst));
64 struct AVSHA *sha = (
void*)tmp;
66 static uint64_t i = 0;
67 static uint32_t
buffer[512] = {0};
68 unsigned char digest[20];
74 memset(buffer, 0,
sizeof(buffer));
89 buffer[++i&511]+= (t-last_t) % 3294638521
U;
90 if(last_i && i-last_i > 4 || i-last_i > 64 ||
TEST && i-last_i > 8)
97 buffer[0] = buffer[1] = 0;
109 #if HAVE_CRYPTGENRANDOM
111 if (CryptAcquireContext(&provider,
NULL,
NULL, PROV_RSA_FULL,
112 CRYPT_VERIFYCONTEXT | CRYPT_SILENT)) {
113 BOOL ret = CryptGenRandom(provider,
sizeof(seed), (PBYTE) &seed);
114 CryptReleaseContext(provider, 0);
120 if (
read_random(&seed,
"/dev/urandom") ==
sizeof(seed))
122 if (
read_random(&seed,
"/dev/random") ==
sizeof(seed))
137 for (retry=0; retry<3; retry++){
141 if (seeds[j] == seeds[i])
144 printf(
"seeds OK\n");
148 printf(
"FAIL at %d with %X\n", j, seeds[j]);