python-sipsimple: version bump to 3.3.0

This commit is contained in:
Tom Briden 2018-12-18 11:11:01 +00:00
parent b586e42edf
commit a4ea000d0c
Signed by: tombriden
GPG Key ID: 154F25A1BB9A4AD8
6 changed files with 1 additions and 715 deletions

View File

@ -1,30 +0,0 @@
Upstream: https://github.com/AGProjects/python-sipsimple/pull/3
From f96d1e8637f817dc76188742d2e0e1b7b2776581 Mon Sep 17 00:00:00 2001
From: Benjamin Lamowski <benjamin@lamowski.net>
Date: Tue, 22 May 2018 10:11:06 -0400
Subject: [PATCH] pjsip: fix compilation error with FFmpeg 2.8.14
---
deps/pjsip/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/deps/pjsip/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c b/deps/pjsip/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c
index cf859408..097479f6 100644
--- a/deps/pjsip/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c
+++ b/deps/pjsip/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c
@@ -1684,12 +1684,12 @@ static pj_status_t ffmpeg_codec_decode_whole(pjmedia_vid_codec *codec,
avpacket.size = (int)input->size;
/* ffmpeg warns:
- * - input buffer padding, at least FF_INPUT_BUFFER_PADDING_SIZE
+ * - input buffer padding, at least AV_INPUT_BUFFER_PADDING_SIZE
* - null terminated
* Normally, encoded buffer is allocated more than needed, so lets just
* bzero the input buffer end/pad, hope it will be just fine.
*/
- pj_bzero(avpacket.data+avpacket.size, FF_INPUT_BUFFER_PADDING_SIZE);
+ pj_bzero(avpacket.data+avpacket.size, AV_INPUT_BUFFER_PADDING_SIZE);
output->bit_info = 0;
output->timestamp = input->timestamp;

View File

@ -1,173 +0,0 @@
Upstream: https://trac.pjsip.org/repos/changeset/5405/pjproject/trunk/pjmedia/src/pjmedia-codec/openh264.cpp
Reason: Support for OpenH264 v1.6.0 codec
Index: deps/pjsip/pjmedia/src/pjmedia-codec/openh264.cpp
===================================================================
--- deps/pjsip/pjmedia/src/pjmedia-codec/openh264.cpp (revision 5045)
+++ deps/pjsip/pjmedia/src/pjmedia-codec/openh264.cpp (revision 5405)
@@ -164,6 +164,6 @@
struct SLayerPEncCtx
{
- pj_int32_t iDLayerQp;
- SSliceConfig sSliceCfg;
+ pj_int32_t iDLayerQp;
+ SSliceArgument sSliceArgument;
};
@@ -471,16 +471,17 @@
/* Init encoder parameters */
- pj_bzero(&eprm, sizeof(eprm));
- eprm.iInputCsp = videoFormatI420;
+ oh264_data->enc->GetDefaultParams (&eprm);
+ eprm.iComplexityMode = MEDIUM_COMPLEXITY;
eprm.sSpatialLayers[0].uiProfileIdc = PRO_BASELINE;
eprm.iPicWidth = param->enc_fmt.det.vid.size.w;
+ eprm.iUsageType = CAMERA_VIDEO_REAL_TIME;
eprm.iPicHeight = param->enc_fmt.det.vid.size.h;
eprm.fMaxFrameRate = (param->enc_fmt.det.vid.fps.num *
1.0f /
param->enc_fmt.det.vid.fps.denum);
- eprm.uiFrameToBeCoded = (unsigned int) -1;
eprm.iTemporalLayerNum = 1;
eprm.uiIntraPeriod = 0; /* I-Frame interval in frames */
- eprm.bEnableSpsPpsIdAddition = (oh264_data->whole? false : true);
+ eprm.eSpsPpsIdStrategy = (oh264_data->whole ? CONSTANT_ID :
+ INCREASING_ID);
eprm.bEnableFrameCroppingFlag = true;
eprm.iLoopFilterDisableIdc = 0;
@@ -505,16 +506,17 @@
pj_bzero(&elayer_ctx, sizeof (SLayerPEncCtx));
elayer_ctx.iDLayerQp = 24;
- elayer_ctx.sSliceCfg.uiSliceMode = (oh264_data->whole ?
- SM_SINGLE_SLICE : SM_DYN_SLICE);
- elayer_ctx.sSliceCfg.sSliceArgument.uiSliceSizeConstraint = param->enc_mtu;
- elayer_ctx.sSliceCfg.sSliceArgument.uiSliceNum = 1;
- elayer_ctx.sSliceCfg.sSliceArgument.uiSliceMbNum[0] = 960;
- elayer_ctx.sSliceCfg.sSliceArgument.uiSliceMbNum[1] = 0;
- elayer_ctx.sSliceCfg.sSliceArgument.uiSliceMbNum[2] = 0;
- elayer_ctx.sSliceCfg.sSliceArgument.uiSliceMbNum[3] = 0;
- elayer_ctx.sSliceCfg.sSliceArgument.uiSliceMbNum[4] = 0;
- elayer_ctx.sSliceCfg.sSliceArgument.uiSliceMbNum[5] = 0;
- elayer_ctx.sSliceCfg.sSliceArgument.uiSliceMbNum[6] = 0;
- elayer_ctx.sSliceCfg.sSliceArgument.uiSliceMbNum[7] = 0;
+ elayer_ctx.sSliceArgument.uiSliceMode = (oh264_data->whole ?
+ SM_SINGLE_SLICE :
+ SM_SIZELIMITED_SLICE);
+ elayer_ctx.sSliceArgument.uiSliceSizeConstraint = param->enc_mtu;
+ elayer_ctx.sSliceArgument.uiSliceNum = 1;
+ elayer_ctx.sSliceArgument.uiSliceMbNum[0] = 960;
+ elayer_ctx.sSliceArgument.uiSliceMbNum[1] = 0;
+ elayer_ctx.sSliceArgument.uiSliceMbNum[2] = 0;
+ elayer_ctx.sSliceArgument.uiSliceMbNum[3] = 0;
+ elayer_ctx.sSliceArgument.uiSliceMbNum[4] = 0;
+ elayer_ctx.sSliceArgument.uiSliceMbNum[5] = 0;
+ elayer_ctx.sSliceArgument.uiSliceMbNum[6] = 0;
+ elayer_ctx.sSliceArgument.uiSliceMbNum[7] = 0;
elayer->iVideoWidth = eprm.iPicWidth;
@@ -524,12 +526,12 @@
elayer->iSpatialBitrate = eprm.iTargetBitrate;
elayer->iDLayerQp = elayer_ctx.iDLayerQp;
- elayer->sSliceCfg.uiSliceMode = elayer_ctx.sSliceCfg.uiSliceMode;
-
- memcpy( &elayer->sSliceCfg,
- &elayer_ctx.sSliceCfg,
- sizeof (SSliceConfig));
- memcpy( &elayer->sSliceCfg.sSliceArgument.uiSliceMbNum[0],
- &elayer_ctx.sSliceCfg.sSliceArgument.uiSliceMbNum[0],
- sizeof (elayer_ctx.sSliceCfg.sSliceArgument.uiSliceMbNum));
+ elayer->sSliceArgument.uiSliceMode = elayer_ctx.sSliceArgument.uiSliceMode;
+
+ memcpy ( &elayer->sSliceArgument,
+ &elayer_ctx.sSliceArgument,
+ sizeof (SSliceArgument));
+ memcpy ( &elayer->sSliceArgument.uiSliceMbNum[0],
+ &elayer_ctx.sSliceArgument.uiSliceMbNum[0],
+ sizeof (elayer_ctx.sSliceArgument.uiSliceMbNum));
/* Init input picture */
@@ -553,11 +555,18 @@
}
+ int videoFormat = videoFormatI420;
+ rc = oh264_data->enc->SetOption (ENCODER_OPTION_DATAFORMAT, &videoFormat);
+ if (rc != cmResultSuccess) {
+ PJ_LOG(4,(THIS_FILE, "SVC encoder SetOption videoFormatI420 failed, "
+ "rc=%d", rc));
+ return PJMEDIA_CODEC_EFAILED;
+ }
+
/*
* Decoder
*/
sDecParam.sVideoProperty.size = sizeof (sDecParam.sVideoProperty);
- sDecParam.iOutputColorFormat = videoFormatI420;
sDecParam.uiTargetDqLayer = (pj_uint8_t) - 1;
- sDecParam.uiEcActiveFlag = 1;
+ sDecParam.eEcActiveIdc = ERROR_CON_SLICE_COPY;
sDecParam.sVideoProperty.eVideoBsType = VIDEO_BITSTREAM_DEFAULT;
@@ -575,12 +584,4 @@
PJ_LOG(4,(THIS_FILE, "Decoder initialization failed, rc=%d", rc));
return PJMEDIA_CODEC_EFAILED;
- }
-
- pj_int32_t color_fmt = videoFormatI420;
- rc = oh264_data->dec->SetOption (DECODER_OPTION_DATAFORMAT, &color_fmt);
- if (rc) {
- PJ_LOG(4,(THIS_FILE,
- "Warning: SetOption(DECODER_OPTION_DATAFORMAT) failed, rc=%d",
- rc));
}
@@ -662,5 +663,5 @@
}
- if (oh264_data->bsi.eOutputFrameType == videoFrameTypeSkip) {
+ if (oh264_data->bsi.eFrameType == videoFrameTypeSkip) {
output->size = 0;
output->type = PJMEDIA_FRAME_TYPE_NONE;
@@ -682,11 +683,11 @@
/* Find which layer with biggest payload */
oh264_data->ilayer = 0;
- payload_size = oh264_data->bsi.sLayerInfo[0].iNalLengthInByte[0];
+ payload_size = oh264_data->bsi.sLayerInfo[0].pNalLengthInByte[0];
for (i=0; i < (unsigned)oh264_data->bsi.iLayerNum; ++i) {
unsigned j;
pLayerBsInfo = &oh264_data->bsi.sLayerInfo[i];
for (j=0; j < (unsigned)pLayerBsInfo->iNalCount; ++j) {
- if (pLayerBsInfo->iNalLengthInByte[j] > (int)payload_size) {
- payload_size = pLayerBsInfo->iNalLengthInByte[j];
+ if (pLayerBsInfo->pNalLengthInByte[j] > (int)payload_size) {
+ payload_size = pLayerBsInfo->pNalLengthInByte[j];
oh264_data->ilayer = i;
}
@@ -704,5 +705,5 @@
payload_size = 0;
for (int inal = pLayerBsInfo->iNalCount - 1; inal >= 0; --inal) {
- payload_size += pLayerBsInfo->iNalLengthInByte[inal];
+ payload_size += pLayerBsInfo->pNalLengthInByte[inal];
}
@@ -761,5 +762,5 @@
output->size = payload_len;
- if (oh264_data->bsi.eOutputFrameType == videoFrameTypeIDR) {
+ if (oh264_data->bsi.eFrameType == videoFrameTypeIDR) {
output->bit_info |= PJMEDIA_VID_FRM_KEYFRAME;
}
@@ -783,5 +784,5 @@
oh264_data->enc_frame_size = 0;
for (int inal = pLayerBsInfo->iNalCount - 1; inal >= 0; --inal) {
- oh264_data->enc_frame_size += pLayerBsInfo->iNalLengthInByte[inal];
+ oh264_data->enc_frame_size += pLayerBsInfo->pNalLengthInByte[inal];
}
@@ -810,5 +811,5 @@
output->size = payload_len;
- if (oh264_data->bsi.eOutputFrameType == videoFrameTypeIDR) {
+ if (oh264_data->bsi.eFrameType == videoFrameTypeIDR) {
output->bit_info |= PJMEDIA_VID_FRM_KEYFRAME;
}

View File

@ -1,234 +0,0 @@
Upstream: Yes (pjsip)
Source: Backported from https://trac.pjsip.org/repos/browser/pjproject/trunk
---
deps/pjsip/aconfigure | 22 ++++++------
deps/pjsip/aconfigure.ac | 4 +--
deps/pjsip/pjlib/src/pj/ssl_sock_ossl.c | 47 +++++++++++++++++++++----
3 files changed, 53 insertions(+), 20 deletions(-)
diff --git a/deps/pjsip/aconfigure b/deps/pjsip/aconfigure
index 530dbc3d..c413760b 100644
--- a/deps/pjsip/aconfigure
+++ b/deps/pjsip/aconfigure
@@ -6352,7 +6352,7 @@ if test "x$ac_cv_header_openssl_ssl_h" = xyes; then :
fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ERR_load_BIO_strings in -lcrypto" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ERR_load_BIO_strings in -lcrypto" >&5
$as_echo_n "checking for ERR_load_BIO_strings in -lcrypto... " >&6; }
if ${ac_cv_lib_crypto_ERR_load_BIO_strings+:} false; then :
$as_echo_n "(cached) " >&6
@@ -6392,9 +6392,9 @@ if test "x$ac_cv_lib_crypto_ERR_load_BIO_strings" = xyes; then :
libcrypto_present=1 && LIBS="-lcrypto $LIBS"
fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SSL_library_init in -lssl" >&5
-$as_echo_n "checking for SSL_library_init in -lssl... " >&6; }
-if ${ac_cv_lib_ssl_SSL_library_init+:} false; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SSL_CTX_new in -lssl" >&5
+$as_echo_n "checking for SSL_CTX_new in -lssl... " >&6; }
+if ${ac_cv_lib_ssl_SSL_CTX_new+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -6408,27 +6408,27 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
#ifdef __cplusplus
extern "C"
#endif
-char SSL_library_init ();
+char SSL_CTX_new ();
int
main ()
{
-return SSL_library_init ();
+return SSL_CTX_new ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_ssl_SSL_library_init=yes
+ ac_cv_lib_ssl_SSL_CTX_new=yes
else
- ac_cv_lib_ssl_SSL_library_init=no
+ ac_cv_lib_ssl_SSL_CTX_new=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ssl_SSL_library_init" >&5
-$as_echo "$ac_cv_lib_ssl_SSL_library_init" >&6; }
-if test "x$ac_cv_lib_ssl_SSL_library_init" = xyes; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ssl_SSL_CTX_new" >&5
+$as_echo "$ac_cv_lib_ssl_SSL_CTX_new" >&6; }
+if test "x$ac_cv_lib_ssl_SSL_CTX_new" = xyes; then :
libssl_present=1 && LIBS="-lssl $LIBS"
fi
diff --git a/deps/pjsip/aconfigure.ac b/deps/pjsip/aconfigure.ac
index 89ff674e..54c65ad3 100644
--- a/deps/pjsip/aconfigure.ac
+++ b/deps/pjsip/aconfigure.ac
@@ -935,8 +935,8 @@ AC_ARG_ENABLE(ssl,
AC_SUBST(libssl_present)
AC_SUBST(libcrypto_present)
AC_CHECK_HEADER(openssl/ssl.h,[openssl_h_present=1])
- AC_CHECK_LIB(crypto,ERR_load_BIO_strings,[libcrypto_present=1 && LIBS="-lcrypto $LIBS"])
- AC_CHECK_LIB(ssl,SSL_library_init,[libssl_present=1 && LIBS="-lssl $LIBS"])
+ AC_CHECK_LIB(crypto,ERR_load_BIO_strings,[libcrypto_present=1 && LIBS="-lcrypto $LIBS"])
+ AC_CHECK_LIB(ssl,SSL_CTX_new,[libssl_present=1 && LIBS="-lssl $LIBS"])
if test "x$openssl_h_present" = "x1" -a "x$libssl_present" = "x1" -a "x$libcrypto_present" = "x1"; then
AC_MSG_RESULT([OpenSSL library found, SSL support enabled])
# PJSIP_HAS_TLS_TRANSPORT setting follows PJ_HAS_SSL_SOCK
diff --git a/deps/pjsip/pjlib/src/pj/ssl_sock_ossl.c b/deps/pjsip/pjlib/src/pj/ssl_sock_ossl.c
index 926512ba..705ed63d 100644
--- a/deps/pjsip/pjlib/src/pj/ssl_sock_ossl.c
+++ b/deps/pjsip/pjlib/src/pj/ssl_sock_ossl.c
@@ -43,15 +43,31 @@
/*
* Include OpenSSL headers
*/
+#include <openssl/asn1.h>
#include <openssl/bio.h>
#include <openssl/ssl.h>
#include <openssl/err.h>
#include <openssl/x509v3.h>
+#if !USING_LIBRESSL && OPENSSL_VERSION_NUMBER >= 0x10100000L
+# define OPENSSL_NO_SSL2 /* seems to be removed in 1.1.0 */
+# define M_ASN1_STRING_data(x) ASN1_STRING_get0_data(x)
+# define M_ASN1_STRING_length(x) ASN1_STRING_length(x)
+# if defined(OPENSSL_API_COMPAT) && OPENSSL_API_COMPAT >= 0x10100000L
+# define X509_get_notBefore(x) X509_get0_notBefore(x)
+# define X509_get_notAfter(x) X509_get0_notAfter(x)
+# endif
+#else
+# define SSL_CIPHER_get_id(c) (c)->id
+# define SSL_set_session(ssl, s) (ssl)->session = (s)
+#endif
+
+
#ifdef _MSC_VER
# pragma comment( lib, "libeay32")
# pragma comment( lib, "ssleay32")
+# pragma comment( lib, "crypt32")
#endif
@@ -319,8 +335,12 @@ static pj_status_t init_openssl(void)
pj_assert(status == PJ_SUCCESS);
/* Init OpenSSL lib */
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
SSL_library_init();
SSL_load_error_strings();
+#else
+ OPENSSL_init_ssl(0, NULL);
+#endif
#if OPENSSL_VERSION_NUMBER < 0x009080ffL
/* This is now synonym of SSL_library_init() */
OpenSSL_add_all_algorithms();
@@ -334,6 +354,7 @@ static pj_status_t init_openssl(void)
STACK_OF(SSL_CIPHER) *sk_cipher;
unsigned i, n;
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
meth = (SSL_METHOD*)SSLv23_server_method();
if (!meth)
meth = (SSL_METHOD*)TLSv1_server_method();
@@ -345,6 +366,12 @@ static pj_status_t init_openssl(void)
if (!meth)
meth = (SSL_METHOD*)SSLv2_server_method();
#endif
+
+#else
+ /* Specific version methods are deprecated in 1.1.0 */
+ meth = (SSL_METHOD*)TLS_method();
+#endif
+
pj_assert(meth);
ctx=SSL_CTX_new(meth);
@@ -361,7 +388,7 @@ static pj_status_t init_openssl(void)
const SSL_CIPHER *c;
c = sk_SSL_CIPHER_value(sk_cipher,i);
openssl_ciphers[i].id = (pj_ssl_cipher)
- (pj_uint32_t)c->id & 0x00FFFFFF;
+ (pj_uint32_t)SSL_CIPHER_get_id(c) & 0x00FFFFFF;
openssl_ciphers[i].name = SSL_CIPHER_get_name(c);
}
@@ -526,6 +553,7 @@ static pj_status_t create_ssl(pj_ssl_sock_t *ssock)
ssock->param.proto = PJ_SSL_SOCK_PROTO_SSL23;
/* Determine SSL method to use */
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
switch (ssock->param.proto) {
case PJ_SSL_SOCK_PROTO_TLS1:
ssl_method = (SSL_METHOD*)TLSv1_method();
@@ -541,6 +569,10 @@ static pj_status_t create_ssl(pj_ssl_sock_t *ssock)
#endif
break;
}
+#else
+ /* Specific version methods are deprecated in 1.1.0 */
+ ssl_method = (SSL_METHOD*)TLS_method();
+#endif
if (!ssl_method) {
ssl_method = (SSL_METHOD*)SSLv23_method();
@@ -869,7 +901,8 @@ static pj_status_t set_cipher_list(pj_ssl_sock_t *ssock)
const SSL_CIPHER *c;
c = sk_SSL_CIPHER_value(sk_cipher, j);
if (ssock->param.ciphers[i] == (pj_ssl_cipher)
- ((pj_uint32_t)c->id & 0x00FFFFFF))
+ ((pj_uint32_t)SSL_CIPHER_get_id(c) &
+ 0x00FFFFFF))
{
const char *c_name;
@@ -994,7 +1027,7 @@ static void get_cert_info(pj_pool_t *pool, pj_ssl_cert_info *ci, X509 *x,
pj_bool_t update_needed;
char buf[512];
pj_uint8_t serial_no[64] = {0}; /* should be >= sizeof(ci->serial_no) */
- pj_uint8_t *q;
+ const pj_uint8_t *q;
unsigned len;
GENERAL_NAMES *names = NULL;
@@ -1004,7 +1037,7 @@ static void get_cert_info(pj_pool_t *pool, pj_ssl_cert_info *ci, X509 *x,
X509_NAME_oneline(X509_get_issuer_name(x), buf, sizeof(buf));
/* Get serial no */
- q = (pj_uint8_t*) M_ASN1_STRING_data(X509_get_serialNumber(x));
+ q = (const pj_uint8_t*) M_ASN1_STRING_data(X509_get_serialNumber(x));
len = M_ASN1_STRING_length(X509_get_serialNumber(x));
if (len > sizeof(ci->serial_no))
len = sizeof(ci->serial_no);
@@ -1075,8 +1108,8 @@ static void get_cert_info(pj_pool_t *pool, pj_ssl_cert_info *ci, X509 *x,
type = PJ_SSL_CERT_NAME_URI;
break;
case GEN_IPADD:
- p = ASN1_STRING_data(name->d.ip);
- len = ASN1_STRING_length(name->d.ip);
+ p = (unsigned char*)M_ASN1_STRING_data(name->d.ip);
+ len = M_ASN1_STRING_length(name->d.ip);
type = PJ_SSL_CERT_NAME_IP;
break;
default:
@@ -2300,7 +2333,7 @@ PJ_DEF(pj_status_t) pj_ssl_sock_get_info (pj_ssl_sock_t *ssock,
/* Current cipher */
cipher = SSL_get_current_cipher(ssock->ossl_ssl);
- info->cipher = (cipher->id & 0x00FFFFFF);
+ info->cipher = (SSL_CIPHER_get_id(cipher) & 0x00FFFFFF);
/* Remote address */
pj_sockaddr_cp(&info->remote_addr, &ssock->rem_addr);
--
2.19.2

View File

@ -1,273 +0,0 @@
Upstream: Patch Submitted
commit 7ec01af311d21e339208c68d03c1430c8b210073
Author: Tom Briden <tom@decompile.me.uk>
Date: Wed Nov 28 17:51:41 2018 +0000
zsrtp: Add support for openssl-1.1
diff --git a/deps/pjsip/third_party/zsrtp/include/openssl_compat.h b/deps/pjsip/third_party/zsrtp/include/openssl_compat.h
new file mode 100644
index 00000000..cf2e8179
--- /dev/null
+++ b/deps/pjsip/third_party/zsrtp/include/openssl_compat.h
@@ -0,0 +1,22 @@
+#ifndef _OPENSSL_COMPAT
+#define _OPENSSL_COMPAT
+
+#if (OPENSSL_VERSION_NUMBER < 0x10100000L) || defined (LIBRESSL_VERSION_NUMBER)
+static HMAC_CTX *HMAC_CTX_new(void)
+{
+ HMAC_CTX *ctx = (HMAC_CTX*)OPENSSL_malloc(sizeof(*ctx));
+ if (ctx != NULL)
+ HMAC_CTX_init(ctx);
+ return ctx;
+}
+
+static void HMAC_CTX_free(HMAC_CTX *ctx)
+{
+ if (ctx != NULL) {
+ HMAC_CTX_cleanup(ctx);
+ OPENSSL_free(ctx);
+ }
+}
+#endif
+
+#endif
diff --git a/deps/pjsip/third_party/zsrtp/zrtp/srtp/crypto/openssl/hmac.cpp b/deps/pjsip/third_party/zsrtp/zrtp/srtp/crypto/openssl/hmac.cpp
index 6cdb6b14..605285dd 100644
--- a/deps/pjsip/third_party/zsrtp/zrtp/srtp/crypto/openssl/hmac.cpp
+++ b/deps/pjsip/third_party/zsrtp/zrtp/srtp/crypto/openssl/hmac.cpp
@@ -37,6 +37,8 @@
#include <openssl/hmac.h>
#include <crypto/hmac.h>
+#include <openssl_compat.h>
+
#if defined(__APPLE__)
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
@@ -55,23 +57,21 @@ void hmac_sha1( uint8_t* key, int32_t key_length,
const uint8_t* data_chunks[],
uint32_t data_chunck_length[],
uint8_t* mac, int32_t* mac_length ) {
- HMAC_CTX ctx;
- HMAC_CTX_init(&ctx);
- HMAC_Init_ex(&ctx, key, key_length, EVP_sha1(), NULL);
+ HMAC_CTX* ctx = HMAC_CTX_new();
+ HMAC_Init_ex(ctx, key, key_length, EVP_sha1(), NULL);
while (*data_chunks) {
- HMAC_Update(&ctx, *data_chunks, *data_chunck_length);
+ HMAC_Update(ctx, *data_chunks, *data_chunck_length);
data_chunks ++;
data_chunck_length ++;
}
- HMAC_Final(&ctx, mac, reinterpret_cast<uint32_t*>(mac_length));
- HMAC_CTX_cleanup(&ctx);
+ HMAC_Final(ctx, mac, reinterpret_cast<uint32_t*>(mac_length));
+ HMAC_CTX_free(ctx);
}
void* createSha1HmacContext(uint8_t* key, int32_t key_length)
{
- HMAC_CTX* ctx = (HMAC_CTX*)malloc(sizeof(HMAC_CTX));
+ HMAC_CTX* ctx = HMAC_CTX_new();
- HMAC_CTX_init(ctx);
HMAC_Init_ex(ctx, key, key_length, EVP_sha1(), NULL);
return ctx;
}
@@ -80,7 +80,11 @@ void* initializeSha1HmacContext(void* ctx, uint8_t* key, int32_t keyLength)
{
HMAC_CTX *pctx = (HMAC_CTX*)ctx;
+#if (OPENSSL_VERSION_NUMBER < 0x10100000L) || defined (LIBRESSL_VERSION_NUMBER)
HMAC_CTX_init(pctx);
+#else
+ HMAC_CTX_reset(pctx);
+#endif
HMAC_Init_ex(pctx, key, keyLength, EVP_sha1(), NULL);
return pctx;
}
@@ -112,8 +116,7 @@ void hmacSha1Ctx(void* ctx, const uint8_t* data[], uint32_t data_length[],
void freeSha1HmacContext(void* ctx)
{
if (ctx) {
- HMAC_CTX_cleanup((HMAC_CTX*)ctx);
- free(ctx);
+ HMAC_CTX_free((HMAC_CTX*)ctx);
}
}
diff --git a/deps/pjsip/third_party/zsrtp/zrtp/zrtp/crypto/openssl/hmac256.cpp b/deps/pjsip/third_party/zsrtp/zrtp/zrtp/crypto/openssl/hmac256.cpp
index 0953ad5c..2dd6f807 100644
--- a/deps/pjsip/third_party/zsrtp/zrtp/zrtp/crypto/openssl/hmac256.cpp
+++ b/deps/pjsip/third_party/zsrtp/zrtp/zrtp/crypto/openssl/hmac256.cpp
@@ -38,6 +38,8 @@
#include <openssl/hmac.h>
#include <crypto/hmac256.h>
+#include "openssl_compat.h"
+
#if defined(__APPLE__)
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
@@ -58,17 +60,16 @@ void hmac_sha256(uint8_t* key, uint32_t key_length,
uint8_t* mac, uint32_t* mac_length )
{
unsigned int tmp;
- HMAC_CTX ctx;
- HMAC_CTX_init( &ctx );
- HMAC_Init_ex( &ctx, key, key_length, EVP_sha256(), NULL );
+ HMAC_CTX* ctx = HMAC_CTX_new();
+ HMAC_Init_ex( ctx, key, key_length, EVP_sha256(), NULL );
while( *data_chunks ){
- HMAC_Update( &ctx, *data_chunks, *data_chunck_length );
+ HMAC_Update( ctx, *data_chunks, *data_chunck_length );
data_chunks ++;
data_chunck_length ++;
}
- HMAC_Final( &ctx, mac, &tmp);
+ HMAC_Final( ctx, mac, &tmp);
*mac_length = tmp;
- HMAC_CTX_cleanup( &ctx );
+ HMAC_CTX_free( ctx );
}
#if defined(__APPLE__)
diff --git a/deps/pjsip/third_party/zsrtp/zrtp/zrtp/crypto/openssl/hmac384.cpp b/deps/pjsip/third_party/zsrtp/zrtp/zrtp/crypto/openssl/hmac384.cpp
index f1dd5abc..28191f4c 100644
--- a/deps/pjsip/third_party/zsrtp/zrtp/zrtp/crypto/openssl/hmac384.cpp
+++ b/deps/pjsip/third_party/zsrtp/zrtp/zrtp/crypto/openssl/hmac384.cpp
@@ -38,6 +38,8 @@
#include <openssl/hmac.h>
#include <zrtp/crypto/hmac256.h>
+#include "openssl_compat.h"
+
#if defined(__APPLE__)
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
@@ -56,17 +58,16 @@ void hmac_sha384(uint8_t* key, uint32_t key_length,
uint8_t* mac, uint32_t* mac_length )
{
unsigned int tmp;
- HMAC_CTX ctx;
- HMAC_CTX_init( &ctx );
- HMAC_Init_ex( &ctx, key, key_length, EVP_sha384(), NULL );
+ HMAC_CTX* ctx = HMAC_CTX_new();
+ HMAC_Init_ex( ctx, key, key_length, EVP_sha384(), NULL );
while( *data_chunks ){
- HMAC_Update( &ctx, *data_chunks, *data_chunck_length );
+ HMAC_Update( ctx, *data_chunks, *data_chunck_length );
data_chunks ++;
data_chunck_length ++;
}
- HMAC_Final( &ctx, mac, &tmp);
+ HMAC_Final( ctx, mac, &tmp);
*mac_length = tmp;
- HMAC_CTX_cleanup( &ctx );
+ HMAC_CTX_free( ctx );
}
#if defined(__APPLE__)
diff --git a/deps/pjsip/third_party/zsrtp/zrtp/zrtp/crypto/openssl/zrtpDH.cpp b/deps/pjsip/third_party/zsrtp/zrtp/zrtp/crypto/openssl/zrtpDH.cpp
index 2623d2a3..76089951 100644
--- a/deps/pjsip/third_party/zsrtp/zrtp/zrtp/crypto/openssl/zrtpDH.cpp
+++ b/deps/pjsip/third_party/zsrtp/zrtp/zrtp/crypto/openssl/zrtpDH.cpp
@@ -223,24 +223,35 @@ ZrtpDH::ZrtpDH(const char* type) {
}
DH* tmpCtx = NULL;
+ BIGNUM *p = NULL;
+ BIGNUM* priv_key = NULL;
+ BIGNUM *g = BN_new();
switch (pkType) {
case DH2K:
case DH3K:
ctx = static_cast<void*>(DH_new());
tmpCtx = static_cast<DH*>(ctx);
- tmpCtx->g = BN_new();
- BN_set_word(tmpCtx->g, DH_GENERATOR_2);
+ BN_set_word(g, DH_GENERATOR_2);
if (pkType == DH2K) {
- tmpCtx->p = BN_dup(bnP2048);
+ p = BN_dup(bnP2048);
RAND_bytes(random, 32);
- tmpCtx->priv_key = BN_bin2bn(random, 32, NULL);
+ priv_key = BN_bin2bn(random, 32, NULL);
}
else if (pkType == DH3K) {
- tmpCtx->p = BN_dup(bnP3072);
+ p = BN_dup(bnP3072);
RAND_bytes(random, 64);
- tmpCtx->priv_key = BN_bin2bn(random, 32, NULL);
+ priv_key = BN_bin2bn(random, 32, NULL);
}
+
+#if (OPENSSL_VERSION_NUMBER < 0x10100000L) || defined (LIBRESSL_VERSION_NUMBER)
+ tmpCtx->g = g;
+ tmpCtx->p = p;
+ tmpCtx->priv_key = priv_key;
+#else
+ DH_set0_pqg(tmpCtx, p, NULL, g);
+ DH_set0_key(tmpCtx, NULL, priv_key);
+#endif
break;
case EC25:
@@ -274,11 +285,16 @@ int32_t ZrtpDH::computeSecretKey(uint8_t *pubKeyBytes, uint8_t *secret) {
if (pkType == DH2K || pkType == DH3K) {
DH* tmpCtx = static_cast<DH*>(ctx);
+ BIGNUM* pub_key = BN_bin2bn(pubKeyBytes, getDhSize(), NULL);
+#if (OPENSSL_VERSION_NUMBER < 0x10100000L) || defined (LIBRESSL_VERSION_NUMBER)
if (tmpCtx->pub_key != NULL) {
- BN_free(tmpCtx->pub_key);
+ BN_free(tmpCtx->pub_key);
}
- tmpCtx->pub_key = BN_bin2bn(pubKeyBytes, getDhSize(), NULL);
- return DH_compute_key(secret, tmpCtx->pub_key, tmpCtx);
+ tmpCtx->pub_key = pub_key;
+#else
+ DH_set0_key(tmpCtx, pub_key, NULL);
+#endif
+ return DH_compute_key(secret, pub_key, tmpCtx);
}
if (pkType == EC25 || pkType == EC38) {
uint8_t buffer[100];
@@ -323,8 +339,15 @@ int32_t ZrtpDH::getDhSize() const
int32_t ZrtpDH::getPubKeySize() const
{
- if (pkType == DH2K || pkType == DH3K)
- return BN_num_bytes(static_cast<DH*>(ctx)->pub_key);
+ if (pkType == DH2K || pkType == DH3K){
+ const BIGNUM* pub_key;
+#if (OPENSSL_VERSION_NUMBER < 0x10100000L) || defined (LIBRESSL_VERSION_NUMBER)
+ pub_key = static_cast<DH*>(ctx)->pub_key;
+#else
+ DH_get0_key(static_cast<DH*>(ctx), &pub_key, NULL);
+#endif
+ return BN_num_bytes(pub_key);
+ }
if (pkType == EC25 || pkType == EC38)
return EC_POINT_point2oct(EC_KEY_get0_group(static_cast<EC_KEY*>(ctx)),
@@ -343,7 +366,13 @@ int32_t ZrtpDH::getPubKeyBytes(uint8_t *buf) const
if (prepend > 0) {
memset(buf, 0, prepend);
}
- return BN_bn2bin(static_cast<DH*>(ctx)->pub_key, buf + prepend);
+ const BIGNUM* pub_key;
+#if (OPENSSL_VERSION_NUMBER < 0x10100000L) || defined (LIBRESSL_VERSION_NUMBER)
+ pub_key = static_cast<DH*>(ctx)->pub_key;
+#else
+ DH_get0_key(static_cast<DH*>(ctx), &pub_key, NULL);
+#endif
+ return BN_bn2bin(pub_key, buf + prepend);
}
if (pkType == EC25 || pkType == EC38) {
uint8_t buffer[100];

View File

@ -21,7 +21,7 @@ DEPENDENCIES="
virtual/pkg-config virtual/pkg-config
build+run: build+run:
dev-db/sqlite:3 dev-db/sqlite:3
dev-python/python-application[>=2.0.0][python_abis:*(-)?] dev-python/python-application[>=2.5.0][python_abis:*(-)?]
media-libs/libvpx media-libs/libvpx
media-libs/v4l-utils media-libs/v4l-utils
sys-apps/util-linux sys-apps/util-linux
@ -48,10 +48,6 @@ DEPENDENCIES="
DEFAULT_SRC_PREPARE_PATCHES=( DEFAULT_SRC_PREPARE_PATCHES=(
"${FILES}"/${PNV}-fix-build.patch "${FILES}"/${PNV}-fix-build.patch
"${FILES}"/${PNV}-pjmedia-ffmpeg-fix.patch
"${FILES}"/${PN}-support-openssl-1.1_01.patch
"${FILES}"/${PN}-support-openssl-1.1_02.patch
-p0 "${FILES}"/${PNV}-pjmedia-openh264-1.6.patch
) )
src_compile() { src_compile() {