From 9ad5a5d9b6ee88f5e0c1a30995cbb98ef8ddbc33 Mon Sep 17 00:00:00 2001 From: winlin Date: Fri, 3 Apr 2020 13:41:45 +0800 Subject: [PATCH] RTC support openssl 1.0.* --- trunk/src/protocol/srs_rtmp_handshake.cpp | 5 +++-- trunk/src/protocol/srs_rtmp_handshake.hpp | 6 ++++++ trunk/src/protocol/srs_stun_stack.cpp | 1 + 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/trunk/src/protocol/srs_rtmp_handshake.cpp b/trunk/src/protocol/srs_rtmp_handshake.cpp index 3d0a8a9b1..b7f92ae59 100644 --- a/trunk/src/protocol/srs_rtmp_handshake.cpp +++ b/trunk/src/protocol/srs_rtmp_handshake.cpp @@ -45,9 +45,10 @@ using namespace _srs_internal; // For randomly generate the handshake bytes. #define RTMP_SIG_SRS_HANDSHAKE RTMP_SIG_SRS_KEY "(" RTMP_SIG_SRS_VERSION ")" +// @see https://wiki.openssl.org/index.php/OpenSSL_1.1.0_Changes #if OPENSSL_VERSION_NUMBER < 0x10100000L -static HMAC_CTX *HMAC_CTX_new(void) +HMAC_CTX *HMAC_CTX_new(void) { HMAC_CTX *ctx = (HMAC_CTX *)malloc(sizeof(*ctx)); if (ctx != NULL) { @@ -56,7 +57,7 @@ static HMAC_CTX *HMAC_CTX_new(void) return ctx; } -static void HMAC_CTX_free(HMAC_CTX *ctx) +void HMAC_CTX_free(HMAC_CTX *ctx) { if (ctx != NULL) { HMAC_CTX_cleanup(ctx); diff --git a/trunk/src/protocol/srs_rtmp_handshake.hpp b/trunk/src/protocol/srs_rtmp_handshake.hpp index bfe7b1bd0..49100fb4c 100644 --- a/trunk/src/protocol/srs_rtmp_handshake.hpp +++ b/trunk/src/protocol/srs_rtmp_handshake.hpp @@ -34,6 +34,12 @@ class SrsBuffer; // For openssl. #include +// @see https://wiki.openssl.org/index.php/OpenSSL_1.1.0_Changes +#if OPENSSL_VERSION_NUMBER < 0x10100000L +extern HMAC_CTX *HMAC_CTX_new(void); +extern void HMAC_CTX_free(HMAC_CTX *ctx); +#endif + namespace _srs_internal { // The digest key generate size. diff --git a/trunk/src/protocol/srs_stun_stack.cpp b/trunk/src/protocol/srs_stun_stack.cpp index 6dcea2950..e32ce6ad1 100644 --- a/trunk/src/protocol/srs_stun_stack.cpp +++ b/trunk/src/protocol/srs_stun_stack.cpp @@ -34,6 +34,7 @@ using namespace std; #include #include #include +#include static srs_error_t hmac_encode(const std::string& algo, const char* key, const int& key_length, const char* input, const int input_length, char* output, unsigned int& output_length)