| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2011 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 |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 ASSERT_TRUE(received_dtls_client_hello_); | 210 ASSERT_TRUE(received_dtls_client_hello_); |
| 211 ASSERT_FALSE(received_dtls_server_hello_); | 211 ASSERT_FALSE(received_dtls_server_hello_); |
| 212 } | 212 } |
| 213 } | 213 } |
| 214 | 214 |
| 215 void CheckSrtp(const std::string& expected_cipher) { | 215 void CheckSrtp(const std::string& expected_cipher) { |
| 216 for (std::vector<cricket::DtlsTransportChannelWrapper*>::iterator it = | 216 for (std::vector<cricket::DtlsTransportChannelWrapper*>::iterator it = |
| 217 channels_.begin(); it != channels_.end(); ++it) { | 217 channels_.begin(); it != channels_.end(); ++it) { |
| 218 std::string cipher; | 218 std::string cipher; |
| 219 | 219 |
| 220 bool rv = (*it)->GetSrtpCipher(&cipher); | 220 bool rv = (*it)->GetSrtpCryptoSuite(&cipher); |
| 221 if (negotiated_dtls_ && !expected_cipher.empty()) { | 221 if (negotiated_dtls_ && !expected_cipher.empty()) { |
| 222 ASSERT_TRUE(rv); | 222 ASSERT_TRUE(rv); |
| 223 | 223 |
| 224 ASSERT_EQ(cipher, expected_cipher); | 224 ASSERT_EQ(cipher, expected_cipher); |
| 225 } else { | 225 } else { |
| 226 ASSERT_FALSE(rv); | 226 ASSERT_FALSE(rv); |
| 227 } | 227 } |
| 228 } | 228 } |
| 229 } | 229 } |
| 230 | 230 |
| 231 void CheckSsl(const std::string& expected_cipher) { | 231 void CheckSsl(uint16_t expected_cipher) { |
| 232 for (std::vector<cricket::DtlsTransportChannelWrapper*>::iterator it = | 232 for (std::vector<cricket::DtlsTransportChannelWrapper*>::iterator it = |
| 233 channels_.begin(); it != channels_.end(); ++it) { | 233 channels_.begin(); it != channels_.end(); ++it) { |
| 234 std::string cipher; | 234 uint16_t cipher; |
| 235 | 235 |
| 236 bool rv = (*it)->GetSslCipher(&cipher); | 236 bool rv = (*it)->GetSslCipherSuite(&cipher); |
| 237 if (negotiated_dtls_ && !expected_cipher.empty()) { | 237 if (negotiated_dtls_ && expected_cipher) { |
| 238 ASSERT_TRUE(rv); | 238 ASSERT_TRUE(rv); |
| 239 | 239 |
| 240 ASSERT_EQ(cipher, expected_cipher); | 240 ASSERT_EQ(cipher, expected_cipher); |
| 241 } else { | 241 } else { |
| 242 ASSERT_FALSE(rv); | 242 ASSERT_FALSE(rv); |
| 243 } | 243 } |
| 244 } | 244 } |
| 245 } | 245 } |
| 246 | 246 |
| 247 void SendPackets(size_t channel, size_t size, size_t count, bool srtp) { | 247 void SendPackets(size_t channel, size_t size, size_t count, bool srtp) { |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 } | 456 } |
| 457 | 457 |
| 458 // Check that we negotiated the right ciphers. | 458 // Check that we negotiated the right ciphers. |
| 459 if (use_dtls_srtp_) { | 459 if (use_dtls_srtp_) { |
| 460 client1_.CheckSrtp(AES_CM_128_HMAC_SHA1_80); | 460 client1_.CheckSrtp(AES_CM_128_HMAC_SHA1_80); |
| 461 client2_.CheckSrtp(AES_CM_128_HMAC_SHA1_80); | 461 client2_.CheckSrtp(AES_CM_128_HMAC_SHA1_80); |
| 462 } else { | 462 } else { |
| 463 client1_.CheckSrtp(""); | 463 client1_.CheckSrtp(""); |
| 464 client2_.CheckSrtp(""); | 464 client2_.CheckSrtp(""); |
| 465 } | 465 } |
| 466 client1_.CheckSsl( | 466 client1_.CheckSsl(rtc::SSLStreamAdapter::GetDefaultSslCipherForTest( |
| 467 rtc::SSLStreamAdapter::GetDefaultSslCipher(ssl_expected_version_)); | 467 ssl_expected_version_, rtc::KT_DEFAULT)); |
| 468 client2_.CheckSsl( | 468 client2_.CheckSsl(rtc::SSLStreamAdapter::GetDefaultSslCipherForTest( |
| 469 rtc::SSLStreamAdapter::GetDefaultSslCipher(ssl_expected_version_)); | 469 ssl_expected_version_, rtc::KT_DEFAULT)); |
| 470 | 470 |
| 471 return true; | 471 return true; |
| 472 } | 472 } |
| 473 | 473 |
| 474 bool Connect() { | 474 bool Connect() { |
| 475 // By default, Client1 will be Server and Client2 will be Client. | 475 // By default, Client1 will be Server and Client2 will be Client. |
| 476 return Connect(cricket::CONNECTIONROLE_ACTPASS, | 476 return Connect(cricket::CONNECTIONROLE_ACTPASS, |
| 477 cricket::CONNECTIONROLE_ACTIVE); | 477 cricket::CONNECTIONROLE_ACTIVE); |
| 478 } | 478 } |
| 479 | 479 |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 864 // Each side's remote certificate is the other side's local certificate. | 864 // Each side's remote certificate is the other side's local certificate. |
| 865 ASSERT_TRUE( | 865 ASSERT_TRUE( |
| 866 client1_.transport()->GetRemoteSSLCertificate(remote_cert1.accept())); | 866 client1_.transport()->GetRemoteSSLCertificate(remote_cert1.accept())); |
| 867 ASSERT_EQ(remote_cert1->ToPEMString(), | 867 ASSERT_EQ(remote_cert1->ToPEMString(), |
| 868 certificate2->ssl_certificate().ToPEMString()); | 868 certificate2->ssl_certificate().ToPEMString()); |
| 869 ASSERT_TRUE( | 869 ASSERT_TRUE( |
| 870 client2_.transport()->GetRemoteSSLCertificate(remote_cert2.accept())); | 870 client2_.transport()->GetRemoteSSLCertificate(remote_cert2.accept())); |
| 871 ASSERT_EQ(remote_cert2->ToPEMString(), | 871 ASSERT_EQ(remote_cert2->ToPEMString(), |
| 872 certificate1->ssl_certificate().ToPEMString()); | 872 certificate1->ssl_certificate().ToPEMString()); |
| 873 } | 873 } |
| OLD | NEW |