Skip to content

Fix rfc2818_verification build failure on Windows with Boost 1.83.0 and OpenSSL 3.x [HZ-5424]#1464

Open
ihsandemir wants to merge 1 commit into
hazelcast:masterfrom
ihsandemir:fix/rfc2818-openssl3-boost-1_83
Open

Fix rfc2818_verification build failure on Windows with Boost 1.83.0 and OpenSSL 3.x [HZ-5424]#1464
ihsandemir wants to merge 1 commit into
hazelcast:masterfrom
ihsandemir:fix/rfc2818-openssl3-boost-1_83

Conversation

@ihsandemir
Copy link
Copy Markdown
Collaborator

Closes #1463

Summary

  • The Boost 1.83.0 + OpenSSL 3.x matrix entry of the nightly-Windows workflow fails to compile rfc2818_verification.ipp: error C2027: use of undefined type 'asn1_string_st' (followed by a cascading C2660 on memcmp).
  • The client never references boost::asio::ssl::rfc2818_verification; it uses the modern host_name_verification (hazelcast/src/hazelcast/util/util.cpp). The broken .ipp was being dragged in transitively through the umbrella <boost/asio/ssl.hpp> include in three internal socket headers.
  • Replaced the umbrella include in BaseSocket.h, SSLSocket.h, and SocketFactory.h with the specific subheaders the codebase actually uses (context.hpp, error.hpp, host_name_verification.hpp, stream.hpp) — matching the include pattern already used in util.cpp. This avoids rfc2818_verification.hpp entirely.

Root cause

In Boost 1.83.0, <boost/asio/ssl.hpp> lists <boost/asio/ssl/rfc2818_verification.hpp> among its includes. In Boost.Asio's default header-only mode that pulls in rfc2818_verification.ipp, whose hostname-matching code dereferences ASN1_STRING fields directly (domain->data, domain->length). OpenSSL 3.0 made ASN1_STRING an opaque type whose layout is no longer exposed by the public headers, so MSVC refuses to compile the field accesses (hence C2027; the C2660 is a follow-on because domain->data collapses to a non-pointer expression). GCC/Clang on Linux/macOS happen to accept the opaque-struct dereference more leniently on this path, which is why only the Windows + MSVC + OpenSSL 3.x combination breaks.

Upstream Boost dropped rfc2818_verification from <boost/asio/ssl.hpp> after 1.83.0; it is no longer present in 1.90.0. That is why only the 1.83.0 matrix entry is affected.

Test plan

  • Local build of the hazelcast-cpp-client library with HZ_BUILD_WITH_SSL=ON succeeds on macOS arm64 (vcpkg toolchain, Boost 1.90.0, OpenSSL 3.x).
  • Local build of the client_test binary with HZ_BUILD_WITH_SSL=ON succeeds (all boost::asio::ssl::context / verify_peer / verify_callback uses in test files compile cleanly).
  • CI nightly-Windows workflow with msvc-latest_boost_1830 + with_openssl: ON now compiles (verified by re-running the workflow on this branch).
  • CI nightly-Windows workflow with msvc-latest_boost_1900 + with_openssl: ON still compiles (no regression).
  • CI build-pr Windows / Ubuntu / macOS matrices remain green.

Tracking: HZ-5424

…nd OpenSSL 3.x [HZ-5424]

Boost 1.83.0's umbrella <boost/asio/ssl.hpp> transitively includes
<boost/asio/ssl/rfc2818_verification.hpp>. In Boost.Asio's default
header-only mode that pulls in rfc2818_verification.ipp, whose
hostname-matching code dereferences ASN1_STRING fields directly
(domain->data, domain->length). OpenSSL 3.x made ASN1_STRING opaque
and MSVC rejects the field accesses, breaking the Windows build with
errors C2027 (use of undefined type 'asn1_string_st') and C2660
(memcmp argument list mismatch).

The client never uses rfc2818_verification; it uses the modern
host_name_verification instead (see util.cpp). Replace the umbrella
<boost/asio/ssl.hpp> include with the specific subheaders we actually
need in the three internal socket headers that pulled it in. This
sidesteps rfc2818_verification.hpp entirely and matches the include
pattern already used in util.cpp.

Boost removed rfc2818_verification from <boost/asio/ssl.hpp> after
1.83.0, which is why the Boost 1.90.0 matrix entry was unaffected.
@ihsandemir ihsandemir self-assigned this May 22, 2026
@ihsandemir ihsandemir requested a review from JackPGreen May 22, 2026 08:17
@ihsandemir ihsandemir added this to the 5.7.0 milestone May 22, 2026
#include <boost/lockfree/queue.hpp>
#ifdef HZ_BUILD_WITH_SSL
#include <boost/asio/ssl.hpp>
// Avoid <boost/asio/ssl.hpp> because in Boost <= 1.83 it transitively
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we bump the min supported boost version instead?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows build with Boost 1.83.0 and OpenSSL 3.x fails: undefined type 'asn1_string_st' in rfc2818_verification.ipp

2 participants