The new init functions can now fail so shouldn't be void
[openssl.git] / crypto / init.c
index 3238b8002560c59e69731f2b0a21694856547a41..f01bd4d93f6e11740263a270ca54a489a1303edd 100644 (file)
@@ -626,10 +626,10 @@ static const OPENSSL_INIT_SETTINGS *ossl_init_get_setting(
  * called prior to any threads making calls to any OpenSSL functions,
  * i.e. passing a non-null settings value is assumed to be single-threaded.
  */
  * called prior to any threads making calls to any OpenSSL functions,
  * i.e. passing a non-null settings value is assumed to be single-threaded.
  */
-void OPENSSL_init_crypto(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings)
+int OPENSSL_init_crypto(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings)
 {
 {
-    /* XXX TODO WARNING To be updated to return a value not assert. */
-    assert(!stopped);
+    if (stopped)
+        return 0;
 
     ossl_init_once_run(&base, ossl_init_base);
 
 
     ossl_init_once_run(&base, ossl_init_base);
 
@@ -716,6 +716,8 @@ void OPENSSL_init_crypto(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings)
     if (opts & OPENSSL_INIT_ZLIB) {
         ossl_init_once_run(&zlib, ossl_init_zlib);
     }
     if (opts & OPENSSL_INIT_ZLIB) {
         ossl_init_once_run(&zlib, ossl_init_zlib);
     }
+
+    return 1;
 }
 
 int OPENSSL_atexit(void (*handler)(void))
 }
 
 int OPENSSL_atexit(void (*handler)(void))