kopete-srtp2.patch 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  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 )
  13. if ( SRTP_INCLUDE_DIR AND SRTP_LIBRARY )
  14. set ( SRTP_FOUND true )
  15. diff --git a/protocols/jabber/libjingle/talk/session/phone/srtpfilter.cc b/protocols/jabber/libjingle/talk/session/phone/srtpfilter.cc
  16. index 7a1cb7866..f5363a36a 100644
  17. --- a/protocols/jabber/libjingle/talk/session/phone/srtpfilter.cc
  18. +++ b/protocols/jabber/libjingle/talk/session/phone/srtpfilter.cc
  19. @@ -416,7 +416,7 @@ bool SrtpSession::ProtectRtp(void* p, int in_len, int max_len, int* out_len) {
  20. }
  21. int seq_num;
  22. GetRtpSeqNum(p, in_len, &seq_num);
  23. - if (err != err_status_ok) {
  24. + if (err != srtp_err_status_ok) {
  25. LOG(LS_WARNING) << "Failed to protect SRTP packet, seqnum="
  26. << seq_num << ", err=" << err << ", last seqnum="
  27. << last_send_seq_num_;
  28. @@ -442,7 +442,7 @@ bool SrtpSession::ProtectRtcp(void* p, int in_len, int max_len, int* out_len) {
  29. *out_len = in_len;
  30. int err = srtp_protect_rtcp(session_, p, out_len);
  31. srtp_stat_->AddProtectRtcpResult(err);
  32. - if (err != err_status_ok) {
  33. + if (err != srtp_err_status_ok) {
  34. LOG(LS_WARNING) << "Failed to protect SRTCP packet, err=" << err;
  35. return false;
  36. }
  37. @@ -461,7 +461,7 @@ bool SrtpSession::UnprotectRtp(void* p, int in_len, int* out_len) {
  38. if (GetRtpSsrc(p, in_len, &ssrc)) {
  39. srtp_stat_->AddUnprotectRtpResult(ssrc, err);
  40. }
  41. - if (err != err_status_ok) {
  42. + if (err != srtp_err_status_ok) {
  43. LOG(LS_WARNING) << "Failed to unprotect SRTP packet, err=" << err;
  44. return false;
  45. }
  46. @@ -477,7 +477,7 @@ bool SrtpSession::UnprotectRtcp(void* p, int in_len, int* out_len) {
  47. *out_len = in_len;
  48. int err = srtp_unprotect_rtcp(session_, p, out_len);
  49. srtp_stat_->AddUnprotectRtcpResult(err);
  50. - if (err != err_status_ok) {
  51. + if (err != srtp_err_status_ok) {
  52. LOG(LS_WARNING) << "Failed to unprotect SRTCP packet, err=" << err;
  53. return false;
  54. }
  55. @@ -504,11 +504,11 @@ bool SrtpSession::SetKey(int type, const std::string& cs,
  56. memset(&policy, 0, sizeof(policy));
  57. if (cs == CS_AES_CM_128_HMAC_SHA1_80) {
  58. - crypto_policy_set_aes_cm_128_hmac_sha1_80(&policy.rtp);
  59. - crypto_policy_set_aes_cm_128_hmac_sha1_80(&policy.rtcp);
  60. + srtp_crypto_policy_set_aes_cm_128_hmac_sha1_80(&policy.rtp);
  61. + srtp_crypto_policy_set_aes_cm_128_hmac_sha1_80(&policy.rtcp);
  62. } else if (cs == CS_AES_CM_128_HMAC_SHA1_32) {
  63. - crypto_policy_set_aes_cm_128_hmac_sha1_32(&policy.rtp); // rtp is 32,
  64. - crypto_policy_set_aes_cm_128_hmac_sha1_80(&policy.rtcp); // rtcp still 80
  65. + srtp_crypto_policy_set_aes_cm_128_hmac_sha1_32(&policy.rtp); // rtp is 32,
  66. + srtp_crypto_policy_set_aes_cm_128_hmac_sha1_80(&policy.rtcp); // rtcp still 80
  67. } else {
  68. LOG(LS_WARNING) << "Failed to create SRTP session: unsupported"
  69. << " cipher_suite " << cs.c_str();
  70. @@ -520,7 +520,7 @@ bool SrtpSession::SetKey(int type, const std::string& cs,
  71. return false;
  72. }
  73. - policy.ssrc.type = static_cast<ssrc_type_t>(type);
  74. + policy.ssrc.type = static_cast<srtp_ssrc_type_t>(type);
  75. policy.ssrc.value = 0;
  76. policy.key = const_cast<uint8*>(key);
  77. // TODO parse window size from WSH session-param
  78. @@ -529,7 +529,7 @@ bool SrtpSession::SetKey(int type, const std::string& cs,
  79. policy.next = NULL;
  80. int err = srtp_create(&session_, &policy);
  81. - if (err != err_status_ok) {
  82. + if (err != srtp_err_status_ok) {
  83. LOG(LS_ERROR) << "Failed to create SRTP session, err=" << err;
  84. return false;
  85. }
  86. @@ -543,13 +543,13 @@ bool SrtpSession::Init() {
  87. if (!inited_) {
  88. int err;
  89. err = srtp_init();
  90. - if (err != err_status_ok) {
  91. + if (err != srtp_err_status_ok) {
  92. LOG(LS_ERROR) << "Failed to init SRTP, err=" << err;
  93. return false;
  94. }
  95. err = srtp_install_event_handler(&SrtpSession::HandleEventThunk);
  96. - if (err != err_status_ok) {
  97. + if (err != srtp_err_status_ok) {
  98. LOG(LS_ERROR) << "Failed to install SRTP event handler, err=" << err;
  99. return false;
  100. }
  101. @@ -652,10 +652,10 @@ void SrtpStat::AddProtectRtpResult(uint32 ssrc, int result) {
  102. key.ssrc = ssrc;
  103. key.mode = SrtpFilter::PROTECT;
  104. switch (result) {
  105. - case err_status_ok:
  106. + case srtp_err_status_ok:
  107. key.error = SrtpFilter::ERROR_NONE;
  108. break;
  109. - case err_status_auth_fail:
  110. + case srtp_err_status_auth_fail:
  111. key.error = SrtpFilter::ERROR_AUTH;
  112. break;
  113. default:
  114. @@ -669,14 +669,14 @@ void SrtpStat::AddUnprotectRtpResult(uint32 ssrc, int result) {
  115. key.ssrc = ssrc;
  116. key.mode = SrtpFilter::UNPROTECT;
  117. switch (result) {
  118. - case err_status_ok:
  119. + case srtp_err_status_ok:
  120. key.error = SrtpFilter::ERROR_NONE;
  121. break;
  122. - case err_status_auth_fail:
  123. + case srtp_err_status_auth_fail:
  124. key.error = SrtpFilter::ERROR_AUTH;
  125. break;
  126. - case err_status_replay_fail:
  127. - case err_status_replay_old:
  128. + case srtp_err_status_replay_fail:
  129. + case srtp_err_status_replay_old:
  130. key.error = SrtpFilter::ERROR_REPLAY;
  131. break;
  132. default:
  133. diff --git a/protocols/jabber/libjingle/talk/session/phone/srtpfilter.h b/protocols/jabber/libjingle/talk/session/phone/srtpfilter.h
  134. index 991d4bf42..ff4e5070f 100644
  135. --- a/protocols/jabber/libjingle/talk/session/phone/srtpfilter.h
  136. +++ b/protocols/jabber/libjingle/talk/session/phone/srtpfilter.h
  137. @@ -39,11 +39,7 @@
  138. #include "talk/session/phone/cryptoparams.h"
  139. #include "talk/p2p/base/sessiondescription.h"
  140. -// Forward declaration to avoid pulling in libsrtp headers here
  141. -struct srtp_event_data_t;
  142. -struct srtp_ctx_t;
  143. -typedef srtp_ctx_t* srtp_t;
  144. -struct srtp_policy_t;
  145. +#include "srtp2/srtp.h"
  146. namespace cricket {