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>
This commit is contained in:
Matt Caswell
2016-02-10 13:59:15 +00:00
parent 8bd8221be8
commit 0fc32b0718
13 changed files with 50 additions and 24 deletions

View File

@@ -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;
}