Merge pull request #8391 from neheb/n

crtmpserver: Update to official git repo
This commit is contained in:
Rosen Penev 2019-03-26 14:42:21 -07:00 committed by GitHub
commit 98ec089556
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 168 additions and 340 deletions

View File

@ -8,27 +8,27 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=crtmpserver
PKG_REV:=b6fdcdb953d1e99c48a0c37a8c80f2cad2db443b
PKG_VERSION:=2012-07-18+git-$(PKG_REV)
PKG_RELEASE:=4
PKG_SOURCE_DATE:=2015-10-04
PKG_SOURCE_VERSION:=b866fffca37c3b967a8878499cd2b91aa2587f34
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/j0sh/crtmpserver/tar.gz/$(PKG_REV)?
PKG_HASH:=e210eeb99d39334e7beb0a1be27dcf23d1f851383f87cf63d7fb98209ef96cee
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_REV)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_DATE).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/shiretu/crtmpserver/tar.gz/$(PKG_SOURCE_VERSION)?
PKG_HASH:=3744bef060129fda6f7902eb64f566b0d5049864dc542b2882c550b083ef82aa
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_SOURCE_VERSION)
PKG_MAINTAINER:=Thomas Heil <heil@terminal-consulting.de>
PKG_LICENSE:=GPL-3.0
PKG_LICENSE_FILES:=LICENSE
PKG_BUILD_PARALLEL:=1
include $(INCLUDE_DIR)/uclibc++.mk
include $(INCLUDE_DIR)/package.mk
define Package/crtmpserver
SECTION:=multimedia
CATEGORY:=Multimedia
DEPENDS:=$(CXX_DEPENDS) +libopenssl +liblua
DEPENDS:=+libstdcpp +libopenssl +liblua
TITLE:=C++ RTMP Server
endef

View File

