| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2004 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2004 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 #include "webrtc/pc/srtpfilter.h" |
| 12 |
| 13 #include "third_party/libsrtp/include/srtp.h" |
| 11 #include "webrtc/base/byteorder.h" | 14 #include "webrtc/base/byteorder.h" |
| 12 #include "webrtc/base/constructormagic.h" | 15 #include "webrtc/base/constructormagic.h" |
| 13 #include "webrtc/base/gunit.h" | 16 #include "webrtc/base/gunit.h" |
| 14 #include "webrtc/base/thread.h" | 17 #include "webrtc/base/thread.h" |
| 15 #include "webrtc/media/base/cryptoparams.h" | 18 #include "webrtc/media/base/cryptoparams.h" |
| 16 #include "webrtc/media/base/fakertp.h" | 19 #include "webrtc/media/base/fakertp.h" |
| 17 #include "webrtc/p2p/base/sessiondescription.h" | 20 #include "webrtc/p2p/base/sessiondescription.h" |
| 18 #include "webrtc/pc/srtpfilter.h" | |
| 19 extern "C" { | |
| 20 #ifdef SRTP_RELATIVE_PATH | |
| 21 #include "crypto/include/err.h" | |
| 22 #else | |
| 23 #include "third_party/libsrtp/crypto/include/err.h" | |
| 24 #endif | |
| 25 } | |
| 26 | 21 |
| 27 using rtc::CS_AES_CM_128_HMAC_SHA1_80; | 22 using rtc::CS_AES_CM_128_HMAC_SHA1_80; |
| 28 using rtc::CS_AES_CM_128_HMAC_SHA1_32; | 23 using rtc::CS_AES_CM_128_HMAC_SHA1_32; |
| 29 using rtc::CS_AEAD_AES_128_GCM; | 24 using rtc::CS_AEAD_AES_128_GCM; |
| 30 using rtc::CS_AEAD_AES_256_GCM; | 25 using rtc::CS_AEAD_AES_256_GCM; |
| 31 using cricket::CryptoParams; | 26 using cricket::CryptoParams; |
| 32 using cricket::CS_LOCAL; | 27 using cricket::CS_LOCAL; |
| 33 using cricket::CS_REMOTE; | 28 using cricket::CS_REMOTE; |
| 34 | 29 |
| 35 static const uint8_t kTestKey1[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234"; | 30 static const uint8_t kTestKey1[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234"; |
| (...skipping 901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 937 srtp_stat_.AddUnprotectRtcpResult(srtp_err_status_fail); | 932 srtp_stat_.AddUnprotectRtcpResult(srtp_err_status_fail); |
| 938 EXPECT_EQ(-1, mode_); | 933 EXPECT_EQ(-1, mode_); |
| 939 EXPECT_EQ(cricket::SrtpFilter::ERROR_NONE, error_); | 934 EXPECT_EQ(cricket::SrtpFilter::ERROR_NONE, error_); |
| 940 // Now the error will be triggered again. | 935 // Now the error will be triggered again. |
| 941 Reset(); | 936 Reset(); |
| 942 rtc::Thread::Current()->SleepMs(210); | 937 rtc::Thread::Current()->SleepMs(210); |
| 943 srtp_stat_.AddUnprotectRtcpResult(srtp_err_status_fail); | 938 srtp_stat_.AddUnprotectRtcpResult(srtp_err_status_fail); |
| 944 EXPECT_EQ(cricket::SrtpFilter::UNPROTECT, mode_); | 939 EXPECT_EQ(cricket::SrtpFilter::UNPROTECT, mode_); |
| 945 EXPECT_EQ(cricket::SrtpFilter::ERROR_FAIL, error_); | 940 EXPECT_EQ(cricket::SrtpFilter::ERROR_FAIL, error_); |
| 946 } | 941 } |
| OLD | NEW |