From 2322a9dbd03de284acca388119f00a9bc7d9bec2 Mon Sep 17 00:00:00 2001 From: Nick Peng Date: Tue, 21 Jan 2020 22:48:02 +0800 Subject: [PATCH] ssl: Stop using deprecated Openssl APIs, by neheb. --- src/smartdns.c | 6 ++++-- src/util.c | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/smartdns.c b/src/smartdns.c index 3a915a9..4a4397b 100644 --- a/src/smartdns.c +++ b/src/smartdns.c @@ -222,20 +222,22 @@ static int _smartdns_set_ecs_ip(void) static int _smartdns_init_ssl(void) { +#if OPENSSL_API_COMPAT < 0x10100000L SSL_load_error_strings(); SSL_library_init(); OpenSSL_add_all_algorithms(); SSL_CRYPTO_thread_setup(); - +#endif return 0; } static int _smartdns_destroy_ssl(void) { +#if OPENSSL_API_COMPAT < 0x10100000L SSL_CRYPTO_thread_cleanup(); ERR_free_strings(); EVP_cleanup(); - +#endif return 0; } diff --git a/src/util.c b/src/util.c index f26ec77..63a1723 100644 --- a/src/util.c +++ b/src/util.c @@ -687,6 +687,7 @@ errout: return -1; } +#if OPENSSL_API_COMPAT < 0x10100000 #define THREAD_STACK_SIZE (16 * 1024) static pthread_mutex_t *lock_cs; static long *lock_count; @@ -743,6 +744,7 @@ void SSL_CRYPTO_thread_cleanup(void) OPENSSL_free(lock_cs); OPENSSL_free(lock_count); } +#endif #define SERVER_NAME_LEN 256 #define TLS_HEADER_LEN 5