From 41b8d490f6dc80b10af4eaa3332749f4fb52d2d2 Mon Sep 17 00:00:00 2001 From: Steve Bennett Date: Sat, 24 Nov 2018 11:24:44 +1000 Subject: aio: Prefer TLS_method() over TLSv1_2_method() To avoid a deprecation warning Signed-off-by: Steve Bennett --- auto.def | 4 ++++ jim-aio.c | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/auto.def b/auto.def index fc937ff..ead60aa 100644 --- a/auto.def +++ b/auto.def @@ -284,6 +284,10 @@ if {[opt-bool-or-full ssl]} { user-error "SSL support requires OpenSSL" } } + # Later versions deprecate TLSv1_2_method, but older versions don't have TLS_method + if {![cc-check-function-in-lib TLS_method ssl]} { + define-append CCOPTS -DUSE_TLSv1_2_method + } } if {[opt-bool-or-full lineedit]} { if {([cc-check-includes termios.h] && [have-feature isatty]) || [have-feature winconsole]} { diff --git a/jim-aio.c b/jim-aio.c index 589dce6..ce37e3b 100644 --- a/jim-aio.c +++ b/jim-aio.c @@ -1636,13 +1636,17 @@ static void JimAioSslContextDelProc(struct Jim_Interp *interp, void *privData) ERR_free_strings(); } +#ifdef USE_TLSv1_2_method +#define TLS_method TLSv1_2_method +#endif + static SSL_CTX *JimAioSslCtx(Jim_Interp *interp) { SSL_CTX *ssl_ctx = (SSL_CTX *)Jim_GetAssocData(interp, "ssl_ctx"); if (ssl_ctx == NULL) { SSL_load_error_strings(); SSL_library_init(); - ssl_ctx = SSL_CTX_new(TLSv1_2_method()); + ssl_ctx = SSL_CTX_new(TLS_method()); if (ssl_ctx && SSL_CTX_set_default_verify_paths(ssl_ctx)) { SSL_CTX_set_verify(ssl_ctx, SSL_VERIFY_NONE, NULL); Jim_SetAssocData(interp, "ssl_ctx", JimAioSslContextDelProc, ssl_ctx); -- cgit v1.1