From 122bf144cfe812e3aae179b3a79232045605eda9 Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Mon, 14 Nov 2016 02:17:38 +0300 Subject: [PATCH 1/3] le-proxy: fix building under openssl 1.1 (init functions has been deprecated) Refs: #397 --- sample/le-proxy.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sample/le-proxy.c b/sample/le-proxy.c index 30e0a5f6..4a5177f7 100644 --- a/sample/le-proxy.c +++ b/sample/le-proxy.c @@ -258,10 +258,12 @@ main(int argc, char **argv) if (use_ssl) { int r; +#if OPENSSL_VERSION_NUMBER < 0x10100000L SSL_library_init(); ERR_load_crypto_strings(); SSL_load_error_strings(); OpenSSL_add_all_algorithms(); +#endif r = RAND_poll(); if (r == 0) { fprintf(stderr, "RAND_poll() failed.\n"); From 532a47ce1e67f6a7f8d5b1ff1031fe7fecc546e1 Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Mon, 14 Nov 2016 02:17:51 +0300 Subject: [PATCH 2/3] test: fix building under openssl 1.1 (init functions has been deprecated) Refs: #397 --- test/regress_ssl.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/regress_ssl.c b/test/regress_ssl.c index 2cec5a90..8a5524a8 100644 --- a/test/regress_ssl.c +++ b/test/regress_ssl.c @@ -186,6 +186,7 @@ get_ssl_ctx(void) void init_ssl(void) { +#if OPENSSL_VERSION_NUMBER < 0x10100000L SSL_library_init(); ERR_load_crypto_strings(); SSL_load_error_strings(); @@ -193,6 +194,7 @@ init_ssl(void) if (SSLeay() != OPENSSL_VERSION_NUMBER) { TT_DECLARE("WARN", ("Version mismatch for openssl: compiled with %lx but running with %lx", (unsigned long)OPENSSL_VERSION_NUMBER, (unsigned long) SSLeay())); } +#endif } /* ==================== From fa58cb1da0fe9e5342d2ad486277184ec3db068b Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Wed, 16 Nov 2016 01:16:30 +0300 Subject: [PATCH 3/3] sample/le-proxy: use TLS_method instead of SSLv23_method (latest deprecated) --- openssl-compat.h | 4 +++- sample/le-proxy.c | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/openssl-compat.h b/openssl-compat.h index 628f5661..69afc716 100644 --- a/openssl-compat.h +++ b/openssl-compat.h @@ -3,7 +3,7 @@ #if OPENSSL_VERSION_NUMBER < 0x10100000L -static BIO_METHOD *BIO_meth_new(int type, const char *name) +static inline BIO_METHOD *BIO_meth_new(int type, const char *name) { BIO_METHOD *biom = calloc(1, sizeof(BIO_METHOD)); @@ -28,6 +28,8 @@ static BIO_METHOD *BIO_meth_new(int type, const char *name) #define BIO_get_data(b) (b)->ptr #define BIO_get_shutdown(b) (b)->shutdown +#define TLS_method SSLv23_method + #endif /* OPENSSL_VERSION_NUMBER < 0x10100000L */ #endif /* OPENSSL_COMPAT_H */ diff --git a/sample/le-proxy.c b/sample/le-proxy.c index 4a5177f7..8d9b529e 100644 --- a/sample/le-proxy.c +++ b/sample/le-proxy.c @@ -33,6 +33,7 @@ #include #include #include +#include "openssl-compat.h" static struct event_base *base; static struct sockaddr_storage listen_on_addr; @@ -269,7 +270,7 @@ main(int argc, char **argv) fprintf(stderr, "RAND_poll() failed.\n"); return 1; } - ssl_ctx = SSL_CTX_new(SSLv23_method()); + ssl_ctx = SSL_CTX_new(TLS_method()); } listener = evconnlistener_new_bind(base, accept_cb, NULL,