ssl_transport_security.cc: Make it compile with libressl (#35615)

Compiling grpc latest master [1] on Windows 10 Pro using MSVC 2019 and using LibreSSL 3.8.2 as SSL provider (package) does currently not work, as the functions X509_STORE_set_get_crl/X509_STORE_set_check_crl and the define SSL_OP_NO_RENEGOTIATION are not present.

Employ a workaround seen in the surrounding code by making the code block only for openssl available.

[1]: 24f89637 ([Test] Removed obsolete node test from run_tests.py (#35525), 2024-01-19)

Closes #35615

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/35615 from t-b:fix-compiliation-libressl 858f430715
PiperOrigin-RevId: 607752281
pull/35933/head
Thomas Braun 1 year ago committed by Copybara-Service
parent ee3153b20d
commit e3b5ec6e17
  1. 8
      src/core/tsi/ssl_transport_security.cc

@ -2081,7 +2081,7 @@ tsi_result tsi_create_ssl_client_handshaker_factory_with_options(
#else
ssl_context = SSL_CTX_new(TLSv1_2_method());
#endif
#if OPENSSL_VERSION_NUMBER >= 0x10101000
#if OPENSSL_VERSION_NUMBER >= 0x10101000 && !defined(LIBRESSL_VERSION_NUMBER)
SSL_CTX_set_options(ssl_context, SSL_OP_NO_RENEGOTIATION);
#endif
if (ssl_context == nullptr) {
@ -2184,7 +2184,7 @@ tsi_result tsi_create_ssl_client_handshaker_factory_with_options(
nullptr);
}
#if OPENSSL_VERSION_NUMBER >= 0x10100000
#if OPENSSL_VERSION_NUMBER >= 0x10100000 && !defined(LIBRESSL_VERSION_NUMBER)
if (options->crl_provider != nullptr) {
SSL_CTX_set_ex_data(impl->ssl_context, g_ssl_ctx_ex_crl_provider_index,
options->crl_provider.get());
@ -2301,7 +2301,7 @@ tsi_result tsi_create_ssl_server_handshaker_factory_with_options(
#else
impl->ssl_contexts[i] = SSL_CTX_new(TLSv1_2_method());
#endif
#if OPENSSL_VERSION_NUMBER >= 0x10101000
#if OPENSSL_VERSION_NUMBER >= 0x10101000 && !defined(LIBRESSL_VERSION_NUMBER)
SSL_CTX_set_options(impl->ssl_contexts[i], SSL_OP_NO_RENEGOTIATION);
#endif
if (impl->ssl_contexts[i] == nullptr) {
@ -2388,7 +2388,7 @@ tsi_result tsi_create_ssl_server_handshaker_factory_with_options(
break;
}
#if OPENSSL_VERSION_NUMBER >= 0x10100000
#if OPENSSL_VERSION_NUMBER >= 0x10100000 && !defined(LIBRESSL_VERSION_NUMBER)
if (options->crl_provider != nullptr) {
SSL_CTX_set_ex_data(impl->ssl_contexts[i],
g_ssl_ctx_ex_crl_provider_index,

Loading…
Cancel
Save