1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-02-15 04:42:04 +00:00

RTC support openssl 1.0.*

This commit is contained in:
winlin 2020-04-03 13:41:45 +08:00
parent f853c7a1e0
commit 9ad5a5d9b6
3 changed files with 10 additions and 2 deletions

View file

@ -45,9 +45,10 @@ using namespace _srs_internal;
// For randomly generate the handshake bytes. // For randomly generate the handshake bytes.
#define RTMP_SIG_SRS_HANDSHAKE RTMP_SIG_SRS_KEY "(" RTMP_SIG_SRS_VERSION ")" #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 #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)); HMAC_CTX *ctx = (HMAC_CTX *)malloc(sizeof(*ctx));
if (ctx != NULL) { if (ctx != NULL) {
@ -56,7 +57,7 @@ static HMAC_CTX *HMAC_CTX_new(void)
return ctx; return ctx;
} }
static void HMAC_CTX_free(HMAC_CTX *ctx) void HMAC_CTX_free(HMAC_CTX *ctx)
{ {
if (ctx != NULL) { if (ctx != NULL) {
HMAC_CTX_cleanup(ctx); HMAC_CTX_cleanup(ctx);

View file

@ -34,6 +34,12 @@ class SrsBuffer;
// For openssl. // For openssl.
#include <openssl/hmac.h> #include <openssl/hmac.h>
// @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 namespace _srs_internal
{ {
// The digest key generate size. // The digest key generate size.

View file

@ -34,6 +34,7 @@ using namespace std;
#include <srs_kernel_buffer.hpp> #include <srs_kernel_buffer.hpp>
#include <srs_kernel_log.hpp> #include <srs_kernel_log.hpp>
#include <srs_kernel_utility.hpp> #include <srs_kernel_utility.hpp>
#include <srs_rtmp_handshake.hpp>
static srs_error_t hmac_encode(const std::string& algo, const char* key, const int& key_length, 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) const char* input, const int input_length, char* output, unsigned int& output_length)