diff options
author | Matt Caswell <matt@openssl.org> | 2016-02-10 13:59:15 +0000 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2016-02-10 17:40:59 +0000 |
commit | 0fc32b0718ec210e03b6d8623d4819ed04615a1b (patch) | |
tree | 9491a02a740d05b415790bcfeb16eb65f6a06267 /crypto/async | |
parent | 8bd8221be80708825ddb9771d4c9fff67860119b (diff) |
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/async')
-rw-r--r-- | crypto/async/async.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/crypto/async/async.c b/crypto/async/async.c index db511442ba..af9da35f99 100644 --- a/crypto/async/async.c +++ b/crypto/async/async.c @@ -97,7 +97,8 @@ err: static async_ctx *async_get_ctx(void) { - OPENSSL_init_crypto(OPENSSL_INIT_ASYNC, NULL); + if (!OPENSSL_init_crypto(OPENSSL_INIT_ASYNC, NULL)) + return NULL; return async_arch_get_ctx(); } @@ -361,9 +362,12 @@ int ASYNC_init_thread(size_t max_size, size_t init_size) return 0; } - OPENSSL_init_crypto(OPENSSL_INIT_ASYNC, NULL); + if (!OPENSSL_init_crypto(OPENSSL_INIT_ASYNC, NULL)) { + ASYNCerr(ASYNC_F_ASYNC_INIT_THREAD, ERR_R_NOT_INITED); + return 0; + } if (!ossl_init_thread_start(OPENSSL_INIT_THREAD_ASYNC)) { - ASYNCerr(ASYNC_F_ASYNC_INIT_THREAD, ERR_R_MALLOC_FAILURE); + ASYNCerr(ASYNC_F_ASYNC_INIT_THREAD, ERR_R_NOT_INITED); return 0; } |