From: Tzafrir Cohen Date: Sat, 21 Jan 2017 05:59:15 +0000 (+0200) Subject: tcptls: use TLS_client_method with OpenSSL 1.1 X-Git-Tag: 15.0.0-beta1~364^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bc041ca14afb6b5c786955a03c331dc45924ca92;p=thirdparty%2Fasterisk.git tcptls: use TLS_client_method with OpenSSL 1.1 OpenSSL 1.1 introduced TLS_client_method() and deprecated the previous version-specific methods (such as TLSv1_client_method(). Other than being simpler to use and more correct (gain support for TLS newer that TLS1, in our case), the older ones produce a deprecation warning that fails the build in dev-mode. Change-Id: I257b1c8afd09dcb0d96cda3a41cb9f7a15d0ba07 --- diff --git a/main/tcptls.c b/main/tcptls.c index b20e04ef8c..7f1421db8e 100644 --- a/main/tcptls.c +++ b/main/tcptls.c @@ -324,12 +324,16 @@ static int __ssl_setup(struct ast_tls_config *cfg, int client) cfg->ssl_ctx = SSL_CTX_new(SSLv3_client_method()); } else #endif +#if defined(OPENSSL_VERSION_NUMBER) && (OPENSSL_VERSION_NUMBER >= 0x10100000L) + cfg->ssl_ctx = SSL_CTX_new(TLS_client_method()); +#else if (ast_test_flag(&cfg->flags, AST_SSL_TLSV1_CLIENT)) { cfg->ssl_ctx = SSL_CTX_new(TLSv1_client_method()); } else { disable_ssl = 1; cfg->ssl_ctx = SSL_CTX_new(SSLv23_client_method()); } +#endif } else { disable_ssl = 1; cfg->ssl_ctx = SSL_CTX_new(SSLv23_server_method());