Repository navigation
fix(tls): gate pre-1.1.0 OpenSSL deprecated APIs for OpenSSL 4.0 readiness - #388
Merged
fcostaoliveira merged 1 commit intoMay 25, 2026
Merged
Conversation
OpenSSL 4.0 is on track to remove a number of APIs that were deprecated back in 1.1.0. memtier was still calling six of them unconditionally: - SSLv23_client_method() - SSL_library_init() - SSL_load_error_strings() - CRYPTO_set_id_callback() / CRYPTO_set_locking_callback() - CRYPTO_num_locks() Against modern OpenSSL these emit deprecation warnings; against OpenSSL 4.0 (or any distro that adds -Werror=deprecated-declarations downstream, as Redis does) the build will fail outright. The library has handled internal locking automatically since 1.1.0, and SSL_library_init / SSL_load_error_strings are no-op since the same release. Gate the legacy locking and init path behind OPENSSL_VERSION_NUMBER < 0x10100000L (matching the existing OPENSSL_config / OPENSSL_init_crypto gate that was already in this file) and switch SSLv23_client_method to TLS_client_method on 1.1.0+. Verified clean build with CXXFLAGS="-O2 -g -Wall \ -Werror=deprecated-declarations". Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
paulorsousa
approved these changes
May 25, 2026
3 tasks
fcostaoliveira
added a commit
that referenced
this pull request
Jun 2, 2026
…nSSL 4.0 compat) (#432) * fix(tls): replace SSL_OP_NO_TLSv1/1_1 with set_min_proto_version (OpenSSL 4.0 compat) SSL_OP_NO_TLSv1 and SSL_OP_NO_TLSv1_1 are absent from the OpenSSL 4.0 public API. PR #388 covered the threading/init deprecations but missed these two flags, so master would fail to build against OpenSSL 4.0. SSL_CTX_set_min_proto_version / SSL_CTX_set_max_proto_version are semantically equivalent (enforcing the user-requested protocol range) and are available since OpenSSL 1.1.0. SSL_OP_NO_TLSv1_2 (also removed in 4.0) is covered by the same guard. Falls back to SSL_OP_NO_TLSv* on pre-1.1.0 toolchains. Refs: 2.4 review finding #17 Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * fix(tls): mask protocol gaps inside min/max range under OpenSSL >= 1.1.0 Bugbot flagged that the min/max approach allowed intermediate protocols the user explicitly omitted (e.g. --tls-protocols "tlsv1,tlsv1.2" enabled tlsv1.1). Combines envelope clamp (set_min/max_proto_version) with per-gap SSL_OP_NO_TLSv1_x masks, guarded by #ifdef so OpenSSL 4.0 (which may remove the symbols entirely) still builds. For 4.0 the gap-mask is silently skipped: removing those symbols means the runtime can't individually disable them anyway, which matches OpenSSL's intended deprecation policy. Refs: bugbot MED review on PR #432 Co-Authored-By: Claude Sonnet 4.6 <[email protected]> --------- Co-authored-by: Claude Sonnet 4.6 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #387.
OpenSSL 4.0 is on track to remove a number of APIs that were deprecated back in 1.1.0. memtier still called six of them unconditionally —
SSLv23_client_method(),SSL_library_init(),SSL_load_error_strings(),CRYPTO_set_id_callback(),CRYPTO_set_locking_callback(),CRYPTO_num_locks(). Against modern OpenSSL these emit deprecation warnings; against OpenSSL 4.0 (or any distro that adds-Werror=deprecated-declarationsdownstream, as Redis does — see redis/redis#15221) the build will fail outright.Gate the legacy locking-callback and init paths behind
OPENSSL_VERSION_NUMBER < 0x10100000L— matching the existingOPENSSL_config/OPENSSL_init_cryptogate that was already in this file — and switchSSLv23_client_method→TLS_client_methodon 1.1.0+.The library has handled internal locking automatically since 1.1.0, and
SSL_library_init/SSL_load_error_stringsare no-ops since the same release, so dropping them on the modern path is a true no-op functionally.Why this matters
-Werror=deprecated-declarations: hard build failure.-Werror.Verification
Built locally with stricter flags to confirm the deprecation surface is gone:
make clean CXXFLAGS="-O2 -g -Wall -Werror=deprecated-declarations" make -j4→ build succeeds (only the pre-existing unrelated
statsd.cpp-Wformat-truncationwarning remains).Test plan
-Werror=deprecated-declarations🤖 Generated with Claude Code
Note
Low Risk
Low risk: changes are compile-time gated and primarily affect build compatibility with OpenSSL 1.1.0+ / 4.0 deprecations, with minimal runtime behavior impact beyond TLS context method selection.
Overview
Improves OpenSSL 1.1.0+ / 4.0 build compatibility for TLS builds. The legacy OpenSSL thread-locking callbacks and deprecated init calls are now compiled only for
OPENSSL_VERSION_NUMBER < 0x10100000L, while newer versions useOPENSSL_init_crypto.For TLS context creation, OpenSSL 1.1.0+ switches from
SSLv23_client_method()toTLS_client_method(), keeping the older method on pre-1.1.0.Reviewed by Cursor Bugbot for commit b3178a6. Bugbot is set up for automated code reviews on this repo. Configure here.