THRIFT-6170: Fix TSSLSocket build with OpenSSL 4.0 - #3752
Conversation
03d0ac3 to
af482d1
Compare
af482d1 to
29e962e
Compare
|
This branch has conflicts that must be resolved |
|
Is it expected that SecurityTest and SecurityFromBufferTest both hang/timeout with OpenSSL 4.0.2 and the test expectations will be changed in a future pull request?
|
OpenSSL 4.0 removes SSLv3_method(), per-version TLS method functions, ERR_remove_state(), ASN1_STRING_data(), and returns const pointers from X509 accessor functions. Fix both C++ and C GLib bindings. Upstream-Status: Submitted [apache/thrift#3752] Signed-off-by: Jaipaul Cheernam <jaipaul.cheernam@est.tech> Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
OpenSSL 4.0 removes SSLv3_method(), per-version TLS method functions, ERR_remove_state(), ASN1_STRING_data(), and returns const pointers from X509 accessor functions. C++ (TSSLSocket.cpp): - Remove ERR_remove_state() calls (no-op since OpenSSL 1.1) - Guard SSLv3_method with version check - Use TLS_method() + SSL_CTX_set_min/max_proto_version() for TLSv1.0/1.1/1.2 on OpenSSL 4.0 (per-version methods removed) - Replace ASN1_STRING_data with ASN1_STRING_get0_data - Add const qualifiers for X509_NAME, X509_NAME_ENTRY, ASN1_STRING C (thrift_ssl_socket.c): - Remove ERR_remove_state() calls - Guard SSLv3 and TLS version methods with version check Signed-off-by: Jaipaul Cheernam <jaipaul.cheernam@est.tech>
29e962e to
e949922
Compare
Done. rebased and please check |
Thanks for the feedback! Updated the PR:
I haven't been able to run the SecurityTest/SecurityFromBufferTest locally — if there are still test timeouts, happy to iterate. |
|
Thank you for working on this. There are still timeouts which I was able to fix with: --- a/lib/cpp/test/SecurityFromBufferTest.cpp
+++ b/lib/cpp/test/SecurityFromBufferTest.cpp
@@ -229,7 +229,7 @@ BOOST_AUTO_TEST_CASE(ssl_security_matrix) {
continue;
}
-#ifdef OPENSSL_NO_SSL3
+#if defined(OPENSSL_NO_SSL3) || OPENSSL_VERSION_NUMBER >= 0x40000000L
if (si == 2 || ci == 2) {
// Skip all SSLv3 cases - protocol not supported
continue;
diff --git a/lib/cpp/test/SecurityTest.cpp b/lib/cpp/test/SecurityTest.cpp
index 86640bd68..b133ef0f8 100644
--- a/lib/cpp/test/SecurityTest.cpp
+++ b/lib/cpp/test/SecurityTest.cpp
@@ -357,7 +357,7 @@ BOOST_AUTO_TEST_CASE(ssl_security_matrix)
continue;
}
-#ifdef OPENSSL_NO_SSL3
+#if defined(OPENSSL_NO_SSL3) || OPENSSL_VERSION_NUMBER >= 0x40000000L
if (si == 2 || ci == 2)
{
// Skip all SSLv3 cases - protocol not supportedAll tests then pass for C and C++ however I believe that is due to lack of coverage in testtransportsslsocket.c compared to SecurityTest.cpp for SSLv3/TLSv1_0/TLSv1_1. I think the C code needs SSL_CTX_set_min_proto_version() / SSL_CTX_set_max_proto_version() to match the C++ code. |
OpenSSL 4.0 removes SSLv3_method() and per-version TLS method functions (TLSv1_method, TLSv1_1_method, TLSv1_2_method), the deprecated ASN1_STRING_data() function, and returns const pointers from X509_get_subject_name(), X509_NAME_get_entry(), and X509_NAME_ENTRY_get_data().
This is backward-compatible with OpenSSL >= 1.1.0 since all replacement APIs exist since that version.
[skip ci]anywhere in the commit message to free up build resources.