OpenSSL: Do not use library init/deinit functions with 1.1.0

SSL_library_init() does not work properly after EVP_cleanup() starting
from OpenSSL 1.1.0 pre release 3. The automated library init/deinit
functions in that pre release are supposed to handle all initialization
and deinitialiation, so comment out the explicit calls to these function
with OpenSSL 1.1.0 and newer.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
Jouni Malinen 2016-02-16 00:35:34 +02:00 committed by Jouni Malinen
parent 0f09637001
commit 29bc76e3d3

View file

@ -900,6 +900,7 @@ void * tls_init(const struct tls_config *conf)
} }
#endif /* OPENSSL_FIPS */ #endif /* OPENSSL_FIPS */
#endif /* CONFIG_FIPS */ #endif /* CONFIG_FIPS */
#if OPENSSL_VERSION_NUMBER < 0x10100000L
SSL_load_error_strings(); SSL_load_error_strings();
SSL_library_init(); SSL_library_init();
#ifndef OPENSSL_NO_SHA256 #ifndef OPENSSL_NO_SHA256
@ -921,6 +922,7 @@ void * tls_init(const struct tls_config *conf)
#endif /* OPENSSL_NO_RC2 */ #endif /* OPENSSL_NO_RC2 */
PKCS12_PBE_add(); PKCS12_PBE_add();
#endif /* PKCS12_FUNCS */ #endif /* PKCS12_FUNCS */
#endif /* < 1.1.0 */
} else { } else {
context = tls_context_new(conf); context = tls_context_new(conf);
if (context == NULL) if (context == NULL)
@ -1022,6 +1024,7 @@ void tls_deinit(void *ssl_ctx)
tls_openssl_ref_count--; tls_openssl_ref_count--;
if (tls_openssl_ref_count == 0) { if (tls_openssl_ref_count == 0) {
#if OPENSSL_VERSION_NUMBER < 0x10100000L
#ifndef OPENSSL_NO_ENGINE #ifndef OPENSSL_NO_ENGINE
ENGINE_cleanup(); ENGINE_cleanup();
#endif /* OPENSSL_NO_ENGINE */ #endif /* OPENSSL_NO_ENGINE */
@ -1029,6 +1032,7 @@ void tls_deinit(void *ssl_ctx)
ERR_remove_thread_state(NULL); ERR_remove_thread_state(NULL);
ERR_free_strings(); ERR_free_strings();
EVP_cleanup(); EVP_cleanup();
#endif /* < 1.1.0 */
os_free(tls_global->ocsp_stapling_response); os_free(tls_global->ocsp_stapling_response);
tls_global->ocsp_stapling_response = NULL; tls_global->ocsp_stapling_response = NULL;
os_free(tls_global); os_free(tls_global);