loqs commented on code in PR #3752:
URL: https://github.com/apache/thrift/pull/3752#discussion_r3952908703
##########
lib/cpp/src/thrift/transport/TSSLSocket.cpp:
##########
@@ -182,16 +179,26 @@ static char uppercase(char c);
SSLContext::SSLContext(const SSLProtocol& protocol) {
if (protocol == SSLTLS) {
ctx_ = SSL_CTX_new(SSLv23_method());
-#ifndef OPENSSL_NO_SSL3
+#if !defined(OPENSSL_NO_SSL3) && OPENSSL_VERSION_NUMBER < 0x40000000L
} else if (protocol == SSLv3) {
ctx_ = SSL_CTX_new(SSLv3_method());
#endif
+#if OPENSSL_VERSION_NUMBER >= 0x40000000L
+ } else if (protocol == TLSv1_0 || protocol == TLSv1_1 || protocol ==
TLSv1_2) {
+ ctx_ = SSL_CTX_new(TLS_method());
+ if (ctx_) {
+ int ver = (protocol == TLSv1_0) ? TLS1_VERSION : (protocol == TLSv1_1) ?
TLS1_1_VERSION : TLS1_2_VERSION;
+ SSL_CTX_set_min_proto_version(ctx_, ver);
+ SSL_CTX_set_max_proto_version(ctx_, ver);
Review Comment:
The result is not checked. On failure the context should be released and
`ctx_` set to null then either a new error thrown or it could then be managed
by the existing check for `ctx_` being a nullptr.
--
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]