aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/init.c
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2016-02-10 13:59:15 +0000
committerMatt Caswell <matt@openssl.org>2016-02-10 17:40:59 +0000
commit0fc32b0718ec210e03b6d8623d4819ed04615a1b (patch)
tree9491a02a740d05b415790bcfeb16eb65f6a06267 /crypto/init.c
parent8bd8221be80708825ddb9771d4c9fff67860119b (diff)
downloadopenssl-0fc32b0718ec210e03b6d8623d4819ed04615a1b.tar.gz
The new init functions can now fail so shouldn't be void
The new init functions can fail if the library has already been stopped. We should be able to indicate failure with a 0 return value. Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'crypto/init.c')
-rw-r--r--crypto/init.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/crypto/init.c b/crypto/init.c
index 3238b80025..f01bd4d93f 100644
--- a/crypto/init.c
+++ b/crypto/init.c
@@ -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.
*/
-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);
@@ -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);
}
+
+ return 1;
}
int OPENSSL_atexit(void (*handler)(void))