diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 1055c9a..71cb979 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -155,6 +155,7 @@ endif() target_include_directories(perf PUBLIC "${PROJECT_SOURCE_DIR}") target_link_libraries(perf PUBLIC OpenSSL::SSL OpenSSL::Crypto) set(CMAKE_REQUIRED_LIBRARIES OpenSSL::Crypto) +set(CMAKE_REQUIRED_LIBRARIES OpenSSL::SSL OpenSSL::Crypto) set(CMAKE_REQUIRED_INCLUDES "${OPENSSL_INCLUDE_DIR}") if( OPENSSL_VERSION VERSION_GREATER_EQUAL 3 ) @@ -167,6 +168,7 @@ if( OPENSSL_VERSION VERSION_GREATER_EQUAL 3 ) endif() check_symbol_exists(OSSL_LIB_CTX_freeze "openssl/crypto.h" HAVE_OSSL_LIB_CTX_FREEZE) +check_symbol_exists(SSL_set1_dnsname "openssl/ssl.h" HAVE_SSL_SET1_DNSNAME) if( OPENSSL_VERSION VERSION_GREATER_EQUAL 3.6 ) add_executable(ssl_poll_perf ssl_poll_perf.c) diff --git a/source/config.h.in b/source/config.h.in index 80bc9ea..90e79ad 100644 --- a/source/config.h.in +++ b/source/config.h.in @@ -2,3 +2,6 @@ /* Define to 1 if you have the `OSSL_LIB_CTX_freeze' function. */ #cmakedefine HAVE_OSSL_LIB_CTX_FREEZE + +/* Define to 1 if you have the `SSL_set1_dnsname' function. */ +#cmakedefine HAVE_SSL_SET1_DNSNAME diff --git a/source/ssl_poll_perf.c b/source/ssl_poll_perf.c index e17f3b2..f54910d 100644 --- a/source/ssl_poll_perf.c +++ b/source/ssl_poll_perf.c @@ -49,6 +49,7 @@ #include #include "perflib/perflib.h" #include "perflib/list.h" +#include "config.h" #ifndef _WIN32 # include @@ -2981,10 +2982,17 @@ create_client_pe(SSL_CTX *ctx, struct client_stats *cs) goto fail; } +#ifdef HAVE_SSL_SET1_DNSNAME + if (SSL_set1_dnsname(qconn, hostname) == 0) { + DPRINTFC(stderr, "%s SSL_set1_dnsname() failed\n", __func__); + goto fail; + } +#else if (SSL_set1_host(qconn, hostname) == 0) { DPRINTFC(stderr, "%s SSL_set1_host() failed\n", __func__); goto fail; } +#endif /* SSL_set_alpn_protos returns 0 for success! */ switch (alpn) {