26 #if HAVE_CRYPTGENRANDOM
53 err = read(fd, dst,
sizeof(*dst));
65 struct AVSHA *sha = (
void*)tmp;
67 static uint64_t i = 0;
68 static uint32_t
buffer[512] = {0};
69 unsigned char digest[20];
75 memset(buffer, 0,
sizeof(buffer));
90 buffer[++i&511]+= (t-last_t) % 3294638521
U;
91 if(last_i && i-last_i > 4 || i-last_i > 64 ||
TEST && i-last_i > 8)
98 buffer[0] = buffer[1] = 0;
110 #if HAVE_CRYPTGENRANDOM
112 if (CryptAcquireContext(&provider, NULL, NULL, PROV_RSA_FULL,
113 CRYPT_VERIFYCONTEXT | CRYPT_SILENT)) {
114 BOOL ret = CryptGenRandom(provider,
sizeof(seed), (PBYTE) &seed);
115 CryptReleaseContext(provider, 0);
121 if (
read_random(&seed,
"/dev/urandom") ==
sizeof(seed))
123 if (
read_random(&seed,
"/dev/random") ==
sizeof(seed))
138 for (retry=0; retry<3; retry++){
142 if (seeds[j] == seeds[i])
145 printf(
"seeds OK\n");
149 printf(
"FAIL at %d with %X\n", j, seeds[j]);
void av_sha_final(struct AVSHA *context, uint8_t *digest)
Finish hashing and output digest value.
void av_sha_update(struct AVSHA *context, const uint8_t *data, unsigned int len)
Update hash value.
static int read_random(uint32_t *dst, const char *file)
int av_sha_init(struct AVSHA *context, int bits)
Initialize SHA-1 or SHA-2 hashing.
simple assert() macros that are a bit more flexible than ISO C assert().
int avpriv_open(const char *filename, int flags,...)
A wrapper for open() setting O_CLOEXEC.
static uint32_t get_generic_seed(void)
high precision timer, useful to profile code
common internal API header
static void close(AVCodecParserContext *s)
uint32_t av_get_random_seed(void)
Get a seed to use in conjunction with random functions.
#define av_assert0(cond)
assert() equivalent, that is always enabled.
int main(int argc, char **argv)