OLD | NEW |
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ | 1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 /* vim: set ts=2 et sw=2 tw=80: */ | 2 /* vim: set ts=2 et sw=2 tw=80: */ |
3 /* This Source Code Form is subject to the terms of the Mozilla Public | 3 /* This Source Code Form is subject to the terms of the Mozilla Public |
4 * License, v. 2.0. If a copy of the MPL was not distributed with this file, | 4 * License, v. 2.0. If a copy of the MPL was not distributed with this file, |
5 * You can obtain one at http://mozilla.org/MPL/2.0/. */ | 5 * You can obtain one at http://mozilla.org/MPL/2.0/. */ |
6 | 6 |
7 #include "ssl.h" | 7 #include "ssl.h" |
8 #include "sslerr.h" | 8 #include "sslerr.h" |
9 #include "sslproto.h" | 9 #include "sslproto.h" |
10 #include <memory> | 10 #include <memory> |
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 EXPECT_FALSE((dhe1.public_key_.len() == dhe2.public_key_.len()) && | 478 EXPECT_FALSE((dhe1.public_key_.len() == dhe2.public_key_.len()) && |
479 (!memcmp(dhe1.public_key_.data(), dhe2.public_key_.data(), | 479 (!memcmp(dhe1.public_key_.data(), dhe2.public_key_.data(), |
480 dhe1.public_key_.len()))); | 480 dhe1.public_key_.len()))); |
481 } | 481 } |
482 | 482 |
483 TEST_P(TlsConnectGeneric, ConnectSendReceive) { | 483 TEST_P(TlsConnectGeneric, ConnectSendReceive) { |
484 Connect(); | 484 Connect(); |
485 SendReceive(); | 485 SendReceive(); |
486 } | 486 } |
487 | 487 |
| 488 TEST_P(TlsConnectTls12, ConnectSendReceiveChaCha20Poly1305) { |
| 489 // Disable all ciphers. |
| 490 client_->DisableCiphersByKeyExchange(ssl_kea_rsa); |
| 491 client_->DisableCiphersByKeyExchange(ssl_kea_dh); |
| 492 client_->DisableCiphersByKeyExchange(ssl_kea_ecdh); |
| 493 |
| 494 // Re-enable ChaCha20/Poly1305. |
| 495 SECStatus rv = SSL_CipherPrefSet(client_->ssl_fd(), |
| 496 TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305, |
| 497 PR_TRUE); |
| 498 EXPECT_EQ(SECSuccess, rv); |
| 499 |
| 500 Connect(); |
| 501 SendReceive(); |
| 502 } |
| 503 |
488 // The next two tests takes advantage of the fact that we | 504 // The next two tests takes advantage of the fact that we |
489 // automatically read the first 1024 bytes, so if | 505 // automatically read the first 1024 bytes, so if |
490 // we provide 1200 bytes, they overrun the read buffer | 506 // we provide 1200 bytes, they overrun the read buffer |
491 // provided by the calling test. | 507 // provided by the calling test. |
492 | 508 |
493 // DTLS should return an error. | 509 // DTLS should return an error. |
494 TEST_P(TlsConnectDatagram, ShortRead) { | 510 TEST_P(TlsConnectDatagram, ShortRead) { |
495 Connect(); | 511 Connect(); |
496 client_->SetExpectedReadError(true); | 512 client_->SetExpectedReadError(true); |
497 server_->SendData(1200, 1200); | 513 server_->SendData(1200, 1200); |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
660 INSTANTIATE_TEST_CASE_P(Pre12All, TlsConnectPre12, | 676 INSTANTIATE_TEST_CASE_P(Pre12All, TlsConnectPre12, |
661 ::testing::Combine( | 677 ::testing::Combine( |
662 TlsConnectTestBase::kTlsModesAll, | 678 TlsConnectTestBase::kTlsModesAll, |
663 TlsConnectTestBase::kTlsV11)); | 679 TlsConnectTestBase::kTlsV11)); |
664 INSTANTIATE_TEST_CASE_P(VersionsStream10, TlsConnectStream, | 680 INSTANTIATE_TEST_CASE_P(VersionsStream10, TlsConnectStream, |
665 TlsConnectTestBase::kTlsV10); | 681 TlsConnectTestBase::kTlsV10); |
666 INSTANTIATE_TEST_CASE_P(VersionsStream, TlsConnectStream, | 682 INSTANTIATE_TEST_CASE_P(VersionsStream, TlsConnectStream, |
667 TlsConnectTestBase::kTlsV11V12); | 683 TlsConnectTestBase::kTlsV11V12); |
668 | 684 |
669 } // namespace nspr_test | 685 } // namespace nspr_test |
OLD | NEW |