+9 January 2008: Wouter
+ - fixup openssl RAND problem, when the system is not configured to
+ give entropy, and the rng needs to be seeded. (for 0.7.2)
+
3 December 2007: Wouter
- Fixup building in a subdirectory. (for 0.7.2)
}
int
-ub_initstate(unsigned int ATTR_UNUSED(seed), struct ub_randstate* state,
+ub_initstate(unsigned int seed, struct ub_randstate* state,
unsigned long ATTR_UNUSED(n))
{
state->s = calloc(1, sizeof(*state->s));
/* RAND_ is threadsafe, by the way */
if(!RAND_status()) {
- log_err("Random generator has no entropy (error %ld)",
- ERR_get_error());
- return 0;
+ /* try to seed it */
+ RAND_seed(&seed, (int)sizeof(seed));
+ if(!RAND_status()) {
+ log_err("Random generator has no entropy (error %ld)",
+ ERR_get_error());
+ return 0;
+ }
}
ub_arc4random_stir(state->s);
return 1;