diff --git a/Daemon.cpp b/Daemon.cpp index ee3dbe76..d0f254e2 100644 --- a/Daemon.cpp +++ b/Daemon.cpp @@ -1,6 +1,5 @@ #include #include -#include #include "Daemon.h" @@ -20,6 +19,8 @@ #include "HTTPServer.h" #include "I2PControl.h" #include "ClientContext.h" +// ssl.h somehow pulls Windows.h stuff that has to go after asio +#include #ifdef USE_UPNP #include "UPnP.h" @@ -39,7 +40,7 @@ namespace i2p std::unique_ptr m_I2PControlService; #ifdef USE_UPNP - UPnP m_UPnP; + i2p::transport::UPnP m_UPnP; #endif }; diff --git a/SAM.cpp b/SAM.cpp index dc592f51..ee8b514a 100644 --- a/SAM.cpp +++ b/SAM.cpp @@ -450,7 +450,7 @@ namespace client auto keys = i2p::data::PrivateKeys::CreateRandomKeys (); #ifdef _MSC_VER size_t len = sprintf_s (m_Buffer, SAM_SOCKET_BUFFER_SIZE, SAM_DEST_REPLY, - keys.GetPublic ().ToBase64 ().c_str (), keys.ToBase64 ().c_str ()); + keys.GetPublic ()->ToBase64 ().c_str (), keys.ToBase64 ().c_str ()); #else size_t len = snprintf (m_Buffer, SAM_SOCKET_BUFFER_SIZE, SAM_DEST_REPLY, keys.GetPublic ()->ToBase64 ().c_str (), keys.ToBase64 ().c_str ()); diff --git a/Win32/Win32Service.h b/Win32/Win32Service.h index 868528f6..097cb111 100644 --- a/Win32/Win32Service.h +++ b/Win32/Win32Service.h @@ -2,7 +2,6 @@ #define WIN_32_SERVICE_H__ #include -#define WIN32_LEAN_AND_MEAN #include diff --git a/build/CMakeLists.txt b/build/CMakeLists.txt index ed8a281f..d8fae295 100644 --- a/build/CMakeLists.txt +++ b/build/CMakeLists.txt @@ -16,7 +16,7 @@ set ( CMAKE_SOURCE_DIR ".." ) set (COMMON_SRC "${CMAKE_SOURCE_DIR}/AddressBook.cpp" - "${CMAKE_SOURCE_DIR}/CryptoConst.cpp" + "${CMAKE_SOURCE_DIR}/Crypto.cpp" "${CMAKE_SOURCE_DIR}/Garlic.cpp" "${CMAKE_SOURCE_DIR}/I2NPProtocol.cpp" "${CMAKE_SOURCE_DIR}/Identity.cpp" @@ -40,8 +40,7 @@ set (COMMON_SRC "${CMAKE_SOURCE_DIR}/Transports.cpp" "${CMAKE_SOURCE_DIR}/TunnelEndpoint.cpp" "${CMAKE_SOURCE_DIR}/TunnelPool.cpp" - "${CMAKE_SOURCE_DIR}/aes.cpp" - "${CMAKE_SOURCE_DIR}/base64.cpp" + "${CMAKE_SOURCE_DIR}/Base.cpp" "${CMAKE_SOURCE_DIR}/util.cpp" "${CMAKE_SOURCE_DIR}/Datagram.cpp" "${CMAKE_SOURCE_DIR}/Signature.cpp" @@ -65,7 +64,7 @@ set (DAEMON_SRC "${CMAKE_SOURCE_DIR}/I2PTunnel.cpp" "${CMAKE_SOURCE_DIR}/SAM.cpp" "${CMAKE_SOURCE_DIR}/SOCKS.cpp" - "${CMAKE_SOURCE_DIR}/i2p.cpp" + "${CMAKE_SOURCE_DIR}/i2pd.cpp" ) if (WITH_UPNP) @@ -91,7 +90,9 @@ if (NOT CMAKE_BUILD_TYPE) endif () # compiler flags customization (by vendor) -if (NOT MSVC) +if (MSVC) + add_definitions( -D_WIN32_WINNT=_WIN32_WINNT_WINXP -DWIN32_LEAN_AND_MEAN -DNOMINMAX ) #-DOPENSSL_NO_SSL2 -DOPENSSL_USE_DEPRECATED +else() set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Winvalid-pch" ) set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -pedantic" ) # TODO: The following is incompatible with static build and enabled hardening for OpenWRT. @@ -212,18 +213,34 @@ if(NOT DEFINED Boost_INCLUDE_DIRS) message(SEND_ERROR "Boost is not found, or your boost version was bellow 1.46. Please download Boost!") endif() -find_package ( CryptoPP REQUIRED ) -if(NOT DEFINED CRYPTO++_INCLUDE_DIR) - message(SEND_ERROR "Could not find Crypto++. Please download and install it first!") +find_package ( OpenSSL REQUIRED ) +if(NOT DEFINED OPENSSL_INCLUDE_DIR) + message(SEND_ERROR "Could not find OpenSSL. Please download and install it first!") endif() find_package ( MiniUPnPc ) -if (NOT ${MINIUPNPC_FOUND}) +if (MINIUPNPC_FOUND) + include_directories( ${MINIUPNPC_INCLUDE_DIR} ) +else () set(WITH_UPNP OFF) endif() +find_package ( ZLIB ) +if (NOT DEFINED ZLIB-FOUND ) + include( ExternalProject ) + ExternalProject_Add(zlib + URL http://zlib.net/zlib-1.2.8.tar.gz + PREFIX ${CMAKE_CURRENT_BINARY_DIR}/zlib + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH= + ) + add_dependencies( common zlib ) + ExternalProject_Get_Property(zlib install_dir) + set (ZLIB_ROOT ${install_dir} ) + find_package ( ZLIB REQUIRED ) +endif () + # load includes -include_directories( ${Boost_INCLUDE_DIRS} ${CRYPTO++_INCLUDE_DIR} ) +include_directories( ${Boost_INCLUDE_DIRS} ${OPENSSL_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} ) # show summary message(STATUS "---------------------------------------") @@ -271,7 +288,7 @@ if (WITH_BINARY) if(${LAST_Boost_LIBRARIES} MATCHES ".*pthread.*") list(REMOVE_AT Boost_LIBRARIES -1) endif() - target_link_libraries( "${PROJECT_NAME}-bin" common ${DL_LIB} ${Boost_LIBRARIES} ${CRYPTO++_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ) + target_link_libraries( "${PROJECT_NAME}-bin" common ${DL_LIB} ${Boost_LIBRARIES} ${OPENSSL_LIBRARIES} ${ZLIB_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} ) install(TARGETS "${PROJECT_NAME}-bin" RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) if (MSVC) @@ -285,7 +302,7 @@ if (WITH_LIBRARY) add_library(${PROJECT_NAME} STATIC ${LIBRARY_SRC}) else () add_library(${PROJECT_NAME} ${LIBRARY_SRC}) - target_link_libraries( ${PROJECT_NAME} common ${Boost_LIBRARIES} ${CRYPTO++_LIBRARIES}) + target_link_libraries( ${PROJECT_NAME} common ${Boost_LIBRARIES} ${OPENSSL_LIBRARIES}) endif () if (WITH_PCH) if (MSVC) diff --git a/build/cmake_modules/FindMiniUPnPc.cmake b/build/cmake_modules/FindMiniUPnPc.cmake index 7ecef75d..8d5d3860 100644 --- a/build/cmake_modules/FindMiniUPnPc.cmake +++ b/build/cmake_modules/FindMiniUPnPc.cmake @@ -4,12 +4,12 @@ if(MINIUPNPC_INCLUDE_DIR) set(MINIUPNPC_FOUND TRUE) else() - find_path(MINIUPNPC_INCLUDE_DIR miniupnpc.h - /usr/include/miniupnpc - /usr/local/include/miniupnpc - /opt/local/include/miniupnpc - $ENV{SystemDrive}/miniupnpc - ${PROJECT_SOURCE_DIR}/../../miniupnpc + find_path(MINIUPNPC_INCLUDE_DIR miniupnpc/miniupnpc.h + /usr/include + /usr/local/include + /opt/local/include + $ENV{SystemDrive} + ${PROJECT_SOURCE_DIR}/../.. ) if(MINIUPNPC_INCLUDE_DIR) diff --git a/stdafx.h b/stdafx.h index edfac630..ed13bf8b 100644 --- a/stdafx.h +++ b/stdafx.h @@ -48,20 +48,20 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #endif