diff --git a/src/testcurl/https/test_https_sni.c b/src/testcurl/https/test_https_sni.c index cc7d1f43..4ffe1d8f 100644 --- a/src/testcurl/https/test_https_sni.c +++ b/src/testcurl/https/test_https_sni.c @@ -257,6 +257,7 @@ main (int argc, char *const *argv) struct MHD_Daemon *d; int port; (void) argc; /* Unused. Silent compiler warning. */ + const char *tls_backend; if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) port = 0; @@ -271,12 +272,21 @@ main (int argc, char *const *argv) #endif /* MHD_HTTPS_REQUIRE_GRYPT */ if (! testsuite_curl_global_init ()) return 99; - if (NULL == curl_version_info (CURLVERSION_NOW)->ssl_version) + tls_backend = curl_version_info (CURLVERSION_NOW)->ssl_version; + if (NULL == tls_backend) { fprintf (stderr, "Curl does not support SSL. Cannot run the test.\n"); curl_global_cleanup (); return 77; } + if (! curl_tls_is_gnutls () && ! curl_tls_is_openssl ()) + { + fprintf (stderr, "This test is reliable only with libcurl with GnuTLS or " + "OpenSSL backends.\nSkipping the test as libcurl has '%s' " + "backend.\n", tls_backend); + curl_global_cleanup (); + return 77; + } load_keys ("mhdhost1", ABS_SRCDIR "/mhdhost1.crt", ABS_SRCDIR "/mhdhost1.key"); diff --git a/src/testcurl/https/tls_test_common.c b/src/testcurl/https/tls_test_common.c index 36134ecc..8d33e5d4 100644 --- a/src/testcurl/https/tls_test_common.c +++ b/src/testcurl/https/tls_test_common.c @@ -601,6 +601,26 @@ curl_tls_is_gnutls (void) } +int +curl_tls_is_openssl (void) +{ + const char *tlslib; + if (inited_tls_is_gnutls) + return 0; + if (inited_tls_is_openssl) + return 1; + + tlslib = curl_version_info (CURLVERSION_NOW)->ssl_version; + if (NULL == tlslib) + return 0; + if (0 == strncmp (tlslib, "OpenSSL/", 8)) + return 1; + + /* Multi-backends handled during initialization by setting variable */ + return 0; +} + + int curl_tls_is_nss (void) {