From a4fb8ed1f2969a79f2965b49a6f0e45536f01795 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Thu, 19 Jan 2017 16:50:25 +0100 Subject: [PATCH] BUILD: ssl: silence a warning reported for ERR_remove_state() In 1.0.0, this function was replaced with ERR_remove_thread_state(). As of openssl 1.1.0, both are now deprecated and do nothing at all. Thus we simply make this call do nothing in 1.1.0 to silence the warning. The change was tested with 0.9.8, 1.0.0, 1.0.1, 1.0.2 and 1.1.0. This kills the following warning on 1.1.0 : src/ssl_sock.c:7266:9: warning: 'ERR_remove_state' is deprecated (declared at /dev/shm/openssl-1.1.0b/include/openssl/err.h:247) [-Wdeprecated-declarations] This fix should be backported to 1.7. --- include/proto/openssl-compat.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/proto/openssl-compat.h b/include/proto/openssl-compat.h index e2154f7ef..0194eaa67 100644 --- a/include/proto/openssl-compat.h +++ b/include/proto/openssl-compat.h @@ -161,4 +161,14 @@ static inline int EVP_PKEY_base_id(EVP_PKEY *pkey) } #endif +/* ERR_remove_state() was deprecated in 1.0.0 in favor of + * ERR_remove_thread_state(), which was in turn deprecated in + * 1.1.0 and does nothing anymore. Let's simply silently kill + * it. + */ +#if (OPENSSL_VERSION_NUMBER >= 0x1010000fL) +#undef ERR_remove_state +#define ERR_remove_state(x) +#endif + #endif /* _PROTO_OPENSSL_COMPAT_H */