summaryrefslogtreecommitdiffstats
path: root/net/quic/crypto/crypto_server_test.cc
diff options
context:
space:
mode:
authorrtenneti@chromium.org <rtenneti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-26 21:21:27 +0000
committerrtenneti@chromium.org <rtenneti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-26 21:21:27 +0000
commitd89f186e5e99a2ed42d951b3e4e4875d3d2f2b6e (patch)
tree7f8df5a797252e07d7085b05cb61d60f3c94cc9e /net/quic/crypto/crypto_server_test.cc
parented004b334f206052c4ada768cf3eb2f6aba0ff0d (diff)
downloadchromium_src-d89f186e5e99a2ed42d951b3e4e4875d3d2f2b6e.zip
chromium_src-d89f186e5e99a2ed42d951b3e4e4875d3d2f2b6e.tar.gz
chromium_src-d89f186e5e99a2ed42d951b3e4e4875d3d2f2b6e.tar.bz2
Land Recent QUIC Changes.
QUIC Refactor to move the call to OnPacketAbandoned() for retransmissions into QuicCongestionManager. Merge internal change: 57233749 https://codereview.chromium.org/85463010/ Rename two methods in SendAlgorithmInterface * OnIncomingAck -> OnPacketAcked * OnIncomingLoss -> OnPacketLost Merge internal change: 57120421 https://codereview.chromium.org/85663006/ Implement Early Retransmit(RFC5827) in QUIC's TCP congestion control. Merge internal change: 57097940 https://codereview.chromium.org/85663005/ De-flake internal end_to_end_tests when pacing is used. Adds a new HasQueuedData method, and removes NumWriteBlockedStreams method to QuicSession, which is only called from tests. Merge internal change: 57090300 https://codereview.chromium.org/84723005/ Send the server's supported QUIC versions in the SHLO. Send the client's supported QUIC version in the CHLO. Detect downgrade attacks. Add QUIC versions to the QUIC handshake messages. Merge internal change: 57057343 https://codereview.chromium.org/85773006/ Change QUIC's nack counting to be based on the gap between the missing packet and the largest observed, instead of the number of ack frames processed. Merge internal change: 57031841 https://codereview.chromium.org/85383010/ QUIC - sync'ing chromium and internal source. Minor clean up of the code. Merge internal change: 57264741 https://codereview.chromium.org/86483007/ R=rch@chromium.org Review URL: https://codereview.chromium.org/87013002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@237410 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/quic/crypto/crypto_server_test.cc')
-rw-r--r--net/quic/crypto/crypto_server_test.cc31
1 files changed, 29 insertions, 2 deletions
diff --git a/net/quic/crypto/crypto_server_test.cc b/net/quic/crypto/crypto_server_test.cc
index df28016..4eec2a8 100644
--- a/net/quic/crypto/crypto_server_test.cc
+++ b/net/quic/crypto/crypto_server_test.cc
@@ -7,6 +7,7 @@
#include "net/quic/crypto/crypto_utils.h"
#include "net/quic/crypto/quic_crypto_server_config.h"
#include "net/quic/crypto/quic_random.h"
+#include "net/quic/quic_utils.h"
#include "net/quic/test_tools/crypto_test_utils.h"
#include "net/quic/test_tools/delayed_verify_strike_register_client.h"
#include "net/quic/test_tools/mock_clock.h"
@@ -27,6 +28,7 @@ class CryptoServerTest : public ::testing::Test {
addr_(ParseIPLiteralToNumber("192.0.2.33", &ip_) ?
ip_ : IPAddressNumber(), 1) {
config_.SetProofSource(CryptoTestUtils::ProofSourceForTesting());
+ supported_versions_ = QuicSupportedVersions();
}
virtual void SetUp() {
@@ -136,8 +138,9 @@ class CryptoServerTest : public ::testing::Test {
const char* error_substr) {
string error_details;
QuicErrorCode error = config_.ProcessClientHello(
- result, 1 /* GUID */, addr_, &clock_,
- rand_, &params_, &out_, &error_details);
+ result, 1 /* GUID */, addr_,
+ supported_versions_.front(), supported_versions_, &clock_, rand_,
+ &params_, &out_, &error_details);
if (should_succeed) {
ASSERT_EQ(error, QUIC_NO_ERROR)
@@ -176,6 +179,7 @@ class CryptoServerTest : public ::testing::Test {
protected:
QuicRandom* const rand_;
MockClock clock_;
+ QuicVersionVector supported_versions_;
QuicCryptoServerConfig config_;
QuicCryptoServerConfig::ConfigOptions config_options_;
QuicCryptoNegotiatedParameters params_;
@@ -270,6 +274,22 @@ TEST_F(CryptoServerTest, BadClientNonce) {
}
}
+TEST_F(CryptoServerTest, DowngradeAttack) {
+ if (supported_versions_.size() == 1) {
+ // No downgrade attack is possible if the server only supports one version.
+ return;
+ }
+ // Set the client's preferred version to a supported version that
+ // is not the "current" version (supported_versions_.front()).
+ string client_version = QuicUtils::TagToString(
+ QuicVersionToQuicTag(supported_versions_.back()));
+
+ ShouldFailMentioning("Downgrade", InchoateClientHello(
+ "CHLO",
+ "VER\0", client_version.data(),
+ NULL));
+}
+
TEST_F(CryptoServerTest, ReplayProtection) {
// This tests that disabling replay protection works.
CryptoHandshakeMessage msg = CryptoTestUtils::Message(
@@ -296,6 +316,13 @@ TEST_F(CryptoServerTest, ReplayProtection) {
ShouldSucceed(msg);
// The message should accepted twice when replay protection is off.
ASSERT_EQ(kSHLO, out_.tag());
+ const QuicTag* versions;
+ size_t num_versions;
+ out_.GetTaglist(kVER, &versions, &num_versions);
+ ASSERT_EQ(QuicSupportedVersions().size(), num_versions);
+ for (size_t i = 0; i < num_versions; ++i) {
+ EXPECT_EQ(QuicVersionToQuicTag(QuicSupportedVersions()[i]), versions[i]);
+ }
}
TEST(CryptoServerConfigGenerationTest, Determinism) {