]> git.pld-linux.org Git - packages/mediastreamer.git/blob - libsrtp2.patch
- update matroska deps
[packages/mediastreamer.git] / libsrtp2.patch
1 diff -u -r mediastreamer2-2.16.1/configure.ac mediastreamer2-2.16.1-libsrtp2/configure.ac
2 --- mediastreamer2-2.16.1/configure.ac  2017-07-21 15:00:47.000000000 +0200
3 +++ mediastreamer2-2.16.1-libsrtp2/configure.ac 2018-01-13 00:06:22.194089121 +0100
4 @@ -1041,7 +1041,7 @@
5  
6  dnl check for libsrtp support (secure rtp)
7  AC_ARG_WITH(srtp,
8 -       AC_HELP_STRING([--with-srtp], [Set prefix where libsrtp can be found or "none" to disable (ex:/usr or /usr/local) [[default=/usr]]]),
9 +       AC_HELP_STRING([--with-srtp], [Set prefix where libsrtp2 can be found or "none" to disable (ex:/usr or /usr/local) [[default=/usr]]]),
10         [srtp_prefix=$withval],
11         [if test "$prefix" != "NONE"; then
12                 srtp_prefix=$prefix
13 @@ -1051,22 +1051,22 @@
14  
15  if test "${srtp_prefix}" != "none" ; then
16         if test "${srtp_prefix}" != "/usr" ; then
17 -               SRTP_CFLAGS="-I${srtp_prefix}/include -I${srtp_prefix}/include/srtp"
18 +               SRTP_CFLAGS="-I${srtp_prefix}/include -I${srtp_prefix}/include/srtp2"
19                 SRTP_LIBS="-L${srtp_prefix}/lib"
20         fi
21 -       SRTP_LIBS="$SRTP_LIBS -lsrtp"
22 +       SRTP_LIBS="$SRTP_LIBS -lsrtp2"
23  
24         dnl check srtp headers
25         CPPFLAGS_save=$CPPFLAGS
26         CPPFLAGS="$CPPFLAGS $SRTP_CFLAGS"
27 -       AC_CHECK_HEADER([srtp/srtp.h],have_srtp_headers=yes)
28 +       AC_CHECK_HEADER([srtp2/srtp.h],have_srtp_headers=yes)
29         CPPFLAGS=$CPPFLAGS_save
30  
31         dnl check for srtp lib
32         LDFLAGS_save=$LDFLAGS
33         LDFLAGS="$LDFLAGS $SRTP_LIBS"
34         LIBS_save=$LIBS
35 -       AC_CHECK_LIB(srtp,[srtp_init, crypto_policy_set_aes_cm_256_hmac_sha1_80, crypto_policy_set_aes_cm_256_hmac_sha1_32], have_srtp_lib=yes)
36 +       AC_CHECK_LIB(srtp2,[srtp_init, srtp_crypto_policy_set_aes_cm_256_hmac_sha1_80, srtp_crypto_policy_set_aes_cm_256_hmac_sha1_32], have_srtp_lib=yes)
37         LDFLAGS=$LDFLAGS_save
38         LIBS=$LIBS_save
39  
40 @@ -1075,9 +1075,9 @@
41                 LIBS_save=$LIBS
42                 LDFLAGS="$LDFLAGS $SRTP_LIBS"
43                 AC_CHECK_LIB(
44 -                       srtp,
45 +                       srtp2,
46                         sha1_update,[
47 -                               AC_MSG_WARN([This libsrtp version exports symbols conflicting with polarssl, resulting in a bad execution path. libsrtp will be statically linked])
48 +                               AC_MSG_WARN([This libsrtp2 version exports symbols conflicting with polarssl, resulting in a bad execution path. libsrtp2 will be statically linked])
49                                 srtp_polarssl_conflict=yes
50                         ],
51                         srtp_polarssl_conflict=no
52 @@ -1086,13 +1086,13 @@
53                 LIBS=$LIBS_save
54  
55                 if test "$srtp_polarssl_conflict" = "yes"; then
56 -                       srtp_static_lib="${srtp_prefix}/lib/libsrtp.a"
57 +                       srtp_static_lib="${srtp_prefix}/lib/libsrtp2.a"
58                         if test -f $srtp_static_lib -a -r $srtp_static_lib; then
59 -                               SRTP_LIBS="${srtp_prefix}/lib/libsrtp.a -Bsymbolic -Wl,--version-script=\$(top_srcdir)/src/libsrtp.map"
60 +                               SRTP_LIBS="${srtp_prefix}/lib/libsrtp2.a -Bsymbolic -Wl,--version-script=\$(top_srcdir)/src/libsrtp2.map"
61                                 AC_DEFINE(HAVE_SRTP, 1, [Defined when srtp support is compiled])
62                                 have_srtp=true
63                         else
64 -                               AC_MSG_WARN([Could not access to $srtp_static_lib. Please use --with-srtp=PREFIX to specify the prefix where libsrtp.a has been installed])
65 +                               AC_MSG_WARN([Could not access to $srtp_static_lib. Please use --with-srtp=PREFIX to specify the prefix where libsrtp2.a has been installed])
66                                 SRTP_CFLAGS=
67                                 SRTP_LIBS=
68                                 have_srtp=true
69 diff -u -r mediastreamer2-2.16.1/src/crypto/ms_srtp.c mediastreamer2-2.16.1-libsrtp2/src/crypto/ms_srtp.c
70 --- mediastreamer2-2.16.1/src/crypto/ms_srtp.c  2017-07-21 15:00:47.000000000 +0200
71 +++ mediastreamer2-2.16.1-libsrtp2/src/crypto/ms_srtp.c 2018-01-13 00:14:48.575306030 +0100
72 @@ -38,7 +38,7 @@
73  // Windows phone doesn't use make install
74  #include <srtp.h>
75  #else
76 -#include <srtp/srtp.h>
77 +#include <srtp2/srtp.h>
78  #endif
79  
80  
81 @@ -99,7 +99,7 @@
82  /**** Sender functions ****/
83  static int _process_on_send(RtpSession* session,MSSrtpStreamContext *ctx, mblk_t *m){
84         int slen;
85 -       err_status_t err;
86 +       srtp_err_status_t err;
87         bool_t is_rtp=ctx->is_rtp;
88         rtp_header_t *rtp_header=is_rtp?(rtp_header_t*)m->b_rptr:NULL;
89         rtcp_common_header_t *rtcp_header=!is_rtp?(rtcp_common_header_t*)m->b_rptr:NULL;
90 @@ -109,7 +109,7 @@
91                 ms_mutex_lock(&ctx->mutex);
92                 if (!ctx->secured) {
93                         /*does not make sense to protect, because we don't have any key*/
94 -                       err=err_status_ok;
95 +                       err=srtp_err_status_ok;
96                         slen = 0; /*droping packets*/
97                 } else {
98                         /* defragment incoming message and enlarge the buffer for srtp to write its data */
99 @@ -120,7 +120,7 @@
100         } else if (rtcp_header && (slen>RTP_FIXED_HEADER_SIZE && rtcp_header->version==2)) {
101                 ms_mutex_lock(&ctx->mutex);
102                 if (!ctx->secured) {
103 -                       err=err_status_ok;
104 +                       err=srtp_err_status_ok;
105                         /*does not make sense to protect, because we don't have any key*/
106                         slen = 0; /*droping packets*/
107                 } else {
108 @@ -135,7 +135,7 @@
109         }
110  
111         /* check return code from srtp_protect */
112 -       if (err==err_status_ok){
113 +       if (err==srtp_err_status_ok){
114                 return slen;
115         }
116         ortp_error("srtp_protect%s() failed (%d) for stream ctx [%p]", is_rtp?"":"_rtcp", err,ctx);
117 @@ -151,7 +151,7 @@
118  }
119  static int _process_on_receive(RtpSession* session,MSSrtpStreamContext *ctx, mblk_t *m, int err){
120         int slen;
121 -       err_status_t srtp_err;
122 +       srtp_err_status_t srtp_err;
123         bool_t is_rtp=ctx->is_rtp;
124  
125         /* keep NON-RTP data unencrypted */
126 @@ -167,7 +167,7 @@
127  
128         slen=err;
129         srtp_err = is_rtp?srtp_unprotect(ctx->srtp,m->b_rptr,&slen):srtp_unprotect_rtcp(ctx->srtp,m->b_rptr,&slen);
130 -       if (srtp_err==err_status_ok) {
131 +       if (srtp_err==srtp_err_status_ok) {
132                 return slen;
133         } else {
134                 ms_error("srtp_unprotect%s() failed (%d) on stream ctx [%p]", is_rtp?"":"_rtcp", srtp_err,ctx);
135 @@ -201,7 +201,7 @@
136  
137  
138  static int ms_media_stream_session_fill_srtp_context(MSMediaStreamSessions *sessions, bool_t is_send, bool_t is_rtp) {
139 -       err_status_t err=0;
140 +       srtp_err_status_t err=0;
141         RtpTransport *transport=NULL;
142         MSSrtpStreamContext* stream_ctx = get_stream_context(sessions,is_send,is_rtp);
143  
144 @@ -258,28 +258,28 @@
145  }
146  
147  
148 -static int ms_set_srtp_crypto_policy(MSCryptoSuite suite, crypto_policy_t *policy) {
149 +static int ms_set_srtp_srtp_crypto_policy(MSCryptoSuite suite, srtp_crypto_policy_t *policy) {
150         switch(suite){
151                 case MS_AES_128_SHA1_32:
152                         // srtp doc says: not adapted to rtcp...
153 -                       crypto_policy_set_aes_cm_128_hmac_sha1_32(policy);
154 +                       srtp_crypto_policy_set_aes_cm_128_hmac_sha1_32(policy);
155                         break;
156                 case MS_AES_128_NO_AUTH:
157                         // srtp doc says: not adapted to rtcp...
158 -                       crypto_policy_set_aes_cm_128_null_auth(policy);
159 +                       srtp_crypto_policy_set_aes_cm_128_null_auth(policy);
160                         break;
161                 case MS_NO_CIPHER_SHA1_80:
162 -                       crypto_policy_set_null_cipher_hmac_sha1_80(policy);
163 +                       srtp_crypto_policy_set_null_cipher_hmac_sha1_80(policy);
164                         break;
165                 case MS_AES_128_SHA1_80: /*default mode*/
166 -                       crypto_policy_set_aes_cm_128_hmac_sha1_80(policy);
167 +                       srtp_crypto_policy_set_aes_cm_128_hmac_sha1_80(policy);
168                         break;
169                 case MS_AES_256_SHA1_80: // For backward compatibility
170                 case MS_AES_CM_256_SHA1_80:
171 -                   crypto_policy_set_aes_cm_256_hmac_sha1_80(policy);
172 -            break;
173 +                       srtp_crypto_policy_set_aes_cm_256_hmac_sha1_80(policy);
174 +                       break;
175                 case MS_AES_256_SHA1_32:
176 -                       crypto_policy_set_aes_cm_256_hmac_sha1_32(policy);
177 +                       srtp_crypto_policy_set_aes_cm_256_hmac_sha1_32(policy);
178                         break;
179                 case MS_CRYPTO_SUITE_INVALID:
180                         return -1;
181 @@ -291,13 +291,13 @@
182  static int ms_add_srtp_stream(srtp_t srtp, MSCryptoSuite suite, uint32_t ssrc, const char* key, size_t key_length, bool_t is_send, bool_t is_rtp)
183  {
184         srtp_policy_t policy;
185 -       err_status_t err;
186 -       ssrc_t ssrc_conf;
187 +       srtp_err_status_t err;
188 +       srtp_ssrc_t ssrc_conf;
189  
190         memset(&policy,0,sizeof(policy));
191  
192         if (is_rtp) {
193 -               if (ms_set_srtp_crypto_policy(suite, &policy.rtp) != 0) {
194 +               if (ms_set_srtp_srtp_crypto_policy(suite, &policy.rtp) != 0) {
195                         return -1;
196                 }
197                 /* check if key length match given policy */
198 @@ -306,7 +306,7 @@
199                         return -1;
200                 }
201         }else {
202 -               if (ms_set_srtp_crypto_policy(suite, &policy.rtcp) != 0) {
203 +               if (ms_set_srtp_srtp_crypto_policy(suite, &policy.rtcp) != 0) {
204                         return -1;
205                 }
206                 if ((int)key_length != policy.rtcp.cipher_key_len) {
207 @@ -326,7 +326,7 @@
208         policy.next = NULL;
209  
210         err = srtp_add_stream(srtp, &policy);
211 -       if (err != err_status_ok) {
212 +       if (err != srtp_err_status_ok) {
213                 ms_error("Failed to add stream to srtp session (%d)", err);
214                 return -1;
215         }
216 @@ -344,7 +344,7 @@
217  int ms_srtp_init(void)
218  {
219  
220 -       err_status_t st=0;
221 +       srtp_err_status_t st=0;
222         ms_message("srtp init");
223         if (!srtp_init_done) {
224                 st=srtp_init();
225 @@ -352,7 +352,6 @@
226                         srtp_init_done++;
227                 }else{
228                         ms_fatal("Couldn't initialize SRTP library: %d.", st);
229 -                       err_reporting_init("mediastreamer2");
230                 }
231         }else srtp_init_done++;
232         return (int)st;
233 @@ -508,7 +507,7 @@
234  #else /* HAVE_SRTP */
235  
236  typedef void* srtp_t;
237 -typedef int err_status_t;
238 +typedef int srtp_err_status_t;
239  
240  bool_t ms_srtp_supported(void){
241         return FALSE;
This page took 0.10544 seconds and 3 git commands to generate.