1.1.1b crash (RUN_ONCE problem?)

Norm Green norm.green at gemtalksystems.com
Fri Mar 1 19:16:52 UTC 2019


I'm debugging a failure in a debug build on Solaris SPARC in the below 
code in rand_lib.c.  On line 744, rand_meth_lock is NULL, which suggests 
the RUN_ONCE code is not working.  Wondering if anyone else has seen 
this problem?
We did not see this issue in 1.1.1a.  Perhaps changes in the RUN_ONCE 
code in this commit are responsible? 
https://github.com/openssl/openssl/commit/f725fe5b4b6504df08e30f5194d321c3025e2336



737 const RAND_METHOD *RAND_get_rand_method(void)
738 {
739     const RAND_METHOD *tmp_meth = NULL;
740
741     if (!RUN_ONCE(&rand_init, do_rand_init))
742         return NULL;
743
744     CRYPTO_THREAD_write_lock(rand_meth_lock);
745     if (default_RAND_meth == NULL) {
746 #ifndef OPENSSL_NO_ENGINE
747         ENGINE *e;
748
749         /* If we have an engine that can do RAND, use it. */
750         if ((e = ENGINE_get_default_RAND()) != NULL
751                 && (tmp_meth = ENGINE_get_RAND(e)) != NULL) {
752             funct_ref = e;
753             default_RAND_meth = tmp_meth;
754         } else {
755             ENGINE_finish(e);
756             default_RAND_meth = &rand_meth;
757         }
758 #else
759         default_RAND_meth = &rand_meth;
760 #endif
761     }
762     tmp_meth = default_RAND_meth;
763     CRYPTO_THREAD_unlock(rand_meth_lock);
764     return tmp_meth;
765 }



More information about the openssl-users mailing list