summaryrefslogtreecommitdiff
path: root/crypto/apr_crypto_openssl.c
diff options
context:
space:
mode:
authorYann Ylavic <ylavic@apache.org>2018-07-24 11:01:59 +0000
committerYann Ylavic <ylavic@apache.org>2018-07-24 11:01:59 +0000
commit05ab1496ca50e93a51325fd12b97e9acfc0b9d14 (patch)
treed2bddc68d0cf0e2be47a270f87cb94085c2e8663 /crypto/apr_crypto_openssl.c
parente699f01c350ebd629f8faa828167cc83ec50fbc4 (diff)
downloadapr-05ab1496ca50e93a51325fd12b97e9acfc0b9d14.tar.gz
crypto: follow up to r1836439: restore apr_crypto_lib_init/term().
Also restores apr_crypto_init()'s global pool in testcrypto to avoid segfaults because of openssl inability to re-init. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1836539 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'crypto/apr_crypto_openssl.c')
-rw-r--r--crypto/apr_crypto_openssl.c27
1 files changed, 3 insertions, 24 deletions
diff --git a/crypto/apr_crypto_openssl.c b/crypto/apr_crypto_openssl.c
index 82b3842f0..5186e6b42 100644
--- a/crypto/apr_crypto_openssl.c
+++ b/crypto/apr_crypto_openssl.c
@@ -34,6 +34,7 @@
#include <openssl/evp.h>
#include <openssl/rand.h>
#include <openssl/engine.h>
+#include <openssl/crypto.h>
#define LOG_PREFIX "apr_crypto_openssl: "
@@ -143,15 +144,7 @@ static apr_status_t crypto_error(const apu_err_t **result,
*/
static apr_status_t crypto_shutdown(void)
{
- ERR_free_strings();
- EVP_cleanup();
- ENGINE_cleanup();
- return APR_SUCCESS;
-}
-
-static apr_status_t crypto_shutdown_helper(void *data)
-{
- return crypto_shutdown();
+ return apr_crypto_lib_term("openssl");
}
/**
@@ -160,21 +153,7 @@ static apr_status_t crypto_shutdown_helper(void *data)
static apr_status_t crypto_init(apr_pool_t *pool, const char *params,
const apu_err_t **result)
{
-#if APR_USE_OPENSSL_PRE_1_1_API
- (void)CRYPTO_malloc_init();
-#else
- OPENSSL_malloc_init();
-#endif
- ERR_load_crypto_strings();
- /* SSL_load_error_strings(); */
- OpenSSL_add_all_algorithms();
- ENGINE_load_builtin_engines();
- ENGINE_register_all_complete();
-
- apr_pool_cleanup_register(pool, pool, crypto_shutdown_helper,
- apr_pool_cleanup_null);
-
- return APR_SUCCESS;
+ return apr_crypto_lib_init("openssl", params, result, pool);
}
#if OPENSSL_VERSION_NUMBER < 0x0090802fL