Index: ext/openssl/ossl_rand.c =================================================================== --- ext/openssl/ossl_rand.c (revision 31272) +++ ext/openssl/ossl_rand.c (working copy) @@ -171,6 +171,16 @@ 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)); @@ -197,6 +207,8 @@ 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); }