Bug #4579 » ossl_rand2.patch
| ext/openssl/ossl_rand.c (working copy) | ||
|---|---|---|
|
return RAND_status() ? Qtrue : Qfalse;
|
||
|
}
|
||
|
static void
|
||
|
ossl_rand_cleanup(void)
|
||
|
{
|
||
|
char rand[16];
|
||
|
RAND_bytes(rand, 16);
|
||
|
RAND_cleanup();
|
||
|
RAND_seed(rand, 16);
|
||
|
}
|
||
|
#define DEFMETH(class, name, func, argc) \
|
||
|
rb_define_method((class), (name), (func), (argc)); \
|
||
|
rb_define_singleton_method((class), (name), (func), (argc));
|
||
| ... | ... | |
|
DEFMETH(mRandom, "pseudo_bytes", ossl_rand_pseudo_bytes, 1);
|
||
|
DEFMETH(mRandom, "egd", ossl_rand_egd, 1);
|
||
|
DEFMETH(mRandom, "egd_bytes", ossl_rand_egd_bytes, 2);
|
||
|
DEFMETH(mRandom, "status?", ossl_rand_status, 0)
|
||
|
DEFMETH(mRandom, "status?", ossl_rand_status, 0);
|
||
|
pthread_atfork(NULL, NULL, ossl_rand_cleanup);
|
||
|
}
|
||