Added librtmp.
This commit is contained in:
parent
51beec7ec6
commit
aa698d7035
78
build.sh
78
build.sh
@ -33,32 +33,32 @@ esac
|
||||
readonly BASE_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
|
||||
readonly LIBS_DIR="${BASE_DIR}/.local/${MY_CPU}"
|
||||
find "${BASE_DIR}" -maxdepth 1 -type d -name "*-${MY_CPU}" -exec rm -rf "{}" \;
|
||||
rm -rf "${LIBS_DIR}" && mkdir -p "${LIBS_DIR}/bin" "${LIBS_DIR}/include" "${LIBS_DIR}/lib/pkgconfig" "${LIBS_DIR}/share"
|
||||
rm -rf "${LIBS_DIR}" && mkdir -p "${LIBS_DIR}/.pkg" "${LIBS_DIR}/bin" "${LIBS_DIR}/include" "${LIBS_DIR}/lib/pkgconfig" "${LIBS_DIR}/share"
|
||||
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
# Download
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
wget -4 -P "${LIBS_DIR}" https://zlib.net/zlib-1.2.11.tar.gz
|
||||
wget -4 -P "${LIBS_DIR}" https://github.com/facebook/zstd/releases/download/v1.5.0/zstd-1.5.0.tar.gz
|
||||
wget -4 -P "${LIBS_DIR}" https://github.com/google/brotli/archive/v1.0.9/brotli-1.0.9.tar.gz
|
||||
wget -4 -P "${LIBS_DIR}" https://www.openssl.org/source/openssl-1.1.1k.tar.gz
|
||||
wget -4 -P "${LIBS_DIR}" https://www.libssh2.org/download/libssh2-1.9.0.tar.gz
|
||||
wget -4 -P "${LIBS_DIR}" https://github.com/nghttp2/nghttp2/releases/download/v1.43.0/nghttp2-1.43.0.tar.gz
|
||||
wget -4 -P "${LIBS_DIR}" https://ftp.gnu.org/gnu/libidn/libidn2-2.3.1.tar.gz
|
||||
wget -4 -P "${LIBS_DIR}" https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.16.tar.gz
|
||||
wget -4 -P "${LIBS_DIR}" https://ftp.gnu.org/gnu/gsasl/libgsasl-1.10.0.tar.gz
|
||||
wget -4 -P "${LIBS_DIR}" https://curl.se/download/curl-7.77.0.tar.gz
|
||||
wget -4 -P "${LIBS_DIR}" https://curl.se/ca/cacert.pem
|
||||
wget -4 -P "${LIBS_DIR}" https://curl.se/docs/manpage.html
|
||||
wget -4 -O "${LIBS_DIR}/.pkg/zlib.tar.gz" https://zlib.net/zlib-1.2.11.tar.gz
|
||||
wget -4 -O "${LIBS_DIR}/.pkg/zstd.tar.gz" https://github.com/facebook/zstd/releases/download/v1.5.0/zstd-1.5.0.tar.gz
|
||||
wget -4 -O "${LIBS_DIR}/.pkg/brotli.tar.gz" https://github.com/google/brotli/archive/v1.0.9/brotli-1.0.9.tar.gz
|
||||
wget -4 -O "${LIBS_DIR}/.pkg/openssl.tar.gz" https://www.openssl.org/source/openssl-1.1.1k.tar.gz
|
||||
wget -4 -O "${LIBS_DIR}/.pkg/rtmpdump.tar.gz" http://git.ffmpeg.org/gitweb/rtmpdump.git/snapshot/f1b83c10d8beb43fcc70a6e88cf4325499f25857.tar.gz
|
||||
wget -4 -O "${LIBS_DIR}/.pkg/libssh2.tar.gz" https://www.libssh2.org/download/libssh2-1.9.0.tar.gz
|
||||
wget -4 -O "${LIBS_DIR}/.pkg/nghttp2.tar.gz" https://github.com/nghttp2/nghttp2/releases/download/v1.43.0/nghttp2-1.43.0.tar.gz
|
||||
wget -4 -O "${LIBS_DIR}/.pkg/libidn2.tar.gz" https://ftp.gnu.org/gnu/libidn/libidn2-2.3.1.tar.gz
|
||||
wget -4 -O "${LIBS_DIR}/.pkg/libiconv.tar.gz" https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.16.tar.gz
|
||||
wget -4 -O "${LIBS_DIR}/.pkg/libgsasl.tar.gz" https://ftp.gnu.org/gnu/gsasl/libgsasl-1.10.0.tar.gz
|
||||
wget -4 -O "${LIBS_DIR}/.pkg/curl.tar.gz" https://curl.se/download/curl-7.77.0.tar.gz
|
||||
wget -4 -O "${LIBS_DIR}/.pkg/cacert.pem" https://curl.se/ca/cacert.pem
|
||||
wget -4 -O "${LIBS_DIR}/.pkg/manpage.html" https://curl.se/docs/manpage.html
|
||||
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
# zlib
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
printf "\n==================== zlib ====================\n\n"
|
||||
readonly ZLIB_DIR="${BASE_DIR}/zlib-${MY_CPU}"
|
||||
pkg_zlib="$(find "${LIBS_DIR}" -maxdepth 1 -name 'zlib-*.tar.gz' | sort -rn | head -n1)"
|
||||
rm -rf "${ZLIB_DIR}" && mkdir "${ZLIB_DIR}"
|
||||
tar -xvf "${pkg_zlib}" --strip-components=1 -C "${ZLIB_DIR}"
|
||||
tar -xvf "${LIBS_DIR}/.pkg/zlib.tar.gz" --strip-components=1 -C "${ZLIB_DIR}"
|
||||
pushd "${ZLIB_DIR}"
|
||||
make -f win32/Makefile.gcc LOC="-march=${MY_MARCH} -mtune=${MY_MTUNE} -D_WIN32_WINNT=0x0501"
|
||||
make -f win32/Makefile.gcc install BINARY_PATH="${LIBS_DIR}/include" INCLUDE_PATH="${LIBS_DIR}/include" LIBRARY_PATH="${LIBS_DIR}/lib"
|
||||
@ -69,9 +69,8 @@ popd
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
printf "\n==================== Zstandard ====================\n\n"
|
||||
readonly ZSTD_DIR="${BASE_DIR}/zstd-${MY_CPU}"
|
||||
pkg_zstd="$(find "${LIBS_DIR}" -maxdepth 1 -name 'zstd-*.tar.gz' | sort -rn | head -n1)"
|
||||
rm -rf "${ZSTD_DIR}" && mkdir "${ZSTD_DIR}"
|
||||
tar -xvf "${pkg_zstd}" --strip-components=1 -C "${ZSTD_DIR}"
|
||||
tar -xvf "${LIBS_DIR}/.pkg/zstd.tar.gz" --strip-components=1 -C "${ZSTD_DIR}"
|
||||
pushd "${ZSTD_DIR}"
|
||||
CFLAGS="-march=${MY_MARCH} -mtune=${MY_MTUNE} -D_WIN32_WINNT=0x0501 -I${LIBS_DIR}/include" LDFLAGS="-L${LIBS_DIR}/lib" make lib
|
||||
cp -vf lib/libzstd.a "${LIBS_DIR}/lib"
|
||||
@ -84,9 +83,8 @@ popd
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
printf "\n==================== Brotli ====================\n\n"
|
||||
readonly BROT_DIR="${BASE_DIR}/brotli-${MY_CPU}"
|
||||
pkg_brot="$(find "${LIBS_DIR}" -maxdepth 1 -name 'brotli-*.tar.gz' | sort -rn | head -n1)"
|
||||
rm -rf "${BROT_DIR}" && mkdir "${BROT_DIR}"
|
||||
tar -xvf "${pkg_brot}" --strip-components=1 -C "${BROT_DIR}"
|
||||
tar -xvf "${LIBS_DIR}/.pkg/brotli.tar.gz" --strip-components=1 -C "${BROT_DIR}"
|
||||
pushd "${BROT_DIR}"
|
||||
CFLAGS="-march=${MY_MARCH} -mtune=${MY_MTUNE} -D_WIN32_WINNT=0x0501 -I${LIBS_DIR}/include" LDFLAGS="-L${LIBS_DIR}/lib" make lib
|
||||
mkdir -p "${LIBS_DIR}/include/brotli"
|
||||
@ -102,9 +100,8 @@ popd
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
printf "\n==================== OpenSSL ====================\n\n"
|
||||
readonly OSSL_DIR="${BASE_DIR}/openssl-${MY_CPU}"
|
||||
pkg_ossl="$(find "${LIBS_DIR}" -maxdepth 1 -name 'openssl-*.tar.gz' | sort -rn | head -n1)"
|
||||
rm -rf "${OSSL_DIR}" && mkdir "${OSSL_DIR}"
|
||||
tar -xvf "${pkg_ossl}" --strip-components=1 -C "${OSSL_DIR}"
|
||||
tar -xvf "${LIBS_DIR}/.pkg/openssl.tar.gz" --strip-components=1 -C "${OSSL_DIR}"
|
||||
[[ "${MY_CPU}" == "x64" ]] && readonly ossl_flag="no-sse2" || readonly ossl_flag="386"
|
||||
[[ "${MY_CPU}" == "x64" ]] && readonly ossl_mngw="mingw64" || readonly ossl_mngw="mingw"
|
||||
pushd "${OSSL_DIR}"
|
||||
@ -112,14 +109,26 @@ pushd "${OSSL_DIR}"
|
||||
make build_libs && make install_dev
|
||||
popd
|
||||
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
# librtmp
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
printf "\n==================== librtmp ====================\n\n"
|
||||
readonly RTMP_DIR="${BASE_DIR}/librtmp-${MY_CPU}"
|
||||
rm -rf "${RTMP_DIR}" && mkdir "${RTMP_DIR}"
|
||||
tar -xvf "${LIBS_DIR}/.pkg/rtmpdump.tar.gz" --strip-components=1 -C "${RTMP_DIR}"
|
||||
pushd "${RTMP_DIR}"
|
||||
patch -p1 -b < "${BASE_DIR}/patch/librtmp_openssl.diff"
|
||||
make SYS=mingw SHARED= prefix="${LIBS_DIR}" XCFLAGS="-march=${MY_MARCH} -mtune=${MY_MTUNE} -D_WIN32_WINNT=0x0501 -I${LIBS_DIR}/include" XLDFLAGS="-L${LIBS_DIR}/lib" XLIBS="-latomic -lws2_32"
|
||||
make SYS=mingw SHARED= prefix="${LIBS_DIR}" install
|
||||
popd
|
||||
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
# libssh2
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
printf "\n==================== libssh2 ====================\n\n"
|
||||
readonly SSH2_DIR="${BASE_DIR}/libssh2-${MY_CPU}"
|
||||
pkg_ssh2="$(find "${LIBS_DIR}" -maxdepth 1 -name 'libssh2-*.tar.gz' | sort -rn | head -n1)"
|
||||
rm -rf "${SSH2_DIR}" && mkdir "${SSH2_DIR}"
|
||||
tar -xvf "${pkg_ssh2}" --strip-components=1 -C "${SSH2_DIR}"
|
||||
tar -xvf "${LIBS_DIR}/.pkg/libssh2.tar.gz" --strip-components=1 -C "${SSH2_DIR}"
|
||||
pushd "${SSH2_DIR}"
|
||||
patch -p1 -b < "${BASE_DIR}/patch/ssh2_session.diff"
|
||||
CFLAGS="-march=${MY_MARCH} -mtune=${MY_MTUNE} -D_WIN32_WINNT=0x0501 -I${LIBS_DIR}/include" LDFLAGS="-L${LIBS_DIR}/lib" LIBS="-latomic" ./configure --prefix="${LIBS_DIR}" --disable-examples-build --disable-shared --with-libz
|
||||
@ -131,9 +140,8 @@ popd
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
printf "\n==================== nghttp2 ====================\n\n"
|
||||
readonly NGH2_DIR="${BASE_DIR}/nghttp2-${MY_CPU}"
|
||||
pkg_ngh2="$(find "${LIBS_DIR}" -maxdepth 1 -name 'nghttp2-*.tar.gz' | sort -rn | head -n1)"
|
||||
rm -rf "${NGH2_DIR}" && mkdir "${NGH2_DIR}"
|
||||
tar -xvf "${pkg_ngh2}" --strip-components=1 -C "${NGH2_DIR}"
|
||||
tar -xvf "${LIBS_DIR}/.pkg/nghttp2.tar.gz" --strip-components=1 -C "${NGH2_DIR}"
|
||||
pushd "${NGH2_DIR}"
|
||||
CFLAGS="-march=${MY_MARCH} -mtune=${MY_MTUNE} -D_WIN32_WINNT=0x0501 -I${LIBS_DIR}/include" LDFLAGS="-L${LIBS_DIR}/lib" OPENSSL_CFLAGS="-I${LIBS_DIR}/include" OPENSSL_LIBS="-L${LIBS_DIR}/lib -lssl -lcrypto" ZLIB_CFLAGS="-I${LIBS_DIR}/include" ZLIB_LIBS="-L${LIBS_DIR}/lib -lz" ./configure --prefix="${LIBS_DIR}" --enable-lib-only --disable-threads --disable-shared
|
||||
make && make install
|
||||
@ -144,9 +152,8 @@ popd
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
printf "\n==================== libiconv ====================\n\n"
|
||||
readonly ICNV_DIR="${BASE_DIR}/libiconv-${MY_CPU}"
|
||||
pkg_icnv="$(find "${LIBS_DIR}" -maxdepth 1 -name 'libiconv-*.tar.gz' | sort -rn | head -n1)"
|
||||
rm -rf "${ICNV_DIR}" && mkdir "${ICNV_DIR}"
|
||||
tar -xvf "${pkg_icnv}" --strip-components=1 -C "${ICNV_DIR}"
|
||||
tar -xvf "${LIBS_DIR}/libiconv.tar.gz" --strip-components=1 -C "${ICNV_DIR}"
|
||||
pushd "${ICNV_DIR}"
|
||||
CFLAGS="-march=${MY_MARCH} -mtune=${MY_MTUNE} -D_WIN32_WINNT=0x0501 -I${LIBS_DIR}/include" LDFLAGS="-L${LIBS_DIR}/lib" ./configure --prefix="${LIBS_DIR}" --disable-rpath --disable-shared
|
||||
make && make install
|
||||
@ -157,9 +164,8 @@ popd
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
printf "\n==================== libidn2 ====================\n\n"
|
||||
readonly IDN2_DIR="${BASE_DIR}/libidn2-${MY_CPU}"
|
||||
pkg_idn2="$(find "${LIBS_DIR}" -maxdepth 1 -name 'libidn2-*.tar.gz' | sort -rn | head -n1)"
|
||||
rm -rf "${IDN2_DIR}" && mkdir "${IDN2_DIR}"
|
||||
tar -xvf "${pkg_idn2}" --strip-components=1 -C "${IDN2_DIR}"
|
||||
tar -xvf "${LIBS_DIR}/.pkg/libidn2.tar.gz" --strip-components=1 -C "${IDN2_DIR}"
|
||||
pushd "${IDN2_DIR}"
|
||||
CFLAGS="-march=${MY_MARCH} -mtune=${MY_MTUNE} -D_WIN32_WINNT=0x0501 -I${LIBS_DIR}/include" LDFLAGS="-L${LIBS_DIR}/lib" ./configure --prefix="${LIBS_DIR}" --disable-shared --disable-doc --without-libiconv-prefix --without-libunistring-prefix --disable-valgrind-tests
|
||||
make && make install
|
||||
@ -170,9 +176,8 @@ popd
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
printf "\n==================== libgsasl ====================\n\n"
|
||||
readonly SASL_DIR="${BASE_DIR}/libgsasl-${MY_CPU}"
|
||||
pkg_sasl="$(find "${LIBS_DIR}" -maxdepth 1 -name 'libgsasl-*.tar.gz' | sort -rn | head -n1)"
|
||||
rm -rf "${SASL_DIR}" && mkdir "${SASL_DIR}"
|
||||
tar -xvf "${pkg_sasl}" --strip-components=1 -C "${SASL_DIR}"
|
||||
tar -xvf "${LIBS_DIR}/.pkg/libgsasl.tar.gz" --strip-components=1 -C "${SASL_DIR}"
|
||||
pushd "${SASL_DIR}"
|
||||
patch -p1 -b < "${BASE_DIR}/patch/gsasl_error.diff"
|
||||
CFLAGS="-march=${MY_MARCH} -mtune=${MY_MTUNE} -D_WIN32_WINNT=0x0501 -I${LIBS_DIR}/include" LDFLAGS="-L${LIBS_DIR}/lib" ./configure --prefix="${LIBS_DIR}" --disable-shared --disable-valgrind-tests --disable-obsolete -without-libintl-prefix
|
||||
@ -184,15 +189,14 @@ popd
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
printf "\n==================== cURL ====================\n\n"
|
||||
readonly CURL_DIR="${BASE_DIR}/curl-${MY_CPU}"
|
||||
pkg_curl="$(find "${LIBS_DIR}" -maxdepth 1 -name 'curl-*.tar.gz' | sort -rn | head -n1)"
|
||||
rm -rf "${CURL_DIR}" && mkdir "${CURL_DIR}"
|
||||
tar -xvf ${pkg_curl} --strip-components=1 -C "${CURL_DIR}"
|
||||
tar -xvf "${LIBS_DIR}/.pkg/curl.tar.gz" --strip-components=1 -C "${CURL_DIR}"
|
||||
pushd "${CURL_DIR}"
|
||||
patch -p1 -b < "${BASE_DIR}/patch/curl_threads.diff"
|
||||
patch -p1 -b < "${BASE_DIR}/patch/curl_tool_doswin.diff"
|
||||
patch -p1 -b < "${BASE_DIR}/patch/curl_tool_parsecfg.diff"
|
||||
patch -p1 -b < "${BASE_DIR}/patch/curl_url.diff"
|
||||
CFLAGS="-march=${MY_MARCH} -mtune=${MY_MTUNE} -I${LIBS_DIR}/include" CPPFLAGS="-D_WIN32_WINNT=0x0501 -DNGHTTP2_STATICLIB -DUNICODE -D_UNICODE" LDFLAGS="-static -no-pthread -L${LIBS_DIR}/lib" LIBS="-latomic -liconv -lcrypt32" PKG_CONFIG_PATH="${LIBS_DIR}/lib/pkgconfig" ./configure --enable-static --disable-shared --disable-pthreads --disable-libcurl-option --disable-openssl-auto-load-config --with-zlib --with-zstd --with-brotli --with-openssl --with-libssh2 --with-nghttp2="${LIBS_DIR}" --with-libidn2 --with-gsasl --without-ca-bundle
|
||||
CFLAGS="-march=${MY_MARCH} -mtune=${MY_MTUNE} -I${LIBS_DIR}/include" CPPFLAGS="-D_WIN32_WINNT=0x0501 -DNGHTTP2_STATICLIB -DUNICODE -D_UNICODE" LDFLAGS="-static -no-pthread -L${LIBS_DIR}/lib" LIBS="-latomic -liconv -lcrypt32" PKG_CONFIG_PATH="${LIBS_DIR}/lib/pkgconfig" ./configure --enable-static --disable-shared --disable-pthreads --disable-libcurl-option --disable-openssl-auto-load-config --with-zlib --with-zstd --with-brotli --with-openssl --with-librtmp --with-libssh2 --with-nghttp2="${LIBS_DIR}" --with-libidn2 --with-gsasl --without-ca-bundle
|
||||
make curl_LDFLAGS="-all-static -municode -mconsole"
|
||||
strip -s src/curl.exe
|
||||
popd
|
||||
@ -204,9 +208,9 @@ printf "\n==================== Output ====================\n\n"
|
||||
readonly OUT_DIR="${BASE_DIR}/.bin/${MY_CPU}"
|
||||
rm -rf "${OUT_DIR}" && mkdir -p "${OUT_DIR}"
|
||||
pushd "${OUT_DIR}"
|
||||
cp -vf "${CURL_DIR}/src/curl.exe" curl.exe
|
||||
cp -vf "${LIBS_DIR}/cacert.pem" curl-ca-bundle.crt
|
||||
cp -vf "${LIBS_DIR}/manpage.html" manpage.html
|
||||
cp -vf "${CURL_DIR}/src/curl.exe" curl.exe
|
||||
cp -vf "${LIBS_DIR}/.pkg/cacert.pem" curl-ca-bundle.crt
|
||||
cp -vf "${LIBS_DIR}/.pkg/manpage.html" manpage.html
|
||||
sed -n "/Configured to build curl\/libcurl:$/,/^[[:space:]]*Features:/p" "${CURL_DIR}/config.log" | sed -r "s/configure:[[:digit:]]+://" | sed -r "s/^[[:blank:]]*//" | unix2dos > config.log
|
||||
mkdir -p "${OUT_DIR}/legal"
|
||||
unix2dos -n "${BROT_DIR}/LICENSE" legal/brotli.LICENSE.txt
|
||||
|
350
patch/librtmp_openssl.diff
Normal file
350
patch/librtmp_openssl.diff
Normal file
@ -0,0 +1,350 @@
|
||||
librtmp/dh.h | 60 +++++++++++++++++++++++++++++++++--------------------
|
||||
librtmp/handshake.h | 14 ++++++++-----
|
||||
librtmp/hashswf.c | 10 ++++-----
|
||||
librtmp/rtmp.c | 10 ++++-----
|
||||
librtmp/rtmp_sys.h | 2 +-
|
||||
rtmpsrv.c | 6 +++---
|
||||
rtmpsuck.c | 16 +++++++-------
|
||||
thread.c | 6 +++---
|
||||
8 files changed, 72 insertions(+), 52 deletions(-)
|
||||
|
||||
diff --git a/librtmp/dh.h b/librtmp/dh.h
|
||||
index 5fc3f32..28d727c 100644
|
||||
--- a/librtmp/dh.h
|
||||
+++ b/librtmp/dh.h
|
||||
@@ -194,7 +194,7 @@ typedef BIGNUM * MP_t;
|
||||
|
||||
/* RFC 2631, Section 2.1.5, http://www.ietf.org/rfc/rfc2631.txt */
|
||||
static int
|
||||
-isValidPublicKey(MP_t y, MP_t p, MP_t q)
|
||||
+isValidPublicKey(const BIGNUM *y, const BIGNUM *p, const BIGNUM *q)
|
||||
{
|
||||
int ret = TRUE;
|
||||
MP_t bn;
|
||||
@@ -234,9 +234,9 @@ isValidPublicKey(MP_t y, MP_t p, MP_t q)
|
||||
MP_modexp(bn, y, q, p);
|
||||
|
||||
if (MP_cmp_1(bn) != 0)
|
||||
- {
|
||||
- RTMP_Log(RTMP_LOGWARNING, "DH public key does not fulfill y^q mod p = 1");
|
||||
- }
|
||||
+ {
|
||||
+ RTMP_Log(RTMP_LOGWARNING, "DH public key does not fulfill y^q mod p = 1");
|
||||
+ }
|
||||
}
|
||||
|
||||
failed:
|
||||
@@ -253,20 +253,22 @@ DHInit(int nKeyBits)
|
||||
if (!dh)
|
||||
goto failed;
|
||||
|
||||
- MP_new(dh->g);
|
||||
+ BIGNUM *g = BN_new(); /*MP_new(dh->g);*/
|
||||
|
||||
- if (!dh->g)
|
||||
+ if (!g) /*(!dh->g)*/
|
||||
goto failed;
|
||||
|
||||
- MP_gethex(dh->p, P1024, res); /* prime P1024, see dhgroups.h */
|
||||
+ BIGNUM *p;
|
||||
+ res = BN_hex2bn(&p, P1024); /*MP_gethex(dh->p, P1024, res);*/ /* prime P1024, see dhgroups.h */
|
||||
if (!res)
|
||||
{
|
||||
goto failed;
|
||||
}
|
||||
|
||||
- MP_set_w(dh->g, 2); /* base 2 */
|
||||
+ BN_set_word(g, 2); /*MP_set_w(dh->g, 2);*/ /* base 2 */
|
||||
|
||||
- dh->length = nKeyBits;
|
||||
+ DH_set0_pqg(dh, p, NULL, g);
|
||||
+ DH_set_length(dh, nKeyBits); /*dh->length = nKeyBits;*/
|
||||
return dh;
|
||||
|
||||
failed:
|
||||
@@ -286,20 +288,24 @@ DHGenerateKey(MDH *dh)
|
||||
while (!res)
|
||||
{
|
||||
MP_t q1 = NULL;
|
||||
+ const BIGNUM *p, *q, *g, *pub_key, *priv_key;
|
||||
|
||||
if (!MDH_generate_key(dh))
|
||||
- return 0;
|
||||
+ return 0;
|
||||
|
||||
MP_gethex(q1, Q1024, res);
|
||||
assert(res);
|
||||
|
||||
- res = isValidPublicKey(dh->pub_key, dh->p, q1);
|
||||
+ DH_get0_key(dh, &pub_key, &priv_key);
|
||||
+ DH_get0_pqg(dh, &p, &q, &g);
|
||||
+
|
||||
+ res = isValidPublicKey(pub_key, p, q1);
|
||||
if (!res)
|
||||
- {
|
||||
- MP_free(dh->pub_key);
|
||||
- MP_free(dh->priv_key);
|
||||
- dh->pub_key = dh->priv_key = 0;
|
||||
- }
|
||||
+ {
|
||||
+ /*MP_free(dh->pub_key);*/
|
||||
+ /*MP_free(dh->priv_key);*/
|
||||
+ /*dh->pub_key = dh->priv_key = 0;*/
|
||||
+ }
|
||||
|
||||
MP_free(q1);
|
||||
}
|
||||
@@ -311,18 +317,25 @@ DHGenerateKey(MDH *dh)
|
||||
*/
|
||||
|
||||
static int
|
||||
-DHGetPublicKey(MDH *dh, uint8_t *pubkey, size_t nPubkeyLen)
|
||||
+DHGetPublicKey(MDH *dh, uint8_t *pubkey_out, size_t nPubkeyLen)
|
||||
{
|
||||
int len;
|
||||
- if (!dh || !dh->pub_key)
|
||||
+ const BIGNUM *pub_key, *priv_key;
|
||||
+
|
||||
+ if (!dh) /*|| !dh->pub_key*/
|
||||
+ return 0;
|
||||
+
|
||||
+ DH_get0_key(dh, &pub_key, &priv_key);
|
||||
+ if (!pub_key)
|
||||
return 0;
|
||||
|
||||
- len = MP_bytes(dh->pub_key);
|
||||
+
|
||||
+ len = MP_bytes(pub_key); /*dh->pub_key*/
|
||||
if (len <= 0 || len > (int) nPubkeyLen)
|
||||
return 0;
|
||||
|
||||
- memset(pubkey, 0, nPubkeyLen);
|
||||
- MP_setbin(dh->pub_key, pubkey + (nPubkeyLen - len), len);
|
||||
+ memset(pubkey_out, 0, nPubkeyLen);
|
||||
+ BN_bn2bin(pub_key, pubkey_out + (nPubkeyLen - len)); /*MP_setbin(dh->pub_key, pubkey + (nPubkeyLen - len), len);*/
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -353,6 +366,7 @@ DHComputeSharedSecretKey(MDH *dh, uint8_t *pubkey, size_t nPubkeyLen,
|
||||
MP_t q1 = NULL, pubkeyBn = NULL;
|
||||
size_t len;
|
||||
int res;
|
||||
+ const BIGNUM *p, *q, *g;
|
||||
|
||||
if (!dh || !secret || nPubkeyLen >= INT_MAX)
|
||||
return -1;
|
||||
@@ -364,7 +378,9 @@ DHComputeSharedSecretKey(MDH *dh, uint8_t *pubkey, size_t nPubkeyLen,
|
||||
MP_gethex(q1, Q1024, len);
|
||||
assert(len);
|
||||
|
||||
- if (isValidPublicKey(pubkeyBn, dh->p, q1))
|
||||
+ DH_get0_pqg(dh, &p, &q, &g);
|
||||
+
|
||||
+ if (isValidPublicKey(pubkeyBn, p, q1))
|
||||
res = MDH_compute_key(secret, nPubkeyLen, pubkeyBn, dh);
|
||||
else
|
||||
res = -1;
|
||||
diff --git a/librtmp/handshake.h b/librtmp/handshake.h
|
||||
index 0438486..86d3648 100644
|
||||
--- a/librtmp/handshake.h
|
||||
+++ b/librtmp/handshake.h
|
||||
@@ -69,9 +69,9 @@ typedef struct arcfour_ctx* RC4_handle;
|
||||
#if OPENSSL_VERSION_NUMBER < 0x0090800 || !defined(SHA256_DIGEST_LENGTH)
|
||||
#error Your OpenSSL is too old, need 0.9.8 or newer with SHA256
|
||||
#endif
|
||||
-#define HMAC_setup(ctx, key, len) HMAC_CTX_init(&ctx); HMAC_Init_ex(&ctx, key, len, EVP_sha256(), 0)
|
||||
-#define HMAC_crunch(ctx, buf, len) HMAC_Update(&ctx, buf, len)
|
||||
-#define HMAC_finish(ctx, dig, dlen) HMAC_Final(&ctx, dig, &dlen); HMAC_CTX_cleanup(&ctx)
|
||||
+#define HMAC_setup(ctx, key, len) HMAC_CTX_reset(ctx); HMAC_Init_ex(ctx, key, len, EVP_sha256(), 0)
|
||||
+#define HMAC_crunch(ctx, buf, len) HMAC_Update(ctx, buf, len)
|
||||
+#define HMAC_finish(ctx, dig, dlen) HMAC_Final(ctx, dig, &dlen); HMAC_CTX_free(ctx)
|
||||
|
||||
typedef RC4_KEY * RC4_handle;
|
||||
#define RC4_alloc(h) *h = malloc(sizeof(RC4_KEY))
|
||||
@@ -117,7 +117,9 @@ static void InitRC4Encryption
|
||||
{
|
||||
uint8_t digest[SHA256_DIGEST_LENGTH];
|
||||
unsigned int digestLen = 0;
|
||||
- HMAC_CTX ctx;
|
||||
+ HMAC_CTX *ctx = HMAC_CTX_new();
|
||||
+ if(!ctx)
|
||||
+ return;
|
||||
|
||||
RC4_alloc(rc4keyIn);
|
||||
RC4_alloc(rc4keyOut);
|
||||
@@ -266,7 +268,9 @@ HMACsha256(const uint8_t *message, size_t messageLen, const uint8_t *key,
|
||||
size_t keylen, uint8_t *digest)
|
||||
{
|
||||
unsigned int digestLen;
|
||||
- HMAC_CTX ctx;
|
||||
+ HMAC_CTX *ctx = HMAC_CTX_new();
|
||||
+ if(!ctx)
|
||||
+ return;
|
||||
|
||||
HMAC_setup(ctx, key, keylen);
|
||||
HMAC_crunch(ctx, message, messageLen);
|
||||
diff --git a/librtmp/hashswf.c b/librtmp/hashswf.c
|
||||
index 32b2eed..9673863 100644
|
||||
--- a/librtmp/hashswf.c
|
||||
+++ b/librtmp/hashswf.c
|
||||
@@ -57,10 +57,10 @@
|
||||
#include <openssl/sha.h>
|
||||
#include <openssl/hmac.h>
|
||||
#include <openssl/rc4.h>
|
||||
-#define HMAC_setup(ctx, key, len) HMAC_CTX_init(&ctx); HMAC_Init_ex(&ctx, (unsigned char *)key, len, EVP_sha256(), 0)
|
||||
-#define HMAC_crunch(ctx, buf, len) HMAC_Update(&ctx, (unsigned char *)buf, len)
|
||||
-#define HMAC_finish(ctx, dig, dlen) HMAC_Final(&ctx, (unsigned char *)dig, &dlen);
|
||||
-#define HMAC_close(ctx) HMAC_CTX_cleanup(&ctx)
|
||||
+#define HMAC_setup(ctx, key, len) HMAC_CTX_reset(ctx); HMAC_Init_ex(ctx, (unsigned char *)key, len, EVP_sha256(), 0)
|
||||
+#define HMAC_crunch(ctx, buf, len) HMAC_Update(ctx, (unsigned char *)buf, len)
|
||||
+#define HMAC_finish(ctx, dig, dlen) HMAC_Final(ctx, (unsigned char *)dig, &dlen);
|
||||
+#define HMAC_close(ctx) HMAC_CTX_free(ctx)
|
||||
#endif
|
||||
|
||||
extern void RTMP_TLS_Init();
|
||||
@@ -298,7 +298,7 @@ leave:
|
||||
struct info
|
||||
{
|
||||
z_stream *zs;
|
||||
- HMAC_CTX ctx;
|
||||
+ HMAC_CTX *ctx;
|
||||
int first;
|
||||
int zlib;
|
||||
int size;
|
||||
diff --git a/librtmp/rtmp.c b/librtmp/rtmp.c
|
||||
index 0865689..df65bee 100644
|
||||
--- a/librtmp/rtmp.c
|
||||
+++ b/librtmp/rtmp.c
|
||||
@@ -1902,7 +1902,7 @@ SendFCUnpublish(RTMP *r)
|
||||
|
||||
SAVC(publish);
|
||||
SAVC(live);
|
||||
-SAVC(record);
|
||||
+/*SAVC(record);*/
|
||||
|
||||
static int
|
||||
SendPublish(RTMP *r)
|
||||
@@ -2904,8 +2904,8 @@ AVC("NetStream.Play.PublishNotify");
|
||||
static const AVal av_NetStream_Play_UnpublishNotify =
|
||||
AVC("NetStream.Play.UnpublishNotify");
|
||||
static const AVal av_NetStream_Publish_Start = AVC("NetStream.Publish.Start");
|
||||
-static const AVal av_NetConnection_Connect_Rejected =
|
||||
-AVC("NetConnection.Connect.Rejected");
|
||||
+/*static const AVal av_NetConnection_Connect_Rejected =
|
||||
+AVC("NetConnection.Connect.Rejected"); */
|
||||
|
||||
/* Returns 0 for OK/Failed/error, 1 for 'Stop or Complete' */
|
||||
static int
|
||||
@@ -3552,7 +3552,7 @@ RTMP_ReadPacket(RTMP *r, RTMPPacket *packet)
|
||||
uint8_t hbuf[RTMP_MAX_HEADER_SIZE] = { 0 };
|
||||
char *header = (char *)hbuf;
|
||||
int nSize, hSize, nToRead, nChunk;
|
||||
- int didAlloc = FALSE;
|
||||
+ /*int didAlloc = FALSE;*/
|
||||
int extendedTimestamp;
|
||||
|
||||
RTMP_Log(RTMP_LOGDEBUG2, "%s: fd=%d", __FUNCTION__, r->m_sb.sb_socket);
|
||||
@@ -3679,7 +3679,7 @@ RTMP_ReadPacket(RTMP *r, RTMPPacket *packet)
|
||||
RTMP_Log(RTMP_LOGDEBUG, "%s, failed to allocate packet", __FUNCTION__);
|
||||
return FALSE;
|
||||
}
|
||||
- didAlloc = TRUE;
|
||||
+ /*didAlloc = TRUE;*/
|
||||
packet->m_headerType = (hbuf[0] & 0xc0) >> 6;
|
||||
}
|
||||
|
||||
diff --git a/librtmp/rtmp_sys.h b/librtmp/rtmp_sys.h
|
||||
index 85d7e53..048f538 100644
|
||||
--- a/librtmp/rtmp_sys.h
|
||||
+++ b/librtmp/rtmp_sys.h
|
||||
@@ -37,7 +37,7 @@
|
||||
#define GetSockError() WSAGetLastError()
|
||||
#define SetSockError(e) WSASetLastError(e)
|
||||
#define setsockopt(a,b,c,d,e) (setsockopt)(a,b,c,(const char *)d,(int)e)
|
||||
-#define EWOULDBLOCK WSAETIMEDOUT /* we don't use nonblocking, but we do use timeouts */
|
||||
+/* #define EWOULDBLOCK WSAETIMEDOUT */ /* we don't use nonblocking, but we do use timeouts */
|
||||
#define sleep(n) Sleep(n*1000)
|
||||
#define msleep(n) Sleep(n)
|
||||
#define SET_RCVTIMEO(tv,s) int tv = s*1000
|
||||
diff --git a/rtmpsrv.c b/rtmpsrv.c
|
||||
index 5df4d3a..0a4166a 100644
|
||||
--- a/rtmpsrv.c
|
||||
+++ b/rtmpsrv.c
|
||||
@@ -152,11 +152,11 @@ SAVC(flashVer);
|
||||
SAVC(swfUrl);
|
||||
SAVC(pageUrl);
|
||||
SAVC(tcUrl);
|
||||
-SAVC(fpad);
|
||||
+/*SAVC(fpad);*/
|
||||
SAVC(capabilities);
|
||||
SAVC(audioCodecs);
|
||||
SAVC(videoCodecs);
|
||||
-SAVC(videoFunction);
|
||||
+/*SAVC(videoFunction);*/
|
||||
SAVC(objectEncoding);
|
||||
SAVC(_result);
|
||||
SAVC(createStream);
|
||||
@@ -167,7 +167,7 @@ SAVC(mode);
|
||||
SAVC(level);
|
||||
SAVC(code);
|
||||
SAVC(description);
|
||||
-SAVC(secureToken);
|
||||
+/*SAVC(secureToken);*/
|
||||
|
||||
static int
|
||||
SendConnectResult(RTMP *r, double txn)
|
||||
diff --git a/rtmpsuck.c b/rtmpsuck.c
|
||||
index e886179..33ffff9 100644
|
||||
--- a/rtmpsuck.c
|
||||
+++ b/rtmpsuck.c
|
||||
@@ -124,21 +124,21 @@ SAVC(flashVer);
|
||||
SAVC(swfUrl);
|
||||
SAVC(pageUrl);
|
||||
SAVC(tcUrl);
|
||||
-SAVC(fpad);
|
||||
-SAVC(capabilities);
|
||||
+/*SAVC(fpad);*/
|
||||
+/*SAVC(capabilities);*/
|
||||
SAVC(audioCodecs);
|
||||
SAVC(videoCodecs);
|
||||
-SAVC(videoFunction);
|
||||
+/*SAVC(videoFunction);*/
|
||||
SAVC(objectEncoding);
|
||||
-SAVC(_result);
|
||||
-SAVC(createStream);
|
||||
+/*SAVC(_result);*/
|
||||
+/*SAVC(createStream);*/
|
||||
SAVC(play);
|
||||
SAVC(closeStream);
|
||||
-SAVC(fmsVer);
|
||||
-SAVC(mode);
|
||||
+/*SAVC(fmsVer);*/
|
||||
+/*SAVC(mode);*/
|
||||
SAVC(level);
|
||||
SAVC(code);
|
||||
-SAVC(secureToken);
|
||||
+/*SAVC(secureToken);*/
|
||||
SAVC(onStatus);
|
||||
SAVC(close);
|
||||
static const AVal av_NetStream_Failed = AVC("NetStream.Failed");
|
||||
diff --git a/thread.c b/thread.c
|
||||
index 0913c98..9de42ea 100644
|
||||
--- a/thread.c
|
||||
+++ b/thread.c
|
||||
@@ -29,13 +29,13 @@
|
||||
HANDLE
|
||||
ThreadCreate(thrfunc *routine, void *args)
|
||||
{
|
||||
- HANDLE thd;
|
||||
+ uintptr_t thd;
|
||||
|
||||
- thd = (HANDLE) _beginthread(routine, 0, args);
|
||||
+ thd = _beginthread(routine, 0, args);
|
||||
if (thd == -1L)
|
||||
RTMP_LogPrintf("%s, _beginthread failed with %d\n", __FUNCTION__, errno);
|
||||
|
||||
- return thd;
|
||||
+ return (HANDLE) thd;
|
||||
}
|
||||
#else
|
||||
pthread_t
|
Loading…
Reference in New Issue
Block a user