Mercurial > irccd
changeset 440:b5338d71730c release-2.1
Fix #652: use TLS_method if available
OpenSSL 1.1 added deprecation warnings on some functions, use more recent
alternatives if available.
Task: #652
author | David Demelier <markand@malikania.fr> |
---|---|
date | Tue, 30 May 2017 12:45:03 +0200 |
parents | ecb6b9342475 |
children | f67540addf5a |
files | libcommon/irccd/net.hpp |
diffstat | 1 files changed, 11 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/libcommon/irccd/net.hpp Wed Apr 12 15:18:10 2017 +0200 +++ b/libcommon/irccd/net.hpp Tue May 30 12:45:03 2017 +0200 @@ -502,6 +502,7 @@ #include <openssl/err.h> #include <openssl/evp.h> #include <openssl/ssl.h> +#include <openssl/opensslv.h> #endif // !NET_NO_SSL @@ -609,6 +610,14 @@ # include <poll.h> #endif +#if !defined(NET_NO_SSL) +# if OPENSSL_VERSION_NUMBER >= 0x10100000L +# define NET_SSL_DEFAULT_METHOD TLS_method +# else +# define NET_SSL_DEFAULT_METHOD TLSv1_method +# endif +#endif + namespace irccd { /** @@ -2125,7 +2134,7 @@ * \param mode the mode * \param method the method */ - TlsSocket(TcpSocket &&sock, Mode mode = Server, const SSL_METHOD *method = TLSv1_method()) + TlsSocket(TcpSocket &&sock, Mode mode = Server, const SSL_METHOD *method = NET_SSL_DEFAULT_METHOD()) : Socket(std::move(sock)) , m_mustclose(true) { @@ -2141,7 +2150,7 @@ * \param mode the mode * \param method the method */ - TlsSocket(TcpSocket &sock, Mode mode = Server, const SSL_METHOD *method = TLSv1_method()) + TlsSocket(TcpSocket &sock, Mode mode = Server, const SSL_METHOD *method = NET_SSL_DEFAULT_METHOD()) : Socket(sock.handle()) { create(mode, method);