From c2f47590ef4fb937a5baa4d4b9e0f364e812d407 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Wed, 5 Sep 2012 17:25:44 -0400 Subject: curl: Use find_package(OpenSSL) Change the code to use the standard CMake FindOpenSSL instead of the handcrafted attempt that was there before. --- Utilities/cmcurl/CMakeLists.txt | 16 ++++------------ Utilities/cmcurl/config.h.in | 3 --- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/Utilities/cmcurl/CMakeLists.txt b/Utilities/cmcurl/CMakeLists.txt index caa44f1..7eb16d3 100644 --- a/Utilities/cmcurl/CMakeLists.txt +++ b/Utilities/cmcurl/CMakeLists.txt @@ -169,22 +169,14 @@ IF(NOT CURL_SPECIAL_LIBZ) CHECK_LIBRARY_EXISTS_CONCAT("z" inflateEnd HAVE_LIBZ) ENDIF(NOT CURL_SPECIAL_LIBZ) -OPTION(CMAKE_USE_OPENSSL "Use OpenSSL code." OFF) +OPTION(CMAKE_USE_OPENSSL "Use OpenSSL code with curl." OFF) MARK_AS_ADVANCED(CMAKE_USE_OPENSSL) IF(CMAKE_USE_OPENSSL) SET(USE_SSLEAY TRUE) SET(USE_OPENSSL TRUE) - IF(WIN32) - FIND_PATH(SSLINCLUDE openssl/crypto.h - PATHS c:/hoffman/Tools/openssl_w32vc6-0.9.8g/inc32) - INCLUDE_DIRECTORIES(${SSLINCLUDE}) - FIND_LIBRARY(LIBEAY NAMES libeay32) - FIND_LIBRARY(SSLEAY NAMES ssleay32) - SET(CURL_LIBS ${CURL_LIBS} ${LIBEAY} ${SSLEAY} ) - ELSE(WIN32) - CHECK_LIBRARY_EXISTS_CONCAT("crypto" CRYPTO_lock HAVE_LIBCRYPTO) - CHECK_LIBRARY_EXISTS_CONCAT("ssl" SSL_connect HAVE_LIBSSL) - ENDIF(WIN32) + FIND_PACKAGE(OpenSSL REQUIRED) + INCLUDE_DIRECTORIES(${OPENSSL_INCLUDE_DIR}) + SET(CURL_LIBS ${CURL_LIBS} ${OPENSSL_LIBRARIES}) SET(CURL_CA_BUNDLE "" CACHE FILEPATH "Path to SSL CA Certificate Bundle") MARK_AS_ADVANCED(CURL_CA_BUNDLE) IF(CURL_CA_BUNDLE) diff --git a/Utilities/cmcurl/config.h.in b/Utilities/cmcurl/config.h.in index 6e74935..e18af8f 100644 --- a/Utilities/cmcurl/config.h.in +++ b/Utilities/cmcurl/config.h.in @@ -255,9 +255,6 @@ /* Define to 1 if you have the header file. */ #cmakedefine HAVE_LIBSSH2_H ${HAVE_LIBSSH2_H} -/* Define to 1 if you have the `ssl' library (-lssl). */ -#cmakedefine HAVE_LIBSSL ${HAVE_LIBSSL} - /* if zlib is available */ #cmakedefine HAVE_LIBZ ${HAVE_LIBZ} -- cgit v0.12 From bc0e8c28ece1d681449b9b4b43b16fb5b331534e Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Thu, 6 Sep 2012 15:37:00 -0400 Subject: curl: Make OpenSSL DLLs available to CMake on Windows Find the OpenSSL runtime DLLs and place them next to the CMake executables in the build tree and the install tree. --- Utilities/cmcurl/CMakeLists.txt | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/Utilities/cmcurl/CMakeLists.txt b/Utilities/cmcurl/CMakeLists.txt index 7eb16d3..ef000a1 100644 --- a/Utilities/cmcurl/CMakeLists.txt +++ b/Utilities/cmcurl/CMakeLists.txt @@ -182,6 +182,29 @@ IF(CMAKE_USE_OPENSSL) IF(CURL_CA_BUNDLE) ADD_DEFINITIONS(-DCURL_CA_BUNDLE="${CURL_CA_BUNDLE}") ENDIF(CURL_CA_BUNDLE) + # for windows we want to install OPENSSL_LIBRARIES dlls + # and also copy them into the build tree so that testing + # can find them. + IF(WIN32) + FIND_FILE(CMAKE_EAY_DLL NAME libeay32.dll HINTS ${OPENSSL_INCLUDE_DIR}/..) + FIND_FILE(CMAKE_SSL_DLL NAME ssleay32.dll HINTS ${OPENSSL_INCLUDE_DIR}/..) + MARK_AS_ADVANCED(CMAKE_EAY_DLL CMAKE_SSL_DLL) + IF(CMAKE_SSL_DLL AND CMAKE_EAY_DLL) + SET(CMAKE_CURL_SSL_DLLS ${CMake_BIN_DIR}/${CMAKE_CFG_INTDIR}/libeay32.dll + ${CMake_BIN_DIR}/${CMAKE_CFG_INTDIR}/ssleay32.dll) + ADD_CUSTOM_COMMAND(OUTPUT + ${CMake_BIN_DIR}/${CMAKE_CFG_INTDIR}/libeay32.dll + DEPENDS ${CMAKE_EAY_DLL} + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_EAY_DLL} + ${CMake_BIN_DIR}/${CMAKE_CFG_INTDIR}/libeay32.dll) + ADD_CUSTOM_COMMAND(OUTPUT + ${CMake_BIN_DIR}/${CMAKE_CFG_INTDIR}/ssleay32.dll + DEPENDS ${CMAKE_SSL_DLL} + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SSL_DLL} + ${CMake_BIN_DIR}/${CMAKE_CFG_INTDIR}/ssleay32.dll) + INSTALL(PROGRAMS ${CMAKE_EAY_DLL} ${CMAKE_SSL_DLL} DESTINATION bin) + ENDIF() + ENDIF() ENDIF(CMAKE_USE_OPENSSL) # Check for idn @@ -690,8 +713,7 @@ ENDFOREACH() CONFIGURE_FILE(${LIBCURL_SOURCE_DIR}/config.h.in ${LIBCURL_BINARY_DIR}/config.h) - -ADD_LIBRARY(cmcurl ${LIBRARY_TYPE} ${libCurl_SRCS}) +ADD_LIBRARY(cmcurl ${LIBRARY_TYPE} ${libCurl_SRCS} ${CMAKE_CURL_SSL_DLLS}) TARGET_LINK_LIBRARIES(cmcurl ${CURL_LIBS}) IF(CMAKE_BUILD_CURL_SHARED) SET_TARGET_PROPERTIES(cmcurl PROPERTIES DEFINE_SYMBOL BUILDING_LIBCURL -- cgit v0.12 From 8b51762426ff6e3efbe61ee49f99755c24b4772c Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 7 Sep 2012 13:23:45 -0400 Subject: curl: Honor OPENSSL_NO_SSL2 Some OpenSSL distributions have dropped support for the ancient SSLv2 protocol completely. Port changes from upstream curl to recognize this case and avoid using it. --- Utilities/cmcurl/curl/curl.h | 2 +- Utilities/cmcurl/ssluse.c | 5 +++++ Utilities/cmcurl/strerror.c | 5 ++++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Utilities/cmcurl/curl/curl.h b/Utilities/cmcurl/curl/curl.h index 157c634..e586c4a 100644 --- a/Utilities/cmcurl/curl/curl.h +++ b/Utilities/cmcurl/curl/curl.h @@ -312,7 +312,7 @@ typedef enum { CURLE_UNSUPPORTED_PROTOCOL, /* 1 */ CURLE_FAILED_INIT, /* 2 */ CURLE_URL_MALFORMAT, /* 3 */ - CURLE_URL_MALFORMAT_USER, /* 4 - NOT USED */ + CURLE_NOT_BUILT_IN, /* 4 */ CURLE_COULDNT_RESOLVE_PROXY, /* 5 */ CURLE_COULDNT_RESOLVE_HOST, /* 6 */ CURLE_COULDNT_CONNECT, /* 7 */ diff --git a/Utilities/cmcurl/ssluse.c b/Utilities/cmcurl/ssluse.c index 55afb24..14d05ac 100644 --- a/Utilities/cmcurl/ssluse.c +++ b/Utilities/cmcurl/ssluse.c @@ -1285,8 +1285,13 @@ Curl_ossl_connect_step1(struct connectdata *conn, req_method = TLSv1_client_method(); break; case CURL_SSLVERSION_SSLv2: +#ifdef OPENSSL_NO_SSL2 + failf(data, "OpenSSL was built without SSLv2 support"); + return CURLE_NOT_BUILT_IN; +#else req_method = SSLv2_client_method(); break; +#endif case CURL_SSLVERSION_SSLv3: req_method = SSLv3_client_method(); break; diff --git a/Utilities/cmcurl/strerror.c b/Utilities/cmcurl/strerror.c index 6304fe8..74c3457 100644 --- a/Utilities/cmcurl/strerror.c +++ b/Utilities/cmcurl/strerror.c @@ -69,6 +69,10 @@ curl_easy_strerror(CURLcode error) case CURLE_URL_MALFORMAT: return "URL using bad/illegal format or missing URL"; + case CURLE_NOT_BUILT_IN: + return "A requested feature, protocol or option was not found built-in in" + " this libcurl due to a build-time decision."; + case CURLE_COULDNT_RESOLVE_PROXY: return "couldn't resolve proxy name"; @@ -287,7 +291,6 @@ curl_easy_strerror(CURLcode error) return "Error in the SSH layer"; /* error codes not used by current libcurl */ - case CURLE_URL_MALFORMAT_USER: case CURLE_FTP_USER_PASSWORD_INCORRECT: case CURLE_MALFORMAT_USER: case CURLE_BAD_CALLING_ORDER: -- cgit v0.12