diff --git a/MSVC/ring-daemon.vcxproj b/MSVC/ring-daemon.vcxproj index aa789f3f79c0a0ca91babc73d0849288b52a4636..b7d43feefb2b0fea17d8f277946304e4e4cc8c9d 100644 --- a/MSVC/ring-daemon.vcxproj +++ b/MSVC/ring-daemon.vcxproj @@ -527,7 +527,7 @@ </Command> </PreBuildEvent> <Lib> - <AdditionalDependencies>ws2_32.lib;iphlpapi.lib;advapi32.lib;avcodec.lib;avdevice.lib;avfilter.lib;avformat.lib;avutil.lib;swresample.lib;swscale.lib;libsamplerate.lib;libgnutls.lib;lib_json.lib;opendht.lib;Argon2Ref.lib;pcre.lib;yaml-cpp.lib;portaudio-UWP.lib;libupnp.lib;pjsip-core-x86_64-x64-vc14-Release.lib;pjsip-simple-x86_64-x64-vc14-Release.lib;pjsua2-lib-x86_64-x64-vc14-Release.lib;pjsua-lib-x86_64-x64-vc14-Release.lib;pjsip-ua-x86_64-x64-vc14-Release.lib;pjmedia-codec-x86_64-x64-vc14-Release.lib;pjmedia-x86_64-x64-vc14-Release.lib;pjlib-util-x86_64-x64-vc14-Release.lib;libspeex-x86_64-x64-vc14-Release.lib;pjlib-x86_64-x64-vc14-Release.lib;pjnath-x86_64-x64-vc14-Release.lib;restbed.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalDependencies>ws2_32.lib;iphlpapi.lib;advapi32.lib;avcodec.lib;avdevice.lib;avfilter.lib;avformat.lib;avutil.lib;swresample.lib;swscale.lib;libsamplerate.lib;libgnutls.lib;lib_json.lib;opendht.lib;Argon2Ref.lib;pcre.lib;yaml-cpp.lib;portaudio-UWP.lib;libupnp.lib;pjsip-core-x86_64-x64-vc14-Release.lib;pjsip-simple-x86_64-x64-vc14-Release.lib;pjsua2-lib-x86_64-x64-vc14-Release.lib;pjsua-lib-x86_64-x64-vc14-Release.lib;pjsip-ua-x86_64-x64-vc14-Release.lib;pjmedia-codec-x86_64-x64-vc14-Release.lib;pjmedia-x86_64-x64-vc14-Release.lib;pjlib-util-x86_64-x64-vc14-Release.lib;libspeex-x86_64-x64-vc14-Release.lib;pjlib-x86_64-x64-vc14-Release.lib;pjnath-x86_64-x64-vc14-Release.lib;restbed.lib;libeay32.lib;ssleay32.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalLibraryDirectories>$(ProjectDir)..\contrib\build\FFmpegInterop\ffmpeg\Build\Windows10\x64\bin;$(ProjectDir)..\contrib\build\lib\x64;$(ProjectDir)..\contrib\build\boost\stage\lib;$(ProjectDir)..\contrib\build\pjproject\pjsip\lib;$(ProjectDir)..\contrib\build\pjproject\pjmedia\lib;$(ProjectDir)..\contrib\build\pjproject\pjlib-util\lib;$(ProjectDir)..\contrib\build\pjproject\third_party\lib;$(ProjectDir)..\contrib\build\pjproject\pjlib\lib;$(ProjectDir)..\contrib\build\pjproject\pjnath\lib;$(ProjectDir)..\contrib\build\libnatpmp\msvc\x64\Release;$(ProjectDir)..\contrib\build\restbed\build\Release;$(ProjectDir)..\contrib\build\restbed\dependency\openssl\out32dll</AdditionalLibraryDirectories> <AdditionalOptions>/ignore:4006 /ignore:4221 %(AdditionalOptions)</AdditionalOptions> <LinkTimeCodeGeneration>true</LinkTimeCodeGeneration> diff --git a/configure.ac b/configure.ac index 1245cd40df0e74bd38dc2996b2080fbed2745dd8..0db2434381c6d06475bc663bd8ea69ff1216d7c8 100644 --- a/configure.ac +++ b/configure.ac @@ -418,8 +418,17 @@ AS_IF([test "x$enable_restbed_old_api" = "xyes"], [ AC_DEFINE([RESTBED_OLD_API], [], [Defined if you use the old restbed API]) ]) -AS_IF([test "x$enable_ringns" != "xno" || test "x$with_restcpp" = "xyes"], -AC_CHECK_LIB(restbed, exit,, AC_MSG_ERROR([Missing restbed files]))); +AS_IF([test "x$enable_ringns" != "xno" || test "x$with_restcpp" = "xyes"], [ + AC_CHECK_LIB(restbed, exit,, AC_MSG_ERROR([Missing restbed files])) + PKG_CHECK_MODULES(LIBCRYPTO, libcrypto,, AC_MSG_ERROR([Missing libcrypto development files])) + PKG_CHECK_MODULES(LIBSSL, libssl,, AC_MSG_ERROR([Missing libssl development files])) + + LIBS="${LIBS} -lssl -lcrypto" + AS_IF([test "${HAVE_WIN32}" = "1"],[ + LIBS="${LIBS} -lssleay32 -leay32" + ]) + ], [] +); AS_IF([test "x$with_restcpp" = "xyes"], [ AS_AC_EXPAND(SBINDIR, $sbindir) diff --git a/contrib/build_all_uwp.bat b/contrib/build_all_uwp.bat index e83698f15a30d9965235053c2e3e9afc4a46ebf8..6af4e3678fe8f90f29163d9adcb9450771659c96 100644 --- a/contrib/build_all_uwp.bat +++ b/contrib/build_all_uwp.bat @@ -61,11 +61,20 @@ set MSYS2_BIN="C:\msys64\usr\bin\bash.exe" call BuildFFmpeg.bat win10 x64 cd ..\.. +rem * build openssl UWP * +cd build\restbed\dependency\openssl +call perl Configure no-asm no-hw no-dso VC-WINUNIVERSAL +call ms\do_winuniversal +call ms\setVSvars universal10.0x64 +call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x64 +call nmake -f ms\ntdll.mak +set PATH=restbed\dependency\openssl\out32dll;%PATH% + rem * build restbed w/asio * -cd build\restbed +cd ..\.. mkdir build cd build -cmake -DBUILD_SSL=OFF -G "Visual Studio 14 2015 Win64" .. +cmake -DBUILD_SSL=ON -G "Visual Studio 14 2015 Win64" .. cmake --build . --target ALL_BUILD --config Release cd ..\.. diff --git a/contrib/src/asio/SHA512SUMS b/contrib/src/asio/SHA512SUMS index 7075eae7c40fcb6de466a60821c94670bfd3edca..1eb007c3d0e71f2b982e5de65f0af03ee695686d 100644 --- a/contrib/src/asio/SHA512SUMS +++ b/contrib/src/asio/SHA512SUMS @@ -1 +1 @@ -a34e17ee3c9ac38de83314f268328f6bee3a2276b459f692f1d83568d65cc037db34e6fd567e379c8ec4ec0bdb36dc04395ae7148f49b7c24a10efbaeaabdd8d asio-f5c570826d2ebf50eb38c44039181946a473148b.tar.gz +cde4a043e24268ffbcea08c6cb5d669fc983631213fe5e7640d0ef58902f6ee2332a4e777accd2a42456eb7c65c1da9c6c0d219f54c407e190ee593d66d8a731 asio-631c4f89dafc771fcaf9ee7aa565ab33168459a6.tar.gz diff --git a/contrib/src/asio/rules.mak b/contrib/src/asio/rules.mak index be1dc04386ce78c43bb0a7ba9332dfa09017daa3..d933a6db556a3aff77ebdd0474c14159f558e068 100644 --- a/contrib/src/asio/rules.mak +++ b/contrib/src/asio/rules.mak @@ -18,8 +18,8 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # -ASIO_VERSION := f5c570826d2ebf50eb38c44039181946a473148b -ASIO_URL := https://github.com/chriskohlhoff/asio/archive/$(ASIO_VERSION).tar.gz +ASIO_VERSION := 631c4f89dafc771fcaf9ee7aa565ab33168459a6 +ASIO_URL := https://github.com/hlysunnaram/asio/archive/$(ASIO_VERSION).tar.gz # Pure dependency of restbed: do not add to PKGS. diff --git a/contrib/src/libressl/SHA512SUMS b/contrib/src/libressl/SHA512SUMS new file mode 100644 index 0000000000000000000000000000000000000000..c4895eaa5e62d82a3adf4e29f656ebcc344bd13a --- /dev/null +++ b/contrib/src/libressl/SHA512SUMS @@ -0,0 +1 @@ +f177ba77d6f1ec6e7d843325997e86ad86b309e3e7aa495a7c0960d97ef838690d78c8200077b08e6f430bf007b28949453e5515f788de19fbcc97057560385f portable-190bd346e75575b9436a2e9e14b28618f0234e1b.tar.gz diff --git a/contrib/src/libressl/getpagesize.patch b/contrib/src/libressl/getpagesize.patch new file mode 100644 index 0000000000000000000000000000000000000000..38a81fffb43a56052ec76a180972f24c2fe06b09 --- /dev/null +++ b/contrib/src/libressl/getpagesize.patch @@ -0,0 +1,28 @@ +From b381d7010e03ada41f36f529468b1ee553a9c765 Mon Sep 17 00:00:00 2001 +From: Sebastien Blin <sebastien.blin@savoirfairelinux.com> +Date: Fri, 9 Mar 2018 12:07:17 -0500 +Subject: [PATCH] fix redefinition of getpagesize + +--- + crypto/compat/getpagesize.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/crypto/compat/getpagesize.c b/crypto/compat/getpagesize.c +index 098efa9..79fcc56 100644 +--- a/crypto/compat/getpagesize.c ++++ b/crypto/compat/getpagesize.c +@@ -6,6 +6,7 @@ + #include <windows.h> + #endif + ++#ifndef __ANDROID__ + int + getpagesize(void) { + #ifdef _MSC_VER +@@ -16,3 +17,4 @@ getpagesize(void) { + return sysconf(_SC_PAGESIZE); + #endif + } ++#endif +-- +2.14.3 diff --git a/contrib/src/libressl/rules.mak b/contrib/src/libressl/rules.mak new file mode 100644 index 0000000000000000000000000000000000000000..a39219b93df3ee558f749f5999979b645a2d45b0 --- /dev/null +++ b/contrib/src/libressl/rules.mak @@ -0,0 +1,53 @@ +# -*- mode: makefile; -*- +# +# Copyright (C) 2018 Savoir-faire Linux Inc. +# +# Author: Sebastien Blin <sebastien.blin@savoirfairelinux.com> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# + +LIBRESSL_VERSION := 190bd346e75575b9436a2e9e14b28618f0234e1b +LIBRESSL_URL := https://github.com/libressl-portable/portable/archive/$(LIBRESSL_VERSION).tar.gz + + +# Pure dependency of restbed: do not add to PKGS. + +$(TARBALLS)/portable-$(LIBRESSL_VERSION).tar.gz: + $(call download,$(LIBRESSL_URL)) + +libressl: portable-$(LIBRESSL_VERSION).tar.gz + $(UNPACK) + $(APPLY) $(SRC)/libressl/getpagesize.patch + $(MOVE) + +.libressl: libressl .sum-libressl + mkdir -p "$(PREFIX)/include" + cd $< && ./autogen.sh +ifdef HAVE_WIN32 + cd $< && CC=i686-w64-mingw32-gcc CPPFLAGS=-D__MINGW_USE_VC2005_COMPAT ./configure --host=i686-w64-mingw32 && $(MAKE) && DESTDIR=$(PREFIX) $(MAKE) install +else ifdef HAVE_WIN64 + cd $< && CC=x86_64-w64-mingw32-gcc ./configure --host=x86_64-w64-mingw32 && $(MAKE) && DESTDIR=$(PREFIX) $(MAKE) install +else ifeq ($(IOS_TARGET_PLATFORM),iPhoneOS) + cd $< && mkdir build && cd build && $(CMAKE) -DDESTDIR=$(PREFIX) -DCMAKE_C_FLAGS='-miphoneos-version-min=9.3 -fembed-bitcode -arch arm64' .. && $(MAKE) && $(MAKE) install +else ifeq ($(IOS_TARGET_PLATFORM),iPhoneSimulator) + cd $< && mkdir build && cd build && $(CMAKE) -DDESTDIR=$(PREFIX) -DCMAKE_C_FLAGS='-miphoneos-version-min=9.3 -fembed-bitcode -arch x86_64' .. && $(MAKE) && $(MAKE) install +else + cd $< && mkdir build && cd build && $(CMAKE) -DDESTDIR=$(PREFIX) .. && $(MAKE) && $(MAKE) install +endif + rm -rf $(PREFIX)/lib/*.so $(PREFIX)/lib/*.so.* + touch $@ + +.sum-libressl: portable-$(LIBRESSL_VERSION).tar.gz diff --git a/contrib/src/restbed/fetch_and_patch.bat b/contrib/src/restbed/fetch_and_patch.bat index 95729d6464bcf7982a9c5ab4e85832041b4f1dfb..fa1423947ed5f05f7a6694a537fcc866eaffd7a7 100644 --- a/contrib/src/restbed/fetch_and_patch.bat +++ b/contrib/src/restbed/fetch_and_patch.bat @@ -11,6 +11,8 @@ if %USE_CACHE%==1 ( wget %RESTBED_URL% ) +rem ------------ restbed ------------ + 7z -y x %RESTBED_VERSION%.tar.gz && 7z -y x %RESTBED_VERSION%.tar -o%BUILD% del %RESTBED_VERSION%.tar && del %RESTBED_VERSION%.tar.gz && del %BUILD%\pax_global_header rename %BUILD%\restbed-%RESTBED_VERSION% restbed @@ -25,6 +27,8 @@ rmdir /s /q %BUILD%\restbed\dependency mkdir %BUILD%\restbed\dependency cd %BUILD%\restbed\dependency +rem ------------ asio ------------ + set ASIO_VERSION=276846097ab5073b67e772dbdfa12596224a54a5 set ASIO_URL=https://github.com/Corvusoft/asio-dependency/archive/%ASIO_VERSION%.tar.gz @@ -40,9 +44,10 @@ rename asio-dependency-%ASIO_VERSION% asio cd asio git apply --reject --whitespace=fix %SRC%\restbed\asio-uwp.patch - cd .. +rem ------------ catch ------------ + set CATCH_VERSION=35f510545d55a831372d3113747bf1314ff4f2ef set CATCH_URL=https://github.com/Corvusoft/catch-dependency/archive/%CATCH_VERSION%.tar.gz @@ -56,6 +61,23 @@ if %USE_CACHE%==1 ( del %CATCH_VERSION%.tar && del %CATCH_VERSION%.tar.gz && del pax_global_header rename catch-dependency-%CATCH_VERSION% catch +rem ------------ openssl ------------ + +set OPENSSL_VERSION=c7ba244789ce9f9b6675ff88e61dd5d5e5cac53e +set OPENSSL_URL=https://github.com/Microsoft/openssl/archive/%OPENSSL_VERSION%.tar.gz + +if %USE_CACHE%==1 ( + copy %CACHE_DIR%\%OPENSSL_VERSION%.tar.gz %cd% +) else ( + wget %OPENSSL_URL% +) + +7z -y x %OPENSSL_VERSION%.tar.gz && 7z -y x %OPENSSL_VERSION%.tar +del %OPENSSL_VERSION%.tar && del %OPENSSL_VERSION%.tar.gz && del pax_global_header +rename openssl-%OPENSSL_VERSION% openssl + +rem ------------ kashmir ------------ + set KASHMIR_VERSION=2f3913f49c4ac7f9bff9224db5178f6f8f0ff3ee set KASHMIR_URL=https://github.com/corvusoft/kashmir-dependency/archive/%KASHMIR_VERSION%.tar.gz diff --git a/contrib/src/restbed/findkashmir.patch b/contrib/src/restbed/findkashmir.patch deleted file mode 100644 index c890fcb2bb8b14d07a2a2b8c236cd30b02a2cab8..0000000000000000000000000000000000000000 --- a/contrib/src/restbed/findkashmir.patch +++ /dev/null @@ -1,16 +0,0 @@ ---- a/cmake/modules/Findkashmir.cmake 2017-06-02 12:01:30.415787179 -0400 -+++ b/cmake/modules/Findkashmir.cmake 2017-06-02 12:01:33.329120391 -0400 -@@ -1,11 +1,2 @@ --# Copyright 2014-2016, Corvusoft Ltd, All Rights Reserved. -- --find_path( kashmir_INCLUDE kashmir HINTS "${PROJECT_SOURCE_DIR}/dependency/kashmir" "/usr/include" "/usr/local/include" "/opt/local/include" ) -- --if ( kashmir_INCLUDE ) -- set( KASHMIR_FOUND TRUE ) -- -- message( STATUS "${Green}Found Kashmir include at: ${kashmir_INCLUDE}${Reset}" ) --else ( ) -- message( FATAL_ERROR "${Red}Failed to locate Kashmir dependency.${Reset}" ) --endif ( ) -+set( KASHMIR_FOUND TRUE ) -+set( kashmir_INCLUDE "${PROJECT_SOURCE_DIR}/dependency/kashmir" ) diff --git a/contrib/src/restbed/rules.mak b/contrib/src/restbed/rules.mak index 957a06f8b1b1f087d6c7188482edafd97fb19d98..318c67545357b5408dd9916cc46508ccf0d1aa07 100644 --- a/contrib/src/restbed/rules.mak +++ b/contrib/src/restbed/rules.mak @@ -20,7 +20,7 @@ # RESTBED_VERSION := df867a858dddc4cf6ca8642da02720bd65ba239a -RESTBED_URL := https://github.com/corvusoft//restbed/archive/$(RESTBED_VERSION).tar.gz +RESTBED_URL := https://github.com/corvusoft/restbed/archive/$(RESTBED_VERSION).tar.gz # Pure dependency of OpenDHT: do not add to PKGS. @@ -31,11 +31,11 @@ endif $(TARBALLS)/restbed-$(RESTBED_VERSION).tar.gz: $(call download,$(RESTBED_URL)) -DEPS_restbed = asio kashmir-dependency +DEPS_restbed = asio kashmir-dependency libressl RESTBED_CONF = -DBUILD_TESTS=NO \ -DBUILD_EXAMPLES=NO \ - -DBUILD_SSL=NO \ + -DBUILD_SSL=YES \ -DBUILD_SHARED=NO \ -DCMAKE_INCLUDE_PATH=$(PREFIX)/include \ -DCMAKE_INSTALL_PREFIX=$(PREFIX) \ diff --git a/src/ringdht/namedirectory.cpp b/src/ringdht/namedirectory.cpp index 598872005766db67bbdd7c90de2d4bb8e654f228..c5f2033dc9a1a3144b2b1a49ad21b5981fc13b3a 100644 --- a/src/ringdht/namedirectory.cpp +++ b/src/ringdht/namedirectory.cpp @@ -36,7 +36,7 @@ namespace ring { constexpr const char* const QUERY_NAME {"/name/"}; constexpr const char* const QUERY_ADDR {"/addr/"}; -constexpr const char* const HTTP_PROTO {"http://"}; +constexpr const char* const HTTPS_PROTO {"https://"}; /** Parser for Ring URIs. ( protocol ) ( username ) ( hostname ) */ const std::regex URI_VALIDATOR {"^([a-zA-Z]+:(?://)?)?(?:([a-z0-9-_]{1,64})@)?([a-zA-Z0-9\\-._~%!$&'()*+,;=:\\[\\]]+)"}; @@ -106,7 +106,7 @@ void NameDirectory::lookupAddress(const std::string& addr, LookupCallback cb) return; } - restbed::Uri uri(HTTP_PROTO + serverHost_ + QUERY_ADDR + addr); + restbed::Uri uri(HTTPS_PROTO + serverHost_ + QUERY_ADDR + addr); auto req = std::make_shared<restbed::Request>(uri); req->set_header("Accept", "*/*"); req->set_header("Host", serverHost_); @@ -177,7 +177,7 @@ void NameDirectory::lookupName(const std::string& n, LookupCallback cb) return; } - restbed::Uri uri(HTTP_PROTO + serverHost_ + QUERY_NAME + name); + restbed::Uri uri(HTTPS_PROTO + serverHost_ + QUERY_NAME + name); auto request = std::make_shared<restbed::Request>(std::move(uri)); request->set_header("Accept", "*/*"); request->set_header("Host", serverHost_); @@ -258,7 +258,7 @@ void NameDirectory::registerName(const std::string& addr, const std::string& n, return; } - auto request = std::make_shared<restbed::Request>(restbed::Uri(HTTP_PROTO + serverHost_ + QUERY_NAME + name)); + auto request = std::make_shared<restbed::Request>(restbed::Uri(HTTPS_PROTO + serverHost_ + QUERY_NAME + name)); request->set_header("Accept", "*/*"); request->set_header("Host", serverHost_); request->set_header("Content-Type", "application/json");