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

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: fix comments 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
« no previous file with comments | « net/quic/crypto/quic_crypto_client_config.cc ('k') | net/quic/quic_stream_factory.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 67
68 TEST(QuicCryptoClientConfigTest, PreferAesGcm) { 68 TEST(QuicCryptoClientConfigTest, PreferAesGcm) {
69 QuicCryptoClientConfig config; 69 QuicCryptoClientConfig config;
70 config.SetDefaults(); 70 config.SetDefaults();
71 if (config.aead.size() > 1) 71 if (config.aead.size() > 1)
72 EXPECT_NE(kAESG, config.aead[0]); 72 EXPECT_NE(kAESG, config.aead[0]);
73 config.PreferAesGcm(); 73 config.PreferAesGcm();
74 EXPECT_EQ(kAESG, config.aead[0]); 74 EXPECT_EQ(kAESG, config.aead[0]);
75 } 75 }
76 76
77 TEST(QuicCryptoClientConfigTest, InchoateChloSecure) {
78 QuicCryptoClientConfig::CachedState state;
79 QuicCryptoClientConfig config;
80 QuicCryptoNegotiatedParameters params;
81 CryptoHandshakeMessage msg;
82 QuicSessionKey server_key("www.google.com", 443, true, kPrivacyModeDisabled);
83 config.FillInchoateClientHello(server_key, QuicVersionMax(), &state,
84 &params, &msg);
85
86 QuicTag pdmd;
87 EXPECT_EQ(QUIC_NO_ERROR, msg.GetUint32(kPDMD, &pdmd));
88 EXPECT_EQ(kX509, pdmd);
89 }
90
91 TEST(QuicCryptoClientConfigTest, InchoateChloSecureNoEcdsa) {
92 QuicCryptoClientConfig::CachedState state;
93 QuicCryptoClientConfig config;
94 config.DisableEcdsa();
95 QuicCryptoNegotiatedParameters params;
96 CryptoHandshakeMessage msg;
97 QuicSessionKey server_key("www.google.com", 443, true, kPrivacyModeDisabled);
98 config.FillInchoateClientHello(server_key, QuicVersionMax(), &state,
99 &params, &msg);
100
101 QuicTag pdmd;
102 EXPECT_EQ(QUIC_NO_ERROR, msg.GetUint32(kPDMD, &pdmd));
103 EXPECT_EQ(kX59R, pdmd);
104 }
105
77 TEST(QuicCryptoClientConfigTest, ProcessServerDowngradeAttack) { 106 TEST(QuicCryptoClientConfigTest, ProcessServerDowngradeAttack) {
78 QuicVersionVector supported_versions = QuicSupportedVersions(); 107 QuicVersionVector supported_versions = QuicSupportedVersions();
79 if (supported_versions.size() == 1) { 108 if (supported_versions.size() == 1) {
80 // No downgrade attack is possible if the client only supports one version. 109 // No downgrade attack is possible if the client only supports one version.
81 return; 110 return;
82 } 111 }
83 QuicTagVector supported_version_tags; 112 QuicTagVector supported_version_tags;
84 for (size_t i = supported_versions.size(); i > 0; --i) { 113 for (size_t i = supported_versions.size(); i > 0; --i) {
85 supported_version_tags.push_back( 114 supported_version_tags.push_back(
86 QuicVersionToQuicTag(supported_versions[i - 1])); 115 QuicVersionToQuicTag(supported_versions[i - 1]));
(...skipping 27 matching lines...) Expand all
114 QuicCryptoClientConfig::CachedState* other = config.LookupOrCreate(other_key); 143 QuicCryptoClientConfig::CachedState* other = config.LookupOrCreate(other_key);
115 144
116 EXPECT_EQ(state->server_config(), other->server_config()); 145 EXPECT_EQ(state->server_config(), other->server_config());
117 EXPECT_EQ(state->source_address_token(), other->source_address_token()); 146 EXPECT_EQ(state->source_address_token(), other->source_address_token());
118 EXPECT_EQ(state->certs(), other->certs()); 147 EXPECT_EQ(state->certs(), other->certs());
119 EXPECT_EQ(1u, other->generation_counter()); 148 EXPECT_EQ(1u, other->generation_counter());
120 } 149 }
121 150
122 } // namespace test 151 } // namespace test
123 } // namespace net 152 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/crypto/quic_crypto_client_config.cc ('k') | net/quic/quic_stream_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698