diff --git a/src/core/tsi/ssl_transport_security.cc b/src/core/tsi/ssl_transport_security.cc index ccc85ae2a3f..4f3919319c1 100644 --- a/src/core/tsi/ssl_transport_security.cc +++ b/src/core/tsi/ssl_transport_security.cc @@ -2072,9 +2072,11 @@ tsi_result tsi_create_ssl_client_handshaker_factory_with_options( #if OPENSSL_VERSION_NUMBER >= 0x10100000 ssl_context = SSL_CTX_new(TLS_method()); - SSL_CTX_set_options(ssl_context, SSL_OP_NO_RENEGOTIATION); #else ssl_context = SSL_CTX_new(TLSv1_2_method()); +#endif +#if OPENSSL_VERSION_NUMBER >= 0x10101000 + SSL_CTX_set_options(ssl_context, SSL_OP_NO_RENEGOTIATION); #endif if (ssl_context == nullptr) { grpc_core::LogSslErrorStack(); @@ -2288,9 +2290,11 @@ tsi_result tsi_create_ssl_server_handshaker_factory_with_options( do { #if OPENSSL_VERSION_NUMBER >= 0x10100000 impl->ssl_contexts[i] = SSL_CTX_new(TLS_method()); - SSL_CTX_set_options(impl->ssl_contexts[i], SSL_OP_NO_RENEGOTIATION); #else impl->ssl_contexts[i] = SSL_CTX_new(TLSv1_2_method()); +#endif +#if OPENSSL_VERSION_NUMBER >= 0x10101000 + SSL_CTX_set_options(impl->ssl_contexts[i], SSL_OP_NO_RENEGOTIATION); #endif if (impl->ssl_contexts[i] == nullptr) { grpc_core::LogSslErrorStack();