mirror of
https://github.com/apple/foundationdb.git
synced 2025-05-14 01:42:37 +08:00
parent
db6d7396ca
commit
5403a29ecb
@ -10,3 +10,4 @@ set(SRCS
|
|||||||
|
|
||||||
add_library(FDBLibTLS STATIC ${SRCS})
|
add_library(FDBLibTLS STATIC ${SRCS})
|
||||||
target_link_libraries(FDBLibTLS PUBLIC OpenSSL::SSL boost_target PRIVATE flow)
|
target_link_libraries(FDBLibTLS PUBLIC OpenSSL::SSL boost_target PRIVATE flow)
|
||||||
|
target_include_directories(FDBLibTLS INTERFACE OpenSSL::SSL boost_target PRIVATE flow)
|
||||||
|
@ -22,6 +22,9 @@
|
|||||||
#include "FDBLibTLS/FDBLibTLSSession.h"
|
#include "FDBLibTLS/FDBLibTLSSession.h"
|
||||||
#include "flow/Trace.h"
|
#include "flow/Trace.h"
|
||||||
|
|
||||||
|
#if defined(HAVE_WOLFSSL)
|
||||||
|
#include <wolfssl/options.h>
|
||||||
|
#endif
|
||||||
#include <openssl/bio.h>
|
#include <openssl/bio.h>
|
||||||
#include <openssl/err.h>
|
#include <openssl/err.h>
|
||||||
#include <openssl/evp.h>
|
#include <openssl/evp.h>
|
||||||
|
@ -23,6 +23,9 @@
|
|||||||
#include "flow/flow.h"
|
#include "flow/flow.h"
|
||||||
#include "flow/Trace.h"
|
#include "flow/Trace.h"
|
||||||
|
|
||||||
|
#if defined(HAVE_WOLFSSL)
|
||||||
|
#include <wolfssl/options.h>
|
||||||
|
#endif
|
||||||
#include <openssl/bio.h>
|
#include <openssl/bio.h>
|
||||||
#include <openssl/err.h>
|
#include <openssl/err.h>
|
||||||
#include <openssl/pem.h>
|
#include <openssl/pem.h>
|
||||||
|
@ -20,6 +20,9 @@
|
|||||||
|
|
||||||
#include "FDBLibTLS/FDBLibTLSVerify.h"
|
#include "FDBLibTLS/FDBLibTLSVerify.h"
|
||||||
|
|
||||||
|
#if defined(HAVE_WOLFSSL)
|
||||||
|
#include <wolfssl/options.h>
|
||||||
|
#endif
|
||||||
#include <openssl/objects.h>
|
#include <openssl/objects.h>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
@ -25,6 +25,9 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <boost/lexical_cast.hpp>
|
#include <boost/lexical_cast.hpp>
|
||||||
|
|
||||||
|
#if defined(HAVE_WOLFSSL)
|
||||||
|
#include <wolfssl/options.h>
|
||||||
|
#endif
|
||||||
#include <openssl/objects.h>
|
#include <openssl/objects.h>
|
||||||
|
|
||||||
#include "fdbrpc/ITLSPlugin.h"
|
#include "fdbrpc/ITLSPlugin.h"
|
||||||
|
@ -21,22 +21,39 @@ endif()
|
|||||||
include(CheckSymbolExists)
|
include(CheckSymbolExists)
|
||||||
|
|
||||||
set(DISABLE_TLS OFF CACHE BOOL "Don't try to find OpenSSL and always build without TLS support")
|
set(DISABLE_TLS OFF CACHE BOOL "Don't try to find OpenSSL and always build without TLS support")
|
||||||
|
set(USE_WOLFSSL OFF CACHE BOOL "Build against WolfSSL instead of OpenSSL")
|
||||||
|
set(USE_OPENSSL ON CACHE BOOL "Build against OpenSSL")
|
||||||
if(DISABLE_TLS)
|
if(DISABLE_TLS)
|
||||||
set(WITH_TLS OFF)
|
set(WITH_TLS OFF)
|
||||||
else()
|
else()
|
||||||
set(OPENSSL_USE_STATIC_LIBS TRUE)
|
if(USE_WOLFSSL)
|
||||||
if(WIN32)
|
set(WOLFSSL_USE_STATIC_LIBS TRUE)
|
||||||
set(OPENSSL_MSVC_STATIC_RT ON)
|
find_package(WolfSSL)
|
||||||
endif()
|
if(WOLFSSL_FOUND)
|
||||||
find_package(OpenSSL)
|
set(CMAKE_REQUIRED_INCLUDES ${WOLFSSL_INCLUDE_DIR})
|
||||||
if(OPENSSL_FOUND)
|
set(WITH_TLS ON)
|
||||||
set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
|
add_compile_options(-DHAVE_OPENSSL)
|
||||||
set(WITH_TLS ON)
|
add_compile_options(-DHAVE_WOLFSSL)
|
||||||
add_compile_options(-DHAVE_OPENSSL)
|
else()
|
||||||
else()
|
message(STATUS "WolfSSL was not found - Will compile without TLS Support")
|
||||||
message(STATUS "OpenSSL was not found - Will compile without TLS Support")
|
message(STATUS "You can set WOLFSSL_ROOT_DIR to help cmake find it")
|
||||||
message(STATUS "You can set OPENSSL_ROOT_DIR to help cmake find it")
|
set(WITH_TLS OFF)
|
||||||
set(WITH_TLS OFF)
|
endif()
|
||||||
|
elseif(USE_OPENSSL)
|
||||||
|
set(OPENSSL_USE_STATIC_LIBS TRUE)
|
||||||
|
if(WIN32)
|
||||||
|
set(OPENSSL_MSVC_STATIC_RT ON)
|
||||||
|
endif()
|
||||||
|
find_package(OpenSSL)
|
||||||
|
if(OPENSSL_FOUND)
|
||||||
|
set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
|
||||||
|
set(WITH_TLS ON)
|
||||||
|
add_compile_options(-DHAVE_OPENSSL)
|
||||||
|
else()
|
||||||
|
message(STATUS "OpenSSL was not found - Will compile without TLS Support")
|
||||||
|
message(STATUS "You can set OPENSSL_ROOT_DIR to help cmake find it")
|
||||||
|
set(WITH_TLS OFF)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
63
cmake/FindWolfSSL.cmake
Normal file
63
cmake/FindWolfSSL.cmake
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
# FindWolfSSL
|
||||||
|
|
||||||
|
# Support preference of static libs by adjusting CMAKE_FIND_LIBRARY_SUFFIXES
|
||||||
|
if(WOLFSSL_USE_STATIC_LIBS)
|
||||||
|
if(WIN32)
|
||||||
|
set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||||
|
else()
|
||||||
|
set(CMAKE_FIND_LIBRARY_SUFFIXES .a)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
find_path(WOLFSSL_ROOT_DIR
|
||||||
|
NAMES
|
||||||
|
include/wolfssl/options.h
|
||||||
|
)
|
||||||
|
|
||||||
|
find_path(WOLFSSL_INCLUDE_DIR
|
||||||
|
NAMES
|
||||||
|
wolfssl/ssl.h
|
||||||
|
PATHS
|
||||||
|
${WOLFSSL_ROOT_DIR}/include
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(WOLFSSL_LIBRARY
|
||||||
|
NAMES
|
||||||
|
wolfssl
|
||||||
|
PATHS
|
||||||
|
${WOLFSSL_ROOT_DIR}/lib
|
||||||
|
)
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
find_package_handle_standard_args(WolfSSL
|
||||||
|
REQUIRED_VARS
|
||||||
|
WOLFSSL_LIBRARY
|
||||||
|
WOLFSSL_INCLUDE_DIR
|
||||||
|
FAIL_MESSAGE
|
||||||
|
"Could NOT find WolfSSL"
|
||||||
|
)
|
||||||
|
|
||||||
|
mark_as_advanced(
|
||||||
|
WOLFSSL_ROOT_DIR
|
||||||
|
WOLFSSL_LIBRARY
|
||||||
|
WOLFSSL_INCLUDE_DIR
|
||||||
|
)
|
||||||
|
|
||||||
|
if(WOLFSSL_FOUND)
|
||||||
|
message(STATUS "Found wolfssl library: ${WOLFSSL_LIBRARY}")
|
||||||
|
message(STATUS "Found wolfssl includes: ${WOLFSSL_INCLUDE_DIR}")
|
||||||
|
|
||||||
|
set(WOLFSSL_INCLUDE_DIRS ${WOLFSSL_INCLUDE_DIR})
|
||||||
|
set(WOLFSSL_LIBRARIES ${WOLFSSL_LIBRARY})
|
||||||
|
|
||||||
|
add_library(WolfSSL UNKNOWN IMPORTED GLOBAL)
|
||||||
|
add_library(OpenSSL::SSL ALIAS WolfSSL)
|
||||||
|
add_library(OpenSSL::CRYPTO ALIAS WolfSSL)
|
||||||
|
|
||||||
|
target_include_directories(WolfSSL INTERFACE "${WOLFSSL_INCLUDE_DIR}")
|
||||||
|
target_link_libraries(WolfSSL INTERFACE "${WOLFSSL_TLS_LIBRARY}" "${WOLFSSL_SSL_LIBRARY}" "${WOLFSSL_CRYPTO_LIBRARY}")
|
||||||
|
set_target_properties(WolfSSL PROPERTIES
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES "${WOLFSSL_INCLUDE_DIR}"
|
||||||
|
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
||||||
|
IMPORTED_LOCATION "${WOLFSSL_LIBRARY}")
|
||||||
|
endif()
|
@ -25,9 +25,15 @@
|
|||||||
#include "fdbclient/sha1/SHA1.h"
|
#include "fdbclient/sha1/SHA1.h"
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
|
#if defined(HAVE_WOLFSSL)
|
||||||
|
#include <wolfssl/options.h>
|
||||||
|
#endif
|
||||||
#include <openssl/sha.h>
|
#include <openssl/sha.h>
|
||||||
#include <openssl/evp.h>
|
#include <openssl/evp.h>
|
||||||
#include <openssl/hmac.h>
|
#include <openssl/hmac.h>
|
||||||
|
#if defined(HAVE_WOLFSSL)
|
||||||
|
#undef SHA1 // wolfSSL will will shadow FDB SHA1.h
|
||||||
|
#endif
|
||||||
#include <boost/algorithm/string/split.hpp>
|
#include <boost/algorithm/string/split.hpp>
|
||||||
#include <boost/algorithm/string/classification.hpp>
|
#include <boost/algorithm/string/classification.hpp>
|
||||||
#include <boost/algorithm/string.hpp>
|
#include <boost/algorithm/string.hpp>
|
||||||
|
@ -24,6 +24,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(HAVE_OPENSSL) && !defined(TLS_DISABLED)
|
#if defined(HAVE_OPENSSL) && !defined(TLS_DISABLED)
|
||||||
|
#if defined(HAVE_WOLFSSL)
|
||||||
|
#include <wolfssl/options.h>
|
||||||
|
#endif
|
||||||
#include <openssl/md5.h>
|
#include <openssl/md5.h>
|
||||||
#elif !defined(_MD5_H)
|
#elif !defined(_MD5_H)
|
||||||
#define _MD5_H
|
#define _MD5_H
|
||||||
|
@ -39,6 +39,9 @@
|
|||||||
#include "flow/flow.h"
|
#include "flow/flow.h"
|
||||||
#include "flow/genericactors.actor.h"
|
#include "flow/genericactors.actor.h"
|
||||||
|
|
||||||
|
#if defined(HAVE_WOLFSSL)
|
||||||
|
#include <wolfssl/options.h>
|
||||||
|
#endif
|
||||||
#include <openssl/aes.h>
|
#include <openssl/aes.h>
|
||||||
#include <openssl/engine.h>
|
#include <openssl/engine.h>
|
||||||
#include <openssl/evp.h>
|
#include <openssl/evp.h>
|
||||||
|
@ -176,6 +176,10 @@ if(NOT WITH_TLS)
|
|||||||
else()
|
else()
|
||||||
target_link_libraries(flow PUBLIC OpenSSL::SSL)
|
target_link_libraries(flow PUBLIC OpenSSL::SSL)
|
||||||
target_link_libraries(flow_sampling PUBLIC OpenSSL::SSL)
|
target_link_libraries(flow_sampling PUBLIC OpenSSL::SSL)
|
||||||
|
if(USE_WOLFSSL)
|
||||||
|
target_include_directories(flow SYSTEM BEFORE PUBLIC ${WOLFSSL_INCLUDE_DIR}/wolfssl)
|
||||||
|
target_include_directories(flow_sampling SYSTEM BEFORE PUBLIC ${WOLFSSL_INCLUDE_DIR}/wolfssl)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
target_link_libraries(flow PUBLIC Threads::Threads ${CMAKE_DL_LIBS})
|
target_link_libraries(flow PUBLIC Threads::Threads ${CMAKE_DL_LIBS})
|
||||||
target_link_libraries(flow_sampling PUBLIC Threads::Threads ${CMAKE_DL_LIBS})
|
target_link_libraries(flow_sampling PUBLIC Threads::Threads ${CMAKE_DL_LIBS})
|
||||||
|
@ -29,6 +29,12 @@
|
|||||||
#define BOOST_DATE_TIME_NO_LIB
|
#define BOOST_DATE_TIME_NO_LIB
|
||||||
#define BOOST_REGEX_NO_LIB
|
#define BOOST_REGEX_NO_LIB
|
||||||
#include <boost/asio.hpp>
|
#include <boost/asio.hpp>
|
||||||
|
#ifndef TLS_DISABLED
|
||||||
|
#if defined(HAVE_WOLFSSL)
|
||||||
|
#include <wolfssl/options.h>
|
||||||
|
#endif
|
||||||
|
#include "boost/asio/ssl.hpp"
|
||||||
|
#endif
|
||||||
#include <boost/date_time/posix_time/posix_time_types.hpp>
|
#include <boost/date_time/posix_time/posix_time_types.hpp>
|
||||||
#include <boost/range.hpp>
|
#include <boost/range.hpp>
|
||||||
#include <boost/algorithm/string/join.hpp>
|
#include <boost/algorithm/string/join.hpp>
|
||||||
|
@ -32,6 +32,9 @@
|
|||||||
#include "flow/FastRef.h"
|
#include "flow/FastRef.h"
|
||||||
#include "flow/flow.h"
|
#include "flow/flow.h"
|
||||||
|
|
||||||
|
#if defined(HAVE_WOLFSSL)
|
||||||
|
#include <wolfssl/options.h>
|
||||||
|
#endif
|
||||||
#include <openssl/aes.h>
|
#include <openssl/aes.h>
|
||||||
#include <openssl/evp.h>
|
#include <openssl/evp.h>
|
||||||
#include <openssl/hmac.h>
|
#include <openssl/hmac.h>
|
||||||
|
@ -38,6 +38,9 @@ void LoadedTLSConfig::print(FILE* fp) {
|
|||||||
#include <exception>
|
#include <exception>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
#if defined(HAVE_WOLFSSL)
|
||||||
|
#include <wolfssl/options.h>
|
||||||
|
#endif
|
||||||
#include <openssl/objects.h>
|
#include <openssl/objects.h>
|
||||||
#include <openssl/bio.h>
|
#include <openssl/bio.h>
|
||||||
#include <openssl/err.h>
|
#include <openssl/err.h>
|
||||||
|
@ -39,6 +39,9 @@
|
|||||||
|
|
||||||
#ifndef TLS_DISABLED
|
#ifndef TLS_DISABLED
|
||||||
|
|
||||||
|
#if defined(HAVE_WOLFSSL)
|
||||||
|
#include <wolfssl/options.h>
|
||||||
|
#endif
|
||||||
#include <openssl/x509.h>
|
#include <openssl/x509.h>
|
||||||
typedef int NID;
|
typedef int NID;
|
||||||
|
|
||||||
@ -280,4 +283,4 @@ public:
|
|||||||
" and format of CONSTRAINTS are plugin-specific.\n"
|
" and format of CONSTRAINTS are plugin-specific.\n"
|
||||||
|
|
||||||
#include "flow/unactorcompiler.h"
|
#include "flow/unactorcompiler.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -30,9 +30,6 @@
|
|||||||
#include <variant>
|
#include <variant>
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include "boost/asio.hpp"
|
#include "boost/asio.hpp"
|
||||||
#ifndef TLS_DISABLED
|
|
||||||
#include "boost/asio/ssl.hpp"
|
|
||||||
#endif
|
|
||||||
#include "flow/Arena.h"
|
#include "flow/Arena.h"
|
||||||
#include "flow/BooleanParam.h"
|
#include "flow/BooleanParam.h"
|
||||||
#include "flow/IRandom.h"
|
#include "flow/IRandom.h"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user