wasphin commented on code in PR #3657:
URL: https://github.com/apache/brpc/pull/3657#discussion_r4378890129
##########
test/brpc_ssl_unittest.cpp:
##########
@@ -88,6 +90,75 @@ class SSLTest : public ::testing::Test{
virtual void TearDown() {};
};
+#ifndef USE_MESALINK
+static void MarkCertificateFreed(void*, void* ptr, CRYPTO_EX_DATA*,
+ int, long, void*) {
+ if (ptr != nullptr) {
+ *static_cast<bool*>(ptr) = true;
+ }
+}
+
+TEST_F(SSLTest, diagnostic_print_releases_peer_certificate) {
+ bool certificate_freed = false;
+ std::unique_ptr<SSL_CTX, decltype(&SSL_CTX_free)> server_ctx(
+ SSL_CTX_new(SSLv23_method()), SSL_CTX_free);
+ std::unique_ptr<SSL_CTX, decltype(&SSL_CTX_free)> client_ctx(
+ SSL_CTX_new(SSLv23_method()), SSL_CTX_free);
Review Comment:
Keeping SSLv23_method() for compatibility with the pre-1.1.0 OpenSSL paths
still present in this codebase. OpenSSL documents that TLS_method() was added
in 1.1.0 and that the old name is mapped to the new one by a preprocessor
macro. I also checked that SSL_CTX_new(SSLv23_method()) compiles with OpenSSL 3
and 4 under -Werror=deprecated-declarations. An unconditional replacement would
require an API unavailable to those older builds. See the [OpenSSL API
history](https://docs.openssl.org/1.1.1/man3/SSL_CTX_new/#history).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]