Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(272)

Side by Side Diff: net/quic/crypto/quic_crypto_client_config_test.cc

Issue 209413005: Move Window's specific logic for disabling ECDSA from QuicCryptoyclientConfig (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/quic/crypto/quic_crypto_client_config.h" 5 #include "net/quic/crypto/quic_crypto_client_config.h"
6 6
7 #include "net/quic/crypto/proof_verifier.h" 7 #include "net/quic/crypto/proof_verifier.h"
8 #include "net/quic/quic_session_key.h" 8 #include "net/quic/quic_session_key.h"
9 #include "net/quic/test_tools/quic_test_utils.h" 9 #include "net/quic/test_tools/quic_test_utils.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 CryptoHandshakeMessage msg; 58 CryptoHandshakeMessage msg;
59 QuicSessionKey server_key("www.google.com", 80, false, kPrivacyModeDisabled); 59 QuicSessionKey server_key("www.google.com", 80, false, kPrivacyModeDisabled);
60 config.FillInchoateClientHello(server_key, QuicVersionMax(), &state, 60 config.FillInchoateClientHello(server_key, QuicVersionMax(), &state,
61 &params, &msg); 61 &params, &msg);
62 62
63 QuicTag cver; 63 QuicTag cver;
64 EXPECT_EQ(QUIC_NO_ERROR, msg.GetUint32(kVER, &cver)); 64 EXPECT_EQ(QUIC_NO_ERROR, msg.GetUint32(kVER, &cver));
65 EXPECT_EQ(QuicVersionToQuicTag(QuicVersionMax()), cver); 65 EXPECT_EQ(QuicVersionToQuicTag(QuicVersionMax()), cver);
66 } 66 }
67 67
68 TEST(QuicCryptoClientConfigTest, InchoateChloSecure) {
69 QuicCryptoClientConfig::CachedState state;
70 QuicCryptoClientConfig config;
71 QuicCryptoNegotiatedParameters params;
72 CryptoHandshakeMessage msg;
73 QuicSessionKey server_key("www.google.com", 443, true, kPrivacyModeDisabled);
74 config.FillInchoateClientHello(server_key, QuicVersionMax(), &state,
75 &params, &msg);
76
77 QuicTag pdmd;
78 EXPECT_EQ(QUIC_NO_ERROR, msg.GetUint32(kPDMD, &pdmd));
79 EXPECT_EQ(kX509, pdmd);
80 }
81
82 TEST(QuicCryptoClientConfigTest, InchoateChloSecureNoEcdsa) {
83 QuicCryptoClientConfig::CachedState state;
84 QuicCryptoClientConfig config;
85 config.DisableEcdsa();
86 QuicCryptoNegotiatedParameters params;
87 CryptoHandshakeMessage msg;
88 QuicSessionKey server_key("www.google.com", 443, true, kPrivacyModeDisabled);
89 config.FillInchoateClientHello(server_key, QuicVersionMax(), &state,
90 &params, &msg);
91
92 QuicTag pdmd;
93 EXPECT_EQ(QUIC_NO_ERROR, msg.GetUint32(kPDMD, &pdmd));
94 EXPECT_EQ(kX59R, pdmd);
95 }
96
68 TEST(QuicCryptoClientConfigTest, ProcessServerDowngradeAttack) { 97 TEST(QuicCryptoClientConfigTest, ProcessServerDowngradeAttack) {
69 QuicVersionVector supported_versions = QuicSupportedVersions(); 98 QuicVersionVector supported_versions = QuicSupportedVersions();
70 if (supported_versions.size() == 1) { 99 if (supported_versions.size() == 1) {
71 // No downgrade attack is possible if the client only supports one version. 100 // No downgrade attack is possible if the client only supports one version.
72 return; 101 return;
73 } 102 }
74 QuicTagVector supported_version_tags; 103 QuicTagVector supported_version_tags;
75 for (size_t i = supported_versions.size(); i > 0; --i) { 104 for (size_t i = supported_versions.size(); i > 0; --i) {
76 supported_version_tags.push_back( 105 supported_version_tags.push_back(
77 QuicVersionToQuicTag(supported_versions[i - 1])); 106 QuicVersionToQuicTag(supported_versions[i - 1]));
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 // TODO(rch): Populate other fields of |state|. 178 // TODO(rch): Populate other fields of |state|.
150 state->set_source_address_token("TOKEN"); 179 state->set_source_address_token("TOKEN");
151 180
152 // Do not set the proof as valid, and check that it is not used 181 // Do not set the proof as valid, and check that it is not used
153 // as a canonical entry. 182 // as a canonical entry.
154 EXPECT_TRUE(config.LookupOrCreate(canonical_key2)->IsEmpty()); 183 EXPECT_TRUE(config.LookupOrCreate(canonical_key2)->IsEmpty());
155 } 184 }
156 185
157 } // namespace test 186 } // namespace test
158 } // namespace net 187 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698