1 diff --git a/cmake/modules/FindSRTP.cmake b/cmake/modules/FindSRTP.cmake
2 index 4e8baa827..ce9033497 100644
3 --- a/cmake/modules/FindSRTP.cmake
4 +++ b/cmake/modules/FindSRTP.cmake
5 @@ -11,8 +11,8 @@ include ( FindPackageHandleStandardArgs )
6 if ( SRTP_INCLUDE_DIR AND SRTP_LIBRARY )
7 set ( SRTP_FOUND true )
8 else ( SRTP_INCLUDE_DIR AND SRTP_LIBRARY )
9 - find_path ( SRTP_INCLUDE_DIR srtp.h PATH_SUFFIXES srtp )
10 - find_library ( SRTP_LIBRARY NAMES srtp )
11 + find_path ( SRTP_INCLUDE_DIR srtp.h PATH_SUFFIXES srtp srtp2 )
12 + find_library ( SRTP_LIBRARY NAMES srtp srtp2 )
14 if ( SRTP_INCLUDE_DIR AND SRTP_LIBRARY )
15 set ( SRTP_FOUND true )
16 diff --git a/protocols/jabber/libjingle/talk/session/phone/srtpfilter.cc b/protocols/jabber/libjingle/talk/session/phone/srtpfilter.cc
17 index 7a1cb7866..f5363a36a 100644
18 --- a/protocols/jabber/libjingle/talk/session/phone/srtpfilter.cc
19 +++ b/protocols/jabber/libjingle/talk/session/phone/srtpfilter.cc
20 @@ -416,7 +416,7 @@ bool SrtpSession::ProtectRtp(void* p, int in_len, int max_len, int* out_len) {
23 GetRtpSeqNum(p, in_len, &seq_num);
24 - if (err != err_status_ok) {
25 + if (err != srtp_err_status_ok) {
26 LOG(LS_WARNING) << "Failed to protect SRTP packet, seqnum="
27 << seq_num << ", err=" << err << ", last seqnum="
28 << last_send_seq_num_;
29 @@ -442,7 +442,7 @@ bool SrtpSession::ProtectRtcp(void* p, int in_len, int max_len, int* out_len) {
31 int err = srtp_protect_rtcp(session_, p, out_len);
32 srtp_stat_->AddProtectRtcpResult(err);
33 - if (err != err_status_ok) {
34 + if (err != srtp_err_status_ok) {
35 LOG(LS_WARNING) << "Failed to protect SRTCP packet, err=" << err;
38 @@ -461,7 +461,7 @@ bool SrtpSession::UnprotectRtp(void* p, int in_len, int* out_len) {
39 if (GetRtpSsrc(p, in_len, &ssrc)) {
40 srtp_stat_->AddUnprotectRtpResult(ssrc, err);
42 - if (err != err_status_ok) {
43 + if (err != srtp_err_status_ok) {
44 LOG(LS_WARNING) << "Failed to unprotect SRTP packet, err=" << err;
47 @@ -477,7 +477,7 @@ bool SrtpSession::UnprotectRtcp(void* p, int in_len, int* out_len) {
49 int err = srtp_unprotect_rtcp(session_, p, out_len);
50 srtp_stat_->AddUnprotectRtcpResult(err);
51 - if (err != err_status_ok) {
52 + if (err != srtp_err_status_ok) {
53 LOG(LS_WARNING) << "Failed to unprotect SRTCP packet, err=" << err;
56 @@ -504,11 +504,11 @@ bool SrtpSession::SetKey(int type, const std::string& cs,
57 memset(&policy, 0, sizeof(policy));
59 if (cs == CS_AES_CM_128_HMAC_SHA1_80) {
60 - crypto_policy_set_aes_cm_128_hmac_sha1_80(&policy.rtp);
61 - crypto_policy_set_aes_cm_128_hmac_sha1_80(&policy.rtcp);
62 + srtp_crypto_policy_set_aes_cm_128_hmac_sha1_80(&policy.rtp);
63 + srtp_crypto_policy_set_aes_cm_128_hmac_sha1_80(&policy.rtcp);
64 } else if (cs == CS_AES_CM_128_HMAC_SHA1_32) {
65 - crypto_policy_set_aes_cm_128_hmac_sha1_32(&policy.rtp); // rtp is 32,
66 - crypto_policy_set_aes_cm_128_hmac_sha1_80(&policy.rtcp); // rtcp still 80
67 + srtp_crypto_policy_set_aes_cm_128_hmac_sha1_32(&policy.rtp); // rtp is 32,
68 + srtp_crypto_policy_set_aes_cm_128_hmac_sha1_80(&policy.rtcp); // rtcp still 80
70 LOG(LS_WARNING) << "Failed to create SRTP session: unsupported"
71 << " cipher_suite " << cs.c_str();
72 @@ -520,7 +520,7 @@ bool SrtpSession::SetKey(int type, const std::string& cs,
76 - policy.ssrc.type = static_cast<ssrc_type_t>(type);
77 + policy.ssrc.type = static_cast<srtp_ssrc_type_t>(type);
78 policy.ssrc.value = 0;
79 policy.key = const_cast<uint8*>(key);
80 // TODO parse window size from WSH session-param
81 @@ -529,7 +529,7 @@ bool SrtpSession::SetKey(int type, const std::string& cs,
84 int err = srtp_create(&session_, &policy);
85 - if (err != err_status_ok) {
86 + if (err != srtp_err_status_ok) {
87 LOG(LS_ERROR) << "Failed to create SRTP session, err=" << err;
90 @@ -543,13 +543,13 @@ bool SrtpSession::Init() {
94 - if (err != err_status_ok) {
95 + if (err != srtp_err_status_ok) {
96 LOG(LS_ERROR) << "Failed to init SRTP, err=" << err;
100 err = srtp_install_event_handler(&SrtpSession::HandleEventThunk);
101 - if (err != err_status_ok) {
102 + if (err != srtp_err_status_ok) {
103 LOG(LS_ERROR) << "Failed to install SRTP event handler, err=" << err;
106 @@ -652,10 +652,10 @@ void SrtpStat::AddProtectRtpResult(uint32 ssrc, int result) {
108 key.mode = SrtpFilter::PROTECT;
110 - case err_status_ok:
111 + case srtp_err_status_ok:
112 key.error = SrtpFilter::ERROR_NONE;
114 - case err_status_auth_fail:
115 + case srtp_err_status_auth_fail:
116 key.error = SrtpFilter::ERROR_AUTH;
119 @@ -669,14 +669,14 @@ void SrtpStat::AddUnprotectRtpResult(uint32 ssrc, int result) {
121 key.mode = SrtpFilter::UNPROTECT;
123 - case err_status_ok:
124 + case srtp_err_status_ok:
125 key.error = SrtpFilter::ERROR_NONE;
127 - case err_status_auth_fail:
128 + case srtp_err_status_auth_fail:
129 key.error = SrtpFilter::ERROR_AUTH;
131 - case err_status_replay_fail:
132 - case err_status_replay_old:
133 + case srtp_err_status_replay_fail:
134 + case srtp_err_status_replay_old:
135 key.error = SrtpFilter::ERROR_REPLAY;
138 diff --git a/protocols/jabber/libjingle/talk/session/phone/srtpfilter.h b/protocols/jabber/libjingle/talk/session/phone/srtpfilter.h
139 index 991d4bf42..ff4e5070f 100644
140 --- a/protocols/jabber/libjingle/talk/session/phone/srtpfilter.h
141 +++ b/protocols/jabber/libjingle/talk/session/phone/srtpfilter.h
143 #include "talk/session/phone/cryptoparams.h"
144 #include "talk/p2p/base/sessiondescription.h"
146 -// Forward declaration to avoid pulling in libsrtp headers here
147 -struct srtp_event_data_t;
149 -typedef srtp_ctx_t* srtp_t;
150 -struct srtp_policy_t;
151 +#include "srtp2/srtp.h"