From e1e78ba5834fc30c80d213278196c47edfba0a15 Mon Sep 17 00:00:00 2001 From: David Nichols Date: Wed, 6 Jul 2022 07:56:29 +0200 Subject: [PATCH] refs #4553 fixed a bug building with openssl 3+ that could cause a runtime crash when encryption is used --- doxygen/lang/900_release_notes.dox.tmpl | 2 ++ include/qore/common.h | 2 +- include/qore/intern/QoreLibIntern.h | 4 +++- include/qore/intern/ql_crypto.h | 4 ++-- include/qore/vector_set | 2 +- 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/doxygen/lang/900_release_notes.dox.tmpl b/doxygen/lang/900_release_notes.dox.tmpl index 71df502452..4f2b27c705 100644 --- a/doxygen/lang/900_release_notes.dox.tmpl +++ b/doxygen/lang/900_release_notes.dox.tmpl @@ -11,6 +11,8 @@ - WebUtil module updates: - fixed a bug where files outside the root directory could be served with specially-formatted requests (issue 4550) + - fixed a bug building with openssl 3+ that could cause a runtime crash when encryption is used + (issue 4553) - fixed a bug where it was not possible to set the minimum TLS level to v1.3 for encrypted connections (issue 4551) diff --git a/include/qore/common.h b/include/qore/common.h index 780c96758b..e0005e2b2f 100644 --- a/include/qore/common.h +++ b/include/qore/common.h @@ -165,7 +165,7 @@ typedef std::vector> const_vec_t; //! functor template for calling free() on pointers -template struct free_ptr : std::unary_function { +template struct free_ptr { DLLLOCAL void operator()(T* ptr) { free(ptr); } diff --git a/include/qore/intern/QoreLibIntern.h b/include/qore/intern/QoreLibIntern.h index 357d7641f7..615c1771a8 100644 --- a/include/qore/intern/QoreLibIntern.h +++ b/include/qore/intern/QoreLibIntern.h @@ -39,7 +39,9 @@ #include #include -#ifdef HAVE_EVP_MAC_CTX_NEW +#include + +#if defined(OPENSSL_VERSION_MAJOR) && OPENSSL_VERSION_MAJOR >= 3 #define OPENSSL_3_PLUS #endif diff --git a/include/qore/intern/ql_crypto.h b/include/qore/intern/ql_crypto.h index 0d007898dd..a7a71072d4 100644 --- a/include/qore/intern/ql_crypto.h +++ b/include/qore/intern/ql_crypto.h @@ -225,7 +225,7 @@ class DigestHelper : public BaseHelper { } }; -#ifndef OPENSSL_3_PLUS +#if !defined(OPENSSL_VERSION_MAJOR) || OPENSSL_VERSION_MAJOR < 3 class QoreHmacHelper { public: DLLLOCAL QoreHmacHelper() { @@ -242,7 +242,7 @@ class QoreHmacHelper { #else HMAC_CTX_cleanup(&ctx); #endif -} + } DLLLOCAL HMAC_CTX* operator*() { #ifdef HAVE_OPENSSL_INIT_CRYPTO diff --git a/include/qore/vector_set b/include/qore/vector_set index 370d9fe00d..037c6bec41 100644 --- a/include/qore/vector_set +++ b/include/qore/vector_set @@ -47,7 +47,7 @@ #include #include -struct string_compare : public std::unary_function { +struct string_compare { DLLLOCAL explicit string_compare(const char* const& baseline) : baseline(baseline) { }