Add #ifdef around use of SSL_ctx_min/max_proto_version

pull/23165/head
Matthew Stevenson 5 years ago
parent d37b900ab7
commit 673982014b
  1. 4
      src/core/tsi/ssl_transport_security.cc

@ -900,24 +900,28 @@ static tsi_result tsi_set_min_and_max_tls_versions(
} }
// Set the min TLS version of the SSL context. // Set the min TLS version of the SSL context.
switch (min_tls_version) { switch (min_tls_version) {
#if OPENSSL_VERSION_NUMBER >= 0x10100000
case grpc_tls_version::TLS1_2: case grpc_tls_version::TLS1_2:
SSL_CTX_set_min_proto_version(ssl_context, TLS1_2_VERSION); SSL_CTX_set_min_proto_version(ssl_context, TLS1_2_VERSION);
break; break;
case grpc_tls_version::TLS1_3: case grpc_tls_version::TLS1_3:
SSL_CTX_set_min_proto_version(ssl_context, TLS1_3_VERSION); SSL_CTX_set_min_proto_version(ssl_context, TLS1_3_VERSION);
break; break;
#endif
default: default:
gpr_log(GPR_INFO, "TLS version is not supported."); gpr_log(GPR_INFO, "TLS version is not supported.");
return TSI_FAILED_PRECONDITION; return TSI_FAILED_PRECONDITION;
} }
// Set the max TLS version of the SSL context. // Set the max TLS version of the SSL context.
switch (max_tls_version) { switch (max_tls_version) {
#if OPENSSL_VERSION_NUMBER >= 0x10100000
case grpc_tls_version::TLS1_2: case grpc_tls_version::TLS1_2:
SSL_CTX_set_max_proto_version(ssl_context, TLS1_2_VERSION); SSL_CTX_set_max_proto_version(ssl_context, TLS1_2_VERSION);
break; break;
case grpc_tls_version::TLS1_3: case grpc_tls_version::TLS1_3:
SSL_CTX_set_max_proto_version(ssl_context, TLS1_3_VERSION); SSL_CTX_set_max_proto_version(ssl_context, TLS1_3_VERSION);
break; break;
#endif
default: default:
gpr_log(GPR_INFO, "TLS version is not supported."); gpr_log(GPR_INFO, "TLS version is not supported.");
return TSI_FAILED_PRECONDITION; return TSI_FAILED_PRECONDITION;

Loading…
Cancel
Save