@ -1,11 +0,0 @@
--- a/builders/make/compile.mk
+++ b/builders/make/compile.mk
@@ -72,7 +72,7 @@ TINYXML_OBJS = $(TINYXML_SRCS:.cpp=.tiny
#common
COMMON_INCLUDE=$(LUA_INCLUDE) $(TINYXML_INCLUDE) $(SSL_INCLUDE) -I$(PROJECT_BASE_PATH)/sources/common/include
-COMMON_LIBS=$(SSL_LIB) -L$(OUTPUT_DYNAMIC) -llua -ltinyxml
+COMMON_LIBS=$(SSL_LIB) -L$(OUTPUT_DYNAMIC) -llua -ltinyxml -lcrypt
COMMON_SRCS = $(shell find $(PROJECT_BASE_PATH)/sources/common/src -type f -name "*.cpp")
COMMON_OBJS = $(COMMON_SRCS:.cpp=.common.o)

View File

@ -1,13 +0,0 @@
--- a/builders/make/linux.mk
+++ b/builders/make/linux.mk
@@ -31,8 +31,8 @@ OPTIMIZATIONS = -O3
COMPILE_FLAGS = $(FPIC) $(OPTIMIZATIONS) $(CFLAGS)
#linking flags
-dynamic_lib_flags = $(FPIC) $(OPTIMIZATIONS) -Wl,-soname,$(DYNAMIC_LIB_PREFIX)$(1)$(DYNAMIC_LIB_SUFIX) -Wl,-rpath,"\$$ORIGIN"
-dynamic_exec_flags = $(FPIC) $(OPTIMIZATIONS) -Wl,-rpath,"\$$ORIGIN"
+dynamic_lib_flags = $(FPIC) $(OPTIMIZATIONS) -Wl,-soname,$(DYNAMIC_LIB_PREFIX)$(1)$(DYNAMIC_LIB_SUFIX) -Wl,-rpath,/usr/lib/crtmpserver
+dynamic_exec_flags = $(FPIC) $(OPTIMIZATIONS) -Wl,-rpath,/usr/lib/crtmpserver
#compile switches
PLATFORM_DEFINES = \

View File

@ -27,21 +27,21 @@
-- the application will also be known by that names. It is optional
--aliases=
--{
@@ -89,13 +89,6 @@ configuration=
@@ -87,13 +87,6 @@ configuration=
port=1935,
protocol="inboundRtmp"
},
{
ip="0.0.0.0",
- {
- ip="0.0.0.0",
- port=8081,
- protocol="inboundRtmps",
- sslKey="server.key",
- sslCert="server.crt"
- },
- {
- ip="0.0.0.0",
{
ip="0.0.0.0",
port=8080,
protocol="inboundRtmpt"
},
@@ -184,6 +177,7 @@ configuration=
@@ -206,6 +199,7 @@ configuration=
name="samplefactory",
description="asdsadasdsa",
protocol="dynamiclinklibrary",

View File

@ -0,0 +1,11 @@
--- a/sources/common/src/utils/logging/syslogloglocation.cpp
+++ b/sources/common/src/utils/logging/syslogloglocation.cpp
@@ -35,8 +35,6 @@ SyslogLogLocation::SyslogLogLocation(Variant &configuration, string identifier,
_priorities[_WARNING_] = LOG_WARNING;
_priorities[_ERROR_] = LOG_ERR;
_priorities[_FATAL_] = LOG_ERR;
- _priorities[_PROD_ACCESS_] = LOG_ERR;
- _priorities[_PROD_ERROR_] = LOG_ERR;
_specificLevel = specificLevel;
_enforceLoggerName = (_configuration[CONF_LOG_APPENDER_NAME] != "");
_pDefualtFormatter = NULL;

View File

@ -1,11 +0,0 @@
--- a/builders/make/linux.mk
+++ b/builders/make/linux.mk
@@ -38,7 +38,7 @@ dynamic_exec_flags = $(FPIC) $(OPTIMIZAT
PLATFORM_DEFINES = \
-DLINUX \
-DLITTLE_ENDIAN_BYTE_ALIGNED \
- -DNET_EPOLL
+ -DNET_SELECT
SSL_BASE=/usr/local

View File

@ -1,41 +0,0 @@
--- a/builders/make/compile.mk
+++ b/builders/make/compile.mk
@@ -58,7 +58,7 @@ DEFINES = $(PLATFORM_DEFINES) $(FEATURES
#library paths
SSL_INCLUDE=-I$(SSL_BASE)/include
-SSL_LIB=-L$(SSL_BASE)/lib -lssl -lcrypto
+SSL_LIB=-L$(SSL_BASE)/lib -lssl -lcrypto -ldl
#lua
LUA_INCLUDE=-I$(PROJECT_BASE_PATH)/3rdparty/lua-dev
@@ -72,25 +72,25 @@ TINYXML_OBJS = $(TINYXML_SRCS:.cpp=.tiny
#common
COMMON_INCLUDE=$(LUA_INCLUDE) $(TINYXML_INCLUDE) $(SSL_INCLUDE) -I$(PROJECT_BASE_PATH)/sources/common/include
-COMMON_LIBS=$(SSL_LIB) -L$(OUTPUT_DYNAMIC) -llua -ltinyxml -lcrypt
+COMMON_LIBS=$(SSL_LIB) -L$(OUTPUT_DYNAMIC) $(PROJECT_BASE_PATH)/builders/make/output/dynamic/liblua.so -ltinyxml -lcrypt -ldl
COMMON_SRCS = $(shell find $(PROJECT_BASE_PATH)/sources/common/src -type f -name "*.cpp")
COMMON_OBJS = $(COMMON_SRCS:.cpp=.common.o)
#thelib
THELIB_INCLUDE=$(COMMON_INCLUDE) -I$(PROJECT_BASE_PATH)/sources/thelib/include
-THELIB_LIBS=$(COMMON_LIBS) -L$(OUTPUT_DYNAMIC) -lcommon
+THELIB_LIBS=$(COMMON_LIBS) -L$(OUTPUT_DYNAMIC) -lcommon -ldl
THELIB_SRCS = $(shell find $(PROJECT_BASE_PATH)/sources/thelib/src -type f -name "*.cpp")
THELIB_OBJS = $(THELIB_SRCS:.cpp=.thelib.o)
#tests
TESTS_INCLUDE=$(THELIB_INCLUDE) -I$(PROJECT_BASE_PATH)/sources/tests/include
-TESTS_LIBS=$(THELIB_LIBS) -L$(OUTPUT_DYNAMIC) -lthelib
+TESTS_LIBS=$(THELIB_LIBS) -L$(OUTPUT_DYNAMIC) -lthelib -ldl
TESTS_SRCS=$(shell find $(PROJECT_BASE_PATH)/sources/tests/src -type f -name "*.cpp")
TESTS_OBJS=$(TESTS_SRCS:.cpp=.tests.o)
#crtmpserver
CRTMPSERVER_INCLUDE=$(THELIB_INCLUDE) -I$(PROJECT_BASE_PATH)/sources/crtmpserver/include
-CRTMPSERVER_LIBS=$(THELIB_LIBS) -L$(OUTPUT_DYNAMIC) -lthelib
+CRTMPSERVER_LIBS=$(THELIB_LIBS) -L$(OUTPUT_DYNAMIC) -lthelib -ldl
CRTMPSERVER_SRCS=$(shell find $(PROJECT_BASE_PATH)/sources/crtmpserver/src -type f -name "*.cpp")
CRTMPSERVER_OBJS_DYNAMIC=$(CRTMPSERVER_SRCS:.cpp=.crtmpserver_dynamic.o)
CRTMPSERVER_OBJS_STATIC=$(CRTMPSERVER_SRCS:.cpp=.crtmpserver_static.o)

View File

@ -1,10 +0,0 @@
--- a/sources/common/src/utils/logging/fileloglocation.cpp
+++ b/sources/common/src/utils/logging/fileloglocation.cpp
@@ -17,6 +17,7 @@
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <ctime>
#include "utils/logging/fileloglocation.h"
#include "utils/lua/luautils.h"

View File

@ -1,10 +0,0 @@
--- a/3rdparty/tinyxml/tinyxml.h
+++ b/3rdparty/tinyxml/tinyxml.h
@@ -39,6 +39,7 @@ distribution.
#include <string>
#include <iostream>
#include <sstream>
+#include "lstate.h"
using namespace std;
// Help out windows:

View File

@ -0,0 +1,11 @@
--- a/sources/thelib/include/protocols/ts/basetsappprotocolhandler.h
+++ b/sources/thelib/include/protocols/ts/basetsappprotocolhandler.h
@@ -18,7 +18,7 @@
*/
-#if defined HAS_PROTOCOL_TS && defined HAS_MEDIA_TS
+#if defined HAS_PROTOCOL_TS || defined HAS_MEDIA_TS
#ifndef _BASETSAPPPROTOCOLHANDLER_H
#define _BASETSAPPPROTOCOLHANDLER_H

View File

@ -1,91 +0,0 @@
--- a/sources/common/include/platform/linux/max.h
+++ b/sources/common/include/platform/linux/max.h
@@ -21,87 +21,7 @@
#ifndef _MAX_H
#define _MAX_H
-#ifdef UINT64_MAX
-#undef UINT64_MAX
-#endif
-
-#ifdef INT64_MAX
-#undef INT64_MAX
-#endif
-
-#ifdef UINT32_MAX
-#undef UINT32_MAX
-#endif
-
-#ifdef INT32_MAX
-#undef INT32_MAX
-#endif
-
-#ifdef UINT16_MAX
-#undef UINT16_MAX
-#endif
-
-#ifdef INT16_MAX
-#undef INT16_MAX
-#endif
-
-#ifdef UINT8_MAX
-#undef UINT8_MAX
-#endif
-
-#ifdef INT8_MAX
-#undef INT8_MAX
-#endif
-
-
-
-#ifndef UINT64_MAX
-#define UINT64_MAX ((uint64_t)(0xffffffffffffffffULL))
-#endif
-
-#ifndef INT64_MAX
-#define INT64_MAX ((int64_t)(0x7fffffffffffffffLL))
-#endif
-
-#ifndef INT64_MIN
-#define INT64_MIN ((int64_t)(0x8000000000000000LL))
-#endif
-
-#ifndef UINT32_MAX
-#define UINT32_MAX ((uint32_t)(0xffffffffUL))
-#endif
-
-#ifndef INT32_MAX
-#define INT32_MAX ((int32_t)(0x7fffffffL))
-#endif
-
-#ifndef INT32_MIN
-#define INT32_MIN ((int32_t)(0x80000000L))
-#endif
-
-#ifndef UINT16_MAX
-#define UINT16_MAX ((uint16_t)(0xffff))
-#endif
-
-#ifndef INT16_MAX
-#define INT16_MAX ((int16_t)(0x7fff))
-#endif
-
-#ifndef INT16_MIN
-#define INT16_MIN ((int16_t)(0x8000))
-#endif
-
-#ifndef UINT8_MAX
-#define UINT8_MAX ((uint8_t)(0xff))
-#endif
-
-#ifndef INT8_MAX
-#define INT8_MAX ((int8_t)(0x7f))
-#endif
-
-#ifndef INT8_MIN
-#define INT8_MIN ((int8_t)(0x80))
-#endif
+#include <stdint.h>
#endif /* _MAX_H */
#endif /* LINUX */

View File

@ -27,7 +27,7 @@
delete[] _pIV;
delete[] _pKey;
}
@@ -60,11 +59,9 @@ bool InboundAESProtocol::Initialize(Vari
@@ -60,11 +59,9 @@ bool InboundAESProtocol::Initialize(Variant &parameters) {
_inputBuffer.IgnoreAll();
_tempBuffer.IgnoreAll();
@ -42,7 +42,7 @@
return true;
}
@@ -105,14 +102,14 @@ bool InboundAESProtocol::SignalInputData
@@ -105,14 +102,14 @@ bool InboundAESProtocol::SignalInputData(IOBuffer &buffer) {
int decryptedFinalSize = 0;
uint32_t padding = 0;
@ -78,6 +78,35 @@
};
DLLEXP void InitRC4Encryption(uint8_t *secretKey, uint8_t *pubKeyIn, uint8_t *pubKeyOut,
--- /dev/null
+++ b/sources/common/include/utils/misc/libcrypto-compat.h
@@ -0,0 +1,26 @@
+#ifndef LIBCRYPTO_COMPAT_H
+#define LIBCRYPTO_COMPAT_H
+
+#include <openssl/opensslv.h>
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
+
+#include <openssl/bn.h>
+#include <openssl/dh.h>
+#include <openssl/evp.h>
+#include <openssl/hmac.h>
+
+int DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g);
+void DH_get0_key(const DH *dh, const BIGNUM **pub_key, const BIGNUM **priv_key);
+int DH_set_length(DH *dh, long length);
+
+EVP_MD_CTX *EVP_MD_CTX_new(void);
+void EVP_MD_CTX_free(EVP_MD_CTX *ctx);
+#define EVP_MD_CTX_reset EVP_MD_CTX_cleanup
+
+HMAC_CTX *HMAC_CTX_new(void);
+void HMAC_CTX_free(HMAC_CTX *ctx);
+#define HMAC_CTX_reset HMAC_CTX_cleanup
+
+#endif /* OPENSSL_VERSION_NUMBER */
+
+#endif /* LIBCRYPTO_COMPAT_H */
--- a/sources/common/src/utils/misc/crypto.cpp
+++ b/sources/common/src/utils/misc/crypto.cpp
@@ -35,6 +35,7 @@ DHWrapper::~DHWrapper() {
@ -125,24 +154,24 @@
- Cleanup();
- return false;
+ goto return_error;
}
- //4. Set the key length
- _pDH->length = _bitsCount;
+ }
+
+ //4. Set internal p and g
+ if (DH_set0_pqg(_pDH, p, NULL, g) != 1) {
+ FATAL("Unable to set internal p and g");
+ goto return_error;
+ }
}
+ p = g = NULL;
- //5. Generate private and public key
- //4. Set the key length
- _pDH->length = _bitsCount;
+ //5. Set the key length
+ if (DH_set_length(_pDH, _bitsCount) != 1) {
+ FATAL("Unable to set length");
+ goto return_error;
+ }
+
- //5. Generate private and public key
+ //6. Generate private and public key
if (DH_generate_key(_pDH) != 1) {
FATAL("Unable to generate DH public/private keys");
@ -161,7 +190,7 @@
}
bool DHWrapper::CopyPublicKey(uint8_t *pDst, int32_t dstLength) {
@@ -90,7 +102,9 @@ bool DHWrapper::CopyPublicKey(uint8_t *p
@@ -90,7 +102,9 @@ bool DHWrapper::CopyPublicKey(uint8_t *pDst, int32_t dstLength) {
return false;
}
@ -172,7 +201,7 @@
}
bool DHWrapper::CopyPrivateKey(uint8_t *pDst, int32_t dstLength) {
@@ -99,7 +113,9 @@ bool DHWrapper::CopyPrivateKey(uint8_t *
@@ -99,7 +113,9 @@ bool DHWrapper::CopyPrivateKey(uint8_t *pDst, int32_t dstLength) {
return false;
}
@ -183,7 +212,7 @@
}
bool DHWrapper::CreateSharedKey(uint8_t *pPeerPublicKey, int32_t length) {
@@ -153,14 +169,6 @@ bool DHWrapper::CopySharedKey(uint8_t *p
@@ -153,14 +169,6 @@ bool DHWrapper::CopySharedKey(uint8_t *pDst, int32_t dstLength) {
void DHWrapper::Cleanup() {
if (_pDH != NULL) {
@ -207,7 +236,7 @@
int32_t keySize = BN_num_bytes(pNum);
if ((keySize <= 0) || (dstLength <= 0) || (keySize > dstLength)) {
FATAL("CopyPublicKey failed due to either invalid DH state or invalid call");
@@ -197,20 +205,21 @@ void InitRC4Encryption(uint8_t *secretKe
@@ -197,20 +205,21 @@ void InitRC4Encryption(uint8_t *secretKey, uint8_t *pubKeyIn, uint8_t *pubKeyOut
uint8_t digest[SHA256_DIGEST_LENGTH];
unsigned int digestLen = 0;
@ -240,7 +269,7 @@
RC4_set_key(rc4keyIn, 16, digest);
}
@@ -220,14 +229,17 @@ string md5(string source, bool textResul
@@ -220,14 +229,17 @@ string md5(string source, bool textResult) {
}
string md5(uint8_t *pBuffer, uint32_t length, bool textResult) {
@ -263,7 +292,7 @@
if (textResult) {
string result = "";
@@ -244,12 +256,12 @@ void HMACsha256(const void *pData, uint3
@@ -259,12 +271,12 @@ void HMACsha256(const void *pData, uint32_t dataLength,
const void *pKey, uint32_t keyLength, void *pResult) {
unsigned int digestLen;
@ -282,84 +311,17 @@
o_assert(digestLen == 32);
}
--- a/sources/thelib/src/protocols/ssl/basesslprotocol.cpp
+++ b/sources/thelib/src/protocols/ssl/basesslprotocol.cpp
@@ -211,6 +211,7 @@ string BaseSSLProtocol::GetSSLErrors() {
string BaseSSLProtocol::DumpBIO(BIO *pBIO) {
string formatString;
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
formatString = "method: %p\n";
formatString += "callback: %p\n";
formatString += "cb_arg: %p\n";
@@ -240,6 +241,39 @@ string BaseSSLProtocol::DumpBIO(BIO *pBI
pBIO->references,
(int64_t) pBIO->num_read,
(int64_t) pBIO->num_write);
+#else
+// Some of these are problematic in openssl >= 1.1, since
+// the BIO struct is opaque.
+ formatString = "method: %s\n";
+ formatString += "callback: %p\n";
+ formatString += "cb_arg: %p\n";
+ formatString += "init: %d\n";
+ formatString += "shutdown: %d\n";
+ formatString += "flags: %d\n";
+ formatString += "retry_reason: %d\n";
+ formatString += "num: %d\n";
+ formatString += "ptr: %p\n";
+ formatString += "next_bio: %p\n";
+ formatString += "prev_bio: %s\n";
+ formatString += "references: %s\n";
+ formatString += "num_read: %"PRId64"\n";
+ formatString += "num_write: %"PRId64;
+ return format(formatString,
+ BIO_method_name(pBIO),
+ BIO_get_callback(pBIO),
+ BIO_get_callback_arg(pBIO),
+ BIO_get_init(pBIO),
+ BIO_get_shutdown(pBIO),
+ BIO_get_flags(pBIO),
+ BIO_get_retry_reason(pBIO),
+ BIO_get_fd(pBIO, NULL),
+ BIO_get_data(pBIO),
+ BIO_next(pBIO),
+ "unknown", //prev_bio
+ "unknown", //references
+ BIO_number_read(pBIO),
+ BIO_number_written(pBIO));
+#endif
@@ -397,8 +409,8 @@ string unhex(const uint8_t *pBuffer, uint32_t length) {
}
void BaseSSLProtocol::InitRandGenerator() {
--- /dev/null
+++ b/sources/common/include/utils/misc/libcrypto-compat.h
@@ -0,0 +1,25 @@
+#ifndef LIBCRYPTO_COMPAT_H
+#define LIBCRYPTO_COMPAT_H
+
+#include <openssl/opensslv.h>
void CleanupSSL() {
-#ifndef NO_SSL_ENGINE_CLEANUP
- ERR_remove_state(0);
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
+
+#include <openssl/dh.h>
+#include <openssl/evp.h>
+#include <openssl/hmac.h>
+
+int DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g);
+void DH_get0_key(const DH *dh, const BIGNUM **pub_key, const BIGNUM **priv_key);
+int DH_set_length(DH *dh, long length);
+
+EVP_MD_CTX *EVP_MD_CTX_new(void);
+void EVP_MD_CTX_free(EVP_MD_CTX *ctx);
+#define EVP_MD_CTX_reset EVP_MD_CTX_cleanup
+
+HMAC_CTX *HMAC_CTX_new(void);
+void HMAC_CTX_free(HMAC_CTX *ctx);
+#define HMAC_CTX_reset HMAC_CTX_cleanup
+
+#endif /* OPENSSL_VERSION_NUMBER */
+
+#endif /* LIBCRYPTO_COMPAT_H */
+ ERR_remove_thread_state(NULL);
ENGINE_cleanup();
CONF_modules_unload(1);
ERR_free_strings();
--- /dev/null
+++ b/sources/common/src/utils/misc/libcrypto-compat.cpp
@@ -0,0 +1,90 @@
@ -453,3 +415,80 @@
+}
+
+#endif /* OPENSSL_VERSION_NUMBER */
--- a/sources/thelib/src/protocols/ssl/basesslprotocol.cpp
+++ b/sources/thelib/src/protocols/ssl/basesslprotocol.cpp
@@ -43,6 +43,7 @@ BaseSSLProtocol::~BaseSSLProtocol() {
bool BaseSSLProtocol::Initialize(Variant &parameters) {
//1. Initialize the SSL library
if (!_libraryInitialized) {
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
//3. This is the first time we use the library. So we have to
//initialize it first
SSL_library_init();
@@ -55,6 +56,7 @@ bool BaseSSLProtocol::Initialize(Variant &parameters) {
OpenSSL_add_all_algorithms();
OpenSSL_add_all_ciphers();
OpenSSL_add_all_digests();
+#endif
//initialize the random numbers generator
InitRandGenerator();
@@ -211,6 +213,7 @@ string BaseSSLProtocol::GetSSLErrors() {
string BaseSSLProtocol::DumpBIO(BIO *pBIO) {
string formatString;
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
formatString = "method: %p\n";
formatString += "callback: %p\n";
formatString += "cb_arg: %p\n";
@@ -240,6 +243,39 @@ string BaseSSLProtocol::DumpBIO(BIO *pBIO) {
pBIO->references,
(int64_t) pBIO->num_read,
(int64_t) pBIO->num_write);
+#else
+// Some of these are problematic in openssl >= 1.1, since
+// the BIO struct is opaque.
+ formatString = "method: %s\n";
+ formatString += "callback: %p\n";
+ formatString += "cb_arg: %p\n";
+ formatString += "init: %d\n";
+ formatString += "shutdown: %d\n";
+ formatString += "flags: %d\n";
+ formatString += "retry_reason: %d\n";
+ formatString += "num: %d\n";
+ formatString += "ptr: %p\n";
+ formatString += "next_bio: %p\n";
+ formatString += "prev_bio: %s\n";
+ formatString += "references: %s\n";
+ formatString += "num_read: %"PRId64"\n";
+ formatString += "num_write: %"PRId64;
+ return format(STR(formatString),
+ BIO_method_name(pBIO),
+ BIO_get_callback(pBIO),
+ BIO_get_callback_arg(pBIO),
+ BIO_get_init(pBIO),
+ BIO_get_shutdown(pBIO),
+ BIO_get_flags(pBIO),
+ BIO_get_retry_reason(pBIO),
+ BIO_get_fd(pBIO, NULL),
+ BIO_get_data(pBIO),
+ BIO_next(pBIO),
+ "unknown", //prev_bio
+ "unknown", //references
+ BIO_number_read(pBIO),
+ BIO_number_written(pBIO));
+#endif
}
void BaseSSLProtocol::InitRandGenerator() {
--- a/sources/thelib/src/protocols/ssl/outboundsslprotocol.cpp
+++ b/sources/thelib/src/protocols/ssl/outboundsslprotocol.cpp
@@ -33,7 +33,7 @@ bool OutboundSSLProtocol::InitGlobalContext(Variant &parameters) {
_pGlobalSSLContext = _pGlobalContexts[hash];
if (_pGlobalSSLContext == NULL) {
//2. prepare the global ssl context
- _pGlobalSSLContext = SSL_CTX_new(TLSv1_method());
+ _pGlobalSSLContext = SSL_CTX_new(SSLv23_method());
if (_pGlobalSSLContext == NULL) {
FATAL("Unable to create global SSL context");
return false;

View File

@ -1,46 +0,0 @@
--- a/sources/common/src/utils/misc/crypto.cpp
+++ b/sources/common/src/utils/misc/crypto.cpp
@@ -350,6 +350,7 @@ string unhex(string source) {
return result;
}
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
void CleanupSSL() {
ERR_remove_state(0);
ENGINE_cleanup();
@@ -358,3 +359,4 @@ void CleanupSSL() {
EVP_cleanup();
CRYPTO_cleanup_all_ex_data();
}
+#endif
--- a/sources/crtmpserver/src/crtmpserver.cpp
+++ b/sources/crtmpserver/src/crtmpserver.cpp
@@ -298,8 +298,10 @@ void Cleanup() {
delete gRs.pConfigFile;
gRs.pConfigFile = NULL;
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
WARN("Doing final OpenSSL cleanup");
CleanupSSL();
+#endif
WARN("Shutting down the logger leaving you in the dark. Bye bye... :(");
Logger::Free(true);
--- a/sources/thelib/src/protocols/ssl/basesslprotocol.cpp
+++ b/sources/thelib/src/protocols/ssl/basesslprotocol.cpp
@@ -43,6 +43,7 @@ BaseSSLProtocol::~BaseSSLProtocol() {
bool BaseSSLProtocol::Initialize(Variant &parameters) {
//1. Initialize the SSL library
if (!_libraryInitialized) {
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
//3. This is the first time we use the library. So we have to
//initialize it first
SSL_library_init();
@@ -55,6 +56,7 @@ bool BaseSSLProtocol::Initialize(Variant &parameters) {
OpenSSL_add_all_algorithms();
OpenSSL_add_all_ciphers();
OpenSSL_add_all_digests();
+#endif
//initialize the random numbers generator
InitRandGenerator();