Use nid_list table to lookup curve IDs.
[openssl.git] / ssl / ssl_init.c
index 134aa00d546aae266777f81bb8de18d0c5499518..7d89ed0a60e55349ed1da71f385f1a081784696c 100644 (file)
@@ -294,6 +294,7 @@ static void ssl_library_stop(void)
     }
 }
 
+
 /*
  * If this function is called with a non NULL settings value then it must be
  * called prior to any threads making calls to any OpenSSL functions,
@@ -301,8 +302,20 @@ static void ssl_library_stop(void)
  */
 int OPENSSL_init_ssl(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings)
 {
-    if (stopped)
+    static int stoperrset = 0;
+
+    if (stopped) {
+        if (!stoperrset) {
+            /*
+             * We only ever set this once to avoid getting into an infinite
+             * loop where the error system keeps trying to init and fails so
+             * sets an error etc
+             */
+            stoperrset = 1;
+            SSLerr(SSL_F_OPENSSL_INIT_SSL, ERR_R_INIT_FAIL);
+        }
         return 0;
+    }
 
     if (!OPENSSL_init_crypto(opts | OPENSSL_INIT_ADD_ALL_CIPHERS
                              | OPENSSL_INIT_ADD_ALL_DIGESTS, settings))