OPENSSL_init_crypto(): check config return code correctly
authorRichard Levitte <levitte@openssl.org>
Fri, 5 Apr 2019 08:28:32 +0000 (10:28 +0200)
committerRichard Levitte <levitte@openssl.org>
Fri, 5 Apr 2019 09:32:07 +0000 (11:32 +0200)
It was assumed that the config functionality returned a boolean.
However, it may return a negative number on error, so we need to take
that into account.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/8679)

crypto/init.c

index 463da9853dd56092066c6de6d96f4ae286018335..43fe1a6e1bb4af71d393c95a2cff7a42f695fe1f 100644 (file)
@@ -670,7 +670,7 @@ int OPENSSL_init_crypto(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings)
         ret = RUN_ONCE(&config, ossl_init_config);
         conf_settings = NULL;
         CRYPTO_THREAD_unlock(init_lock);
-        if (!ret)
+        if (ret <= 0)
             return 0;
     }