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

Side by Side Diff: net/quic/test_tools/crypto_test_utils_test.cc

Issue 2236973002: Landing Recent QUIC changes until 4AM, Aug 7, 2016 UTC-4 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: flip quic_sequencer_buffer_retire_block_in_time to true Created 4 years, 4 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/test_tools/crypto_test_utils.h" 5 #include "net/quic/test_tools/crypto_test_utils.h"
6 6
7 #include "net/quic/core/crypto/crypto_server_config_protobuf.h" 7 #include "net/quic/core/crypto/crypto_server_config_protobuf.h"
8 #include "net/quic/core/quic_utils.h" 8 #include "net/quic/core/quic_utils.h"
9 #include "net/quic/test_tools/mock_clock.h" 9 #include "net/quic/test_tools/mock_clock.h"
10 #include "net/test/gtest_util.h" 10 #include "net/test/gtest_util.h"
(...skipping 23 matching lines...) Expand all
34 // Verify that the output message is a SHLO. 34 // Verify that the output message is a SHLO.
35 void RunImpl(const CryptoHandshakeMessage& chlo, 35 void RunImpl(const CryptoHandshakeMessage& chlo,
36 const ValidateClientHelloResultCallback::Result& result, 36 const ValidateClientHelloResultCallback::Result& result,
37 std::unique_ptr<ProofSource::Details> /* details */) override { 37 std::unique_ptr<ProofSource::Details> /* details */) override {
38 QuicCryptoNegotiatedParameters params; 38 QuicCryptoNegotiatedParameters params;
39 string error_details; 39 string error_details;
40 DiversificationNonce diversification_nonce; 40 DiversificationNonce diversification_nonce;
41 CryptoHandshakeMessage out; 41 CryptoHandshakeMessage out;
42 crypto_config_->ProcessClientHello( 42 crypto_config_->ProcessClientHello(
43 result, /*reject_only=*/false, /*connection_id=*/1, server_ip_, 43 result, /*reject_only=*/false, /*connection_id=*/1, server_ip_,
44 client_addr_, QuicSupportedVersions().front(), QuicSupportedVersions(), 44 client_addr_, AllSupportedVersions().front(), AllSupportedVersions(),
45 /*use_stateless_rejects=*/true, /*server_designated_connection_id=*/0, 45 /*use_stateless_rejects=*/true, /*server_designated_connection_id=*/0,
46 clock_, QuicRandom::GetInstance(), compressed_certs_cache_, &params, 46 clock_, QuicRandom::GetInstance(), compressed_certs_cache_, &params,
47 proof_, &out, &diversification_nonce, &error_details); 47 proof_, /*total_framing_overhead=*/50, kDefaultMaxPacketSize, &out,
48 &diversification_nonce, &error_details);
48 // Verify output is a SHLO. 49 // Verify output is a SHLO.
49 EXPECT_EQ(out.tag(), kSHLO) << "Fail to pass validation. Get " 50 EXPECT_EQ(out.tag(), kSHLO) << "Fail to pass validation. Get "
50 << out.DebugString(); 51 << out.DebugString();
51 } 52 }
52 53
53 protected: 54 protected:
54 QuicCryptoServerConfig* crypto_config_; 55 QuicCryptoServerConfig* crypto_config_;
55 IPAddress server_ip_; 56 IPAddress server_ip_;
56 IPEndPoint client_addr_; 57 IPEndPoint client_addr_;
57 const QuicClock* clock_; 58 const QuicClock* clock_;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 StringPiece(reinterpret_cast<const char*>(orbit.data()), 91 StringPiece(reinterpret_cast<const char*>(orbit.data()),
91 sizeof(orbit.size())), 92 sizeof(orbit.size())),
92 &nonce); 93 &nonce);
93 string nonce_hex = "#" + QuicUtils::HexEncode(nonce); 94 string nonce_hex = "#" + QuicUtils::HexEncode(nonce);
94 95
95 char public_value[32]; 96 char public_value[32];
96 memset(public_value, 42, sizeof(public_value)); 97 memset(public_value, 42, sizeof(public_value));
97 string pub_hex = 98 string pub_hex =
98 "#" + QuicUtils::HexEncode(public_value, sizeof(public_value)); 99 "#" + QuicUtils::HexEncode(public_value, sizeof(public_value));
99 100
100 QuicVersion version(QuicSupportedVersions().front()); 101 QuicVersion version(AllSupportedVersions().front());
101 // clang-format off 102 // clang-format off
102 CryptoHandshakeMessage inchoate_chlo = CryptoTestUtils::Message( 103 CryptoHandshakeMessage inchoate_chlo = CryptoTestUtils::Message(
103 "CHLO", 104 "CHLO",
104 "PDMD", "X509", 105 "PDMD", "X509",
105 "AEAD", "AESG", 106 "AEAD", "AESG",
106 "KEXS", "C255", 107 "KEXS", "C255",
107 "COPT", "SREJ", 108 "COPT", "SREJ",
108 "PUBS", pub_hex.c_str(), 109 "PUBS", pub_hex.c_str(),
109 "NONC", nonce_hex.c_str(), 110 "NONC", nonce_hex.c_str(),
110 "VER\0", QuicUtils::TagToString(QuicVersionToQuicTag(version)).c_str(), 111 "VER\0", QuicUtils::TagToString(QuicVersionToQuicTag(version)).c_str(),
111 "$padding", static_cast<int>(kClientHelloMinimumSize), 112 "$padding", static_cast<int>(kClientHelloMinimumSize),
112 nullptr); 113 nullptr);
113 // clang-format on 114 // clang-format on
114 115
115 CryptoTestUtils::GenerateFullCHLO(inchoate_chlo, &crypto_config, server_ip, 116 CryptoTestUtils::GenerateFullCHLO(inchoate_chlo, &crypto_config, server_ip,
116 client_addr, version, &clock, &proof, 117 client_addr, version, &clock, &proof,
117 &compressed_certs_cache, &full_chlo); 118 &compressed_certs_cache, &full_chlo);
118 // Verify that full_chlo can pass crypto_config's verification. 119 // Verify that full_chlo can pass crypto_config's verification.
119 crypto_config.ValidateClientHello( 120 crypto_config.ValidateClientHello(
120 full_chlo, client_addr.address(), server_ip, version, &clock, &proof, 121 full_chlo, client_addr.address(), server_ip, version, &clock, &proof,
121 new ShloVerifier(&crypto_config, server_ip, client_addr, &clock, &proof, 122 new ShloVerifier(&crypto_config, server_ip, client_addr, &clock, &proof,
122 &compressed_certs_cache)); 123 &compressed_certs_cache));
123 } 124 }
124 125
125 } // namespace test 126 } // namespace test
126 } // namespace net 127 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/test_tools/crypto_test_utils.cc ('k') | net/quic/test_tools/quic_buffered_packet_store_peer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698