OLD | NEW |
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/crypto/common_cert_set.h" | 7 #include "net/quic/crypto/common_cert_set.h" |
8 #include "net/quic/crypto/crypto_handshake.h" | 8 #include "net/quic/crypto/crypto_handshake.h" |
9 #include "net/quic/crypto/crypto_server_config.h" | 9 #include "net/quic/crypto/crypto_server_config.h" |
10 #include "net/quic/crypto/quic_decrypter.h" | 10 #include "net/quic/crypto/quic_decrypter.h" |
11 #include "net/quic/crypto/quic_encrypter.h" | 11 #include "net/quic/crypto/quic_encrypter.h" |
12 #include "net/quic/crypto/quic_random.h" | 12 #include "net/quic/crypto/quic_random.h" |
13 #include "net/quic/quic_clock.h" | 13 #include "net/quic/quic_clock.h" |
14 #include "net/quic/quic_crypto_client_stream.h" | 14 #include "net/quic/quic_crypto_client_stream.h" |
15 #include "net/quic/quic_crypto_server_stream.h" | 15 #include "net/quic/quic_crypto_server_stream.h" |
16 #include "net/quic/quic_crypto_stream.h" | 16 #include "net/quic/quic_crypto_stream.h" |
| 17 #include "net/quic/test_tools/quic_connection_peer.h" |
17 #include "net/quic/test_tools/quic_test_utils.h" | 18 #include "net/quic/test_tools/quic_test_utils.h" |
18 #include "net/quic/test_tools/simple_quic_framer.h" | 19 #include "net/quic/test_tools/simple_quic_framer.h" |
19 | 20 |
20 using base::StringPiece; | 21 using base::StringPiece; |
21 using std::string; | 22 using std::string; |
22 using std::vector; | 23 using std::vector; |
23 | 24 |
24 namespace net { | 25 namespace net { |
25 namespace test { | 26 namespace test { |
26 | 27 |
27 namespace { | 28 namespace { |
28 | 29 |
29 class TestSession : public QuicSession { | |
30 public: | |
31 TestSession(QuicConnection* connection, bool is_server) | |
32 : QuicSession(connection, is_server) { | |
33 } | |
34 | |
35 MOCK_METHOD1(CreateIncomingReliableStream, | |
36 ReliableQuicStream*(QuicStreamId id)); | |
37 MOCK_METHOD0(GetCryptoStream, QuicCryptoStream*()); | |
38 MOCK_METHOD0(CreateOutgoingReliableStream, ReliableQuicStream*()); | |
39 }; | |
40 | |
41 // CryptoFramerVisitor is a framer visitor that records handshake messages. | 30 // CryptoFramerVisitor is a framer visitor that records handshake messages. |
42 class CryptoFramerVisitor : public CryptoFramerVisitorInterface { | 31 class CryptoFramerVisitor : public CryptoFramerVisitorInterface { |
43 public: | 32 public: |
44 CryptoFramerVisitor() | 33 CryptoFramerVisitor() |
45 : error_(false) { | 34 : error_(false) { |
46 } | 35 } |
47 | 36 |
48 virtual void OnError(CryptoFramer* framer) OVERRIDE { | 37 virtual void OnError(CryptoFramer* framer) OVERRIDE { |
49 error_ = true; | 38 error_ = true; |
50 } | 39 } |
(...skipping 15 matching lines...) Expand all Loading... |
66 bool error_; | 55 bool error_; |
67 vector<CryptoHandshakeMessage> messages_; | 56 vector<CryptoHandshakeMessage> messages_; |
68 }; | 57 }; |
69 | 58 |
70 // MovePackets parses crypto handshake messages from packet number | 59 // MovePackets parses crypto handshake messages from packet number |
71 // |*inout_packet_index| through to the last packet and has |dest_stream| | 60 // |*inout_packet_index| through to the last packet and has |dest_stream| |
72 // process them. |*inout_packet_index| is updated with an index one greater | 61 // process them. |*inout_packet_index| is updated with an index one greater |
73 // than the last packet processed. | 62 // than the last packet processed. |
74 void MovePackets(PacketSavingConnection* source_conn, | 63 void MovePackets(PacketSavingConnection* source_conn, |
75 size_t *inout_packet_index, | 64 size_t *inout_packet_index, |
76 QuicCryptoStream* dest_stream) { | 65 QuicCryptoStream* dest_stream, |
| 66 PacketSavingConnection* dest_conn) { |
77 SimpleQuicFramer framer; | 67 SimpleQuicFramer framer; |
78 CryptoFramer crypto_framer; | 68 CryptoFramer crypto_framer; |
79 CryptoFramerVisitor crypto_visitor; | 69 CryptoFramerVisitor crypto_visitor; |
80 | 70 |
| 71 // In order to properly test the code we need to perform encryption and |
| 72 // decryption so that the crypters latch when expected. The crypters are in |
| 73 // |dest_conn|, but we don't want to try and use them there. Instead we swap |
| 74 // them into |framer|, perform the decryption with them, and then swap them |
| 75 // back. |
| 76 QuicConnectionPeer::SwapCrypters(dest_conn, framer.framer()); |
| 77 |
81 crypto_framer.set_visitor(&crypto_visitor); | 78 crypto_framer.set_visitor(&crypto_visitor); |
82 | 79 |
83 size_t index = *inout_packet_index; | 80 size_t index = *inout_packet_index; |
84 for (; index < source_conn->packets_.size(); index++) { | 81 for (; index < source_conn->encrypted_packets_.size(); index++) { |
85 ASSERT_TRUE(framer.ProcessPacket(*source_conn->packets_[index])); | 82 ASSERT_TRUE(framer.ProcessPacket(*source_conn->encrypted_packets_[index])); |
86 for (vector<QuicStreamFrame>::const_iterator | 83 for (vector<QuicStreamFrame>::const_iterator |
87 i = framer.stream_frames().begin(); | 84 i = framer.stream_frames().begin(); |
88 i != framer.stream_frames().end(); ++i) { | 85 i != framer.stream_frames().end(); ++i) { |
89 ASSERT_TRUE(crypto_framer.ProcessInput(i->data)); | 86 ASSERT_TRUE(crypto_framer.ProcessInput(i->data)); |
90 ASSERT_FALSE(crypto_visitor.error()); | 87 ASSERT_FALSE(crypto_visitor.error()); |
91 } | 88 } |
92 } | 89 } |
93 *inout_packet_index = index; | 90 *inout_packet_index = index; |
94 | 91 |
| 92 QuicConnectionPeer::SwapCrypters(dest_conn, framer.framer()); |
| 93 |
95 ASSERT_EQ(0u, crypto_framer.InputBytesRemaining()); | 94 ASSERT_EQ(0u, crypto_framer.InputBytesRemaining()); |
96 | 95 |
97 for (vector<CryptoHandshakeMessage>::const_iterator | 96 for (vector<CryptoHandshakeMessage>::const_iterator |
98 i = crypto_visitor.messages().begin(); | 97 i = crypto_visitor.messages().begin(); |
99 i != crypto_visitor.messages().end(); ++i) { | 98 i != crypto_visitor.messages().end(); ++i) { |
100 dest_stream->OnHandshakeMessage(*i); | 99 dest_stream->OnHandshakeMessage(*i); |
101 } | 100 } |
102 } | 101 } |
103 | 102 |
104 } // anonymous namespace | 103 } // anonymous namespace |
105 | 104 |
106 // static | 105 // static |
107 void CryptoTestUtils::CommunicateHandshakeMessages( | 106 void CryptoTestUtils::CommunicateHandshakeMessages( |
108 PacketSavingConnection* a_conn, | 107 PacketSavingConnection* a_conn, |
109 QuicCryptoStream* a, | 108 QuicCryptoStream* a, |
110 PacketSavingConnection* b_conn, | 109 PacketSavingConnection* b_conn, |
111 QuicCryptoStream* b) { | 110 QuicCryptoStream* b) { |
112 size_t a_i = 0, b_i = 0; | 111 size_t a_i = 0, b_i = 0; |
113 while (!a->handshake_confirmed()) { | 112 while (!a->handshake_confirmed()) { |
114 ASSERT_GT(a_conn->packets_.size(), a_i); | 113 ASSERT_GT(a_conn->packets_.size(), a_i); |
115 LOG(INFO) << "Processing " << a_conn->packets_.size() - a_i | 114 LOG(INFO) << "Processing " << a_conn->packets_.size() - a_i |
116 << " packets a->b"; | 115 << " packets a->b"; |
117 MovePackets(a_conn, &a_i, b); | 116 MovePackets(a_conn, &a_i, b, b_conn); |
118 | 117 |
119 ASSERT_GT(b_conn->packets_.size(), b_i); | 118 ASSERT_GT(b_conn->packets_.size(), b_i); |
120 LOG(INFO) << "Processing " << b_conn->packets_.size() - b_i | 119 LOG(INFO) << "Processing " << b_conn->packets_.size() - b_i |
121 << " packets b->a"; | 120 << " packets b->a"; |
122 if (b_conn->packets_.size() - b_i == 2) { | 121 if (b_conn->packets_.size() - b_i == 2) { |
123 LOG(INFO) << "here"; | 122 LOG(INFO) << "here"; |
124 } | 123 } |
125 MovePackets(b_conn, &b_i, a); | 124 MovePackets(b_conn, &b_i, a, a_conn); |
126 } | 125 } |
127 } | 126 } |
128 | 127 |
129 // static | 128 // static |
130 int CryptoTestUtils::HandshakeWithFakeServer( | 129 int CryptoTestUtils::HandshakeWithFakeServer( |
131 PacketSavingConnection* client_conn, | 130 PacketSavingConnection* client_conn, |
132 QuicCryptoClientStream* client) { | 131 QuicCryptoClientStream* client) { |
133 QuicGuid guid(1); | 132 QuicGuid guid(1); |
134 IPAddressNumber ip; | 133 IPAddressNumber ip; |
135 CHECK(ParseIPLiteralToNumber("192.0.2.33", &ip)); | 134 CHECK(ParseIPLiteralToNumber("192.0.2.33", &ip)); |
136 IPEndPoint addr = IPEndPoint(ip, 1); | 135 IPEndPoint addr = IPEndPoint(ip, 1); |
137 PacketSavingConnection* server_conn = | 136 PacketSavingConnection* server_conn = |
138 new PacketSavingConnection(guid, addr, true); | 137 new PacketSavingConnection(guid, addr, true); |
139 TestSession server_session(server_conn, true); | 138 TestSession server_session(server_conn, true); |
140 | 139 |
141 QuicConfig config; | 140 QuicConfig config; |
142 QuicCryptoServerConfig crypto_config(QuicCryptoServerConfig::TESTING); | 141 QuicCryptoServerConfig crypto_config(QuicCryptoServerConfig::TESTING); |
143 SetupCryptoServerConfigForTest( | 142 SetupCryptoServerConfigForTest( |
144 server_session.connection()->clock(), | 143 server_session.connection()->clock(), |
145 server_session.connection()->random_generator(), | 144 server_session.connection()->random_generator(), |
146 &config, &crypto_config); | 145 &config, &crypto_config); |
147 | 146 |
148 QuicCryptoServerStream server(config, crypto_config, &server_session); | 147 QuicCryptoServerStream server(config, crypto_config, &server_session); |
| 148 server_session.SetCryptoStream(&server); |
149 | 149 |
150 // The client's handshake must have been started already. | 150 // The client's handshake must have been started already. |
151 CHECK_NE(0u, client_conn->packets_.size()); | 151 CHECK_NE(0u, client_conn->packets_.size()); |
152 | 152 |
153 CommunicateHandshakeMessages(client_conn, client, server_conn, &server); | 153 CommunicateHandshakeMessages(client_conn, client, server_conn, &server); |
154 | 154 |
155 CompareClientAndServerKeys(client, &server); | 155 CompareClientAndServerKeys(client, &server); |
156 | 156 |
157 return client->num_sent_client_hellos(); | 157 return client->num_sent_client_hellos(); |
158 } | 158 } |
(...skipping 11 matching lines...) Expand all Loading... |
170 TestSession client_session(client_conn, true); | 170 TestSession client_session(client_conn, true); |
171 QuicConfig config; | 171 QuicConfig config; |
172 QuicCryptoClientConfig crypto_config; | 172 QuicCryptoClientConfig crypto_config; |
173 | 173 |
174 config.SetDefaults(); | 174 config.SetDefaults(); |
175 crypto_config.SetDefaults(); | 175 crypto_config.SetDefaults(); |
176 // TODO(rtenneti): Enable testing of ProofVerifier. | 176 // TODO(rtenneti): Enable testing of ProofVerifier. |
177 // crypto_config.SetProofVerifier(ProofVerifierForTesting()); | 177 // crypto_config.SetProofVerifier(ProofVerifierForTesting()); |
178 QuicCryptoClientStream client("test.example.com", config, &client_session, | 178 QuicCryptoClientStream client("test.example.com", config, &client_session, |
179 &crypto_config); | 179 &crypto_config); |
| 180 client_session.SetCryptoStream(&client); |
180 | 181 |
181 CHECK(client.CryptoConnect()); | 182 CHECK(client.CryptoConnect()); |
182 CHECK_EQ(1u, client_conn->packets_.size()); | 183 CHECK_EQ(1u, client_conn->packets_.size()); |
183 | 184 |
184 CommunicateHandshakeMessages(client_conn, &client, server_conn, server); | 185 CommunicateHandshakeMessages(client_conn, &client, server_conn, server); |
185 | 186 |
186 CompareClientAndServerKeys(&client, server); | 187 CompareClientAndServerKeys(&client, server); |
187 | 188 |
188 return client.num_sent_client_hellos(); | 189 return client.num_sent_client_hellos(); |
189 } | 190 } |
190 | 191 |
191 // static | 192 // static |
192 void CryptoTestUtils::SetupCryptoServerConfigForTest( | 193 void CryptoTestUtils::SetupCryptoServerConfigForTest( |
193 const QuicClock* clock, | 194 const QuicClock* clock, |
194 QuicRandom* rand, | 195 QuicRandom* rand, |
195 QuicConfig* config, | 196 QuicConfig* config, |
196 QuicCryptoServerConfig* crypto_config) { | 197 QuicCryptoServerConfig* crypto_config) { |
197 config->SetDefaults(); | 198 config->SetDefaults(); |
198 CryptoHandshakeMessage extra_tags; | 199 CryptoHandshakeMessage extra_tags; |
199 config->ToHandshakeMessage(&extra_tags); | 200 config->ToHandshakeMessage(&extra_tags); |
200 | 201 |
201 scoped_ptr<CryptoHandshakeMessage> scfg( | 202 scoped_ptr<CryptoHandshakeMessage> scfg( |
202 crypto_config->AddDefaultConfig(rand, clock, extra_tags)); | 203 crypto_config->AddDefaultConfig( |
| 204 rand, clock, extra_tags, QuicCryptoServerConfig::kDefaultExpiry)); |
203 if (!config->SetFromHandshakeMessage(*scfg)) { | 205 if (!config->SetFromHandshakeMessage(*scfg)) { |
204 CHECK(false) << "Crypto config could not be parsed by QuicConfig."; | 206 CHECK(false) << "Crypto config could not be parsed by QuicConfig."; |
205 } | 207 } |
206 } | 208 } |
207 | 209 |
208 // static | 210 // static |
209 string CryptoTestUtils::GetValueForTag(const CryptoHandshakeMessage& message, | 211 string CryptoTestUtils::GetValueForTag(const CryptoHandshakeMessage& message, |
210 CryptoTag tag) { | 212 QuicTag tag) { |
211 CryptoTagValueMap::const_iterator it = message.tag_value_map().find(tag); | 213 QuicTagValueMap::const_iterator it = message.tag_value_map().find(tag); |
212 if (it == message.tag_value_map().end()) { | 214 if (it == message.tag_value_map().end()) { |
213 return string(); | 215 return string(); |
214 } | 216 } |
215 return it->second; | 217 return it->second; |
216 } | 218 } |
217 | 219 |
218 class MockCommonCertSet : public CommonCertSet { | 220 class MockCommonCertSets : public CommonCertSets { |
219 public: | 221 public: |
220 MockCommonCertSet(StringPiece cert, uint64 hash, uint32 index) | 222 MockCommonCertSets(StringPiece cert, uint64 hash, uint32 index) |
221 : cert_(cert.as_string()), | 223 : cert_(cert.as_string()), |
222 hash_(hash), | 224 hash_(hash), |
223 index_(index) { | 225 index_(index) { |
224 } | 226 } |
225 | 227 |
226 virtual StringPiece GetCommonHashes() OVERRIDE { | 228 virtual StringPiece GetCommonHashes() const OVERRIDE { |
227 CHECK(false) << "not implemented"; | 229 CHECK(false) << "not implemented"; |
228 return StringPiece(); | 230 return StringPiece(); |
229 } | 231 } |
230 | 232 |
231 virtual StringPiece GetCert(uint64 hash, uint32 index) OVERRIDE { | 233 virtual StringPiece GetCert(uint64 hash, uint32 index) const OVERRIDE { |
232 if (hash == hash_ && index == index_) { | 234 if (hash == hash_ && index == index_) { |
233 return cert_; | 235 return cert_; |
234 } | 236 } |
235 return StringPiece(); | 237 return StringPiece(); |
236 } | 238 } |
237 | 239 |
238 virtual bool MatchCert(StringPiece cert, | 240 virtual bool MatchCert(StringPiece cert, |
239 StringPiece common_set_hashes, | 241 StringPiece common_set_hashes, |
240 uint64* out_hash, | 242 uint64* out_hash, |
241 uint32* out_index) OVERRIDE { | 243 uint32* out_index) const OVERRIDE { |
242 if (cert != cert_) { | 244 if (cert != cert_) { |
243 return false; | 245 return false; |
244 } | 246 } |
245 | 247 |
246 if (common_set_hashes.size() % sizeof(uint64) != 0) { | 248 if (common_set_hashes.size() % sizeof(uint64) != 0) { |
247 return false; | 249 return false; |
248 } | 250 } |
249 bool client_has_set = false; | 251 bool client_has_set = false; |
250 for (size_t i = 0; i < common_set_hashes.size(); i += sizeof(uint64)) { | 252 for (size_t i = 0; i < common_set_hashes.size(); i += sizeof(uint64)) { |
251 uint64 hash; | 253 uint64 hash; |
(...skipping 12 matching lines...) Expand all Loading... |
264 *out_index = index_; | 266 *out_index = index_; |
265 return true; | 267 return true; |
266 } | 268 } |
267 | 269 |
268 private: | 270 private: |
269 const string cert_; | 271 const string cert_; |
270 const uint64 hash_; | 272 const uint64 hash_; |
271 const uint32 index_; | 273 const uint32 index_; |
272 }; | 274 }; |
273 | 275 |
274 CommonCertSet* CryptoTestUtils::MockCommonCertSet(StringPiece cert, | 276 CommonCertSets* CryptoTestUtils::MockCommonCertSets(StringPiece cert, |
275 uint64 hash, | 277 uint64 hash, |
276 uint32 index) { | 278 uint32 index) { |
277 return new class MockCommonCertSet(cert, hash, index); | 279 return new class MockCommonCertSets(cert, hash, index); |
278 } | 280 } |
279 | 281 |
280 void CryptoTestUtils::CompareClientAndServerKeys( | 282 void CryptoTestUtils::CompareClientAndServerKeys( |
281 QuicCryptoClientStream* client, | 283 QuicCryptoClientStream* client, |
282 QuicCryptoServerStream* server) { | 284 QuicCryptoServerStream* server) { |
283 const QuicEncrypter* client_encrypter( | 285 const QuicEncrypter* client_encrypter( |
284 client->session()->connection()->encrypter(ENCRYPTION_INITIAL)); | 286 client->session()->connection()->encrypter(ENCRYPTION_INITIAL)); |
285 // Normally we would expect the client's INITIAL decrypter to have latched | |
286 // from the receipt of the server hello. However, when using a | |
287 // PacketSavingConnection (at the tests do) we don't actually encrypt with | |
288 // the correct encrypter. | |
289 // TODO(agl): make the tests more realistic. | |
290 const QuicDecrypter* client_decrypter( | 287 const QuicDecrypter* client_decrypter( |
| 288 client->session()->connection()->decrypter()); |
| 289 const QuicEncrypter* client_forward_secure_encrypter( |
| 290 client->session()->connection()->encrypter(ENCRYPTION_FORWARD_SECURE)); |
| 291 const QuicDecrypter* client_forward_secure_decrypter( |
291 client->session()->connection()->alternative_decrypter()); | 292 client->session()->connection()->alternative_decrypter()); |
292 const QuicEncrypter* server_encrypter( | 293 const QuicEncrypter* server_encrypter( |
293 server->session()->connection()->encrypter(ENCRYPTION_INITIAL)); | 294 server->session()->connection()->encrypter(ENCRYPTION_INITIAL)); |
294 const QuicDecrypter* server_decrypter( | 295 const QuicDecrypter* server_decrypter( |
295 server->session()->connection()->decrypter()); | 296 server->session()->connection()->decrypter()); |
| 297 const QuicEncrypter* server_forward_secure_encrypter( |
| 298 server->session()->connection()->encrypter(ENCRYPTION_FORWARD_SECURE)); |
| 299 const QuicDecrypter* server_forward_secure_decrypter( |
| 300 server->session()->connection()->alternative_decrypter()); |
296 | 301 |
297 StringPiece client_encrypter_key = client_encrypter->GetKey(); | 302 StringPiece client_encrypter_key = client_encrypter->GetKey(); |
298 StringPiece client_encrypter_iv = client_encrypter->GetNoncePrefix(); | 303 StringPiece client_encrypter_iv = client_encrypter->GetNoncePrefix(); |
299 StringPiece client_decrypter_key = client_decrypter->GetKey(); | 304 StringPiece client_decrypter_key = client_decrypter->GetKey(); |
300 StringPiece client_decrypter_iv = client_decrypter->GetNoncePrefix(); | 305 StringPiece client_decrypter_iv = client_decrypter->GetNoncePrefix(); |
| 306 StringPiece client_forward_secure_encrypter_key = |
| 307 client_forward_secure_encrypter->GetKey(); |
| 308 StringPiece client_forward_secure_encrypter_iv = |
| 309 client_forward_secure_encrypter->GetNoncePrefix(); |
| 310 StringPiece client_forward_secure_decrypter_key = |
| 311 client_forward_secure_decrypter->GetKey(); |
| 312 StringPiece client_forward_secure_decrypter_iv = |
| 313 client_forward_secure_decrypter->GetNoncePrefix(); |
301 StringPiece server_encrypter_key = server_encrypter->GetKey(); | 314 StringPiece server_encrypter_key = server_encrypter->GetKey(); |
302 StringPiece server_encrypter_iv = server_encrypter->GetNoncePrefix(); | 315 StringPiece server_encrypter_iv = server_encrypter->GetNoncePrefix(); |
303 StringPiece server_decrypter_key = server_decrypter->GetKey(); | 316 StringPiece server_decrypter_key = server_decrypter->GetKey(); |
304 StringPiece server_decrypter_iv = server_decrypter->GetNoncePrefix(); | 317 StringPiece server_decrypter_iv = server_decrypter->GetNoncePrefix(); |
| 318 StringPiece server_forward_secure_encrypter_key = |
| 319 server_forward_secure_encrypter->GetKey(); |
| 320 StringPiece server_forward_secure_encrypter_iv = |
| 321 server_forward_secure_encrypter->GetNoncePrefix(); |
| 322 StringPiece server_forward_secure_decrypter_key = |
| 323 server_forward_secure_decrypter->GetKey(); |
| 324 StringPiece server_forward_secure_decrypter_iv = |
| 325 server_forward_secure_decrypter->GetNoncePrefix(); |
305 | 326 |
306 CompareCharArraysWithHexError("client write key", | 327 CompareCharArraysWithHexError("client write key", |
307 client_encrypter_key.data(), | 328 client_encrypter_key.data(), |
308 client_encrypter_key.length(), | 329 client_encrypter_key.length(), |
309 server_decrypter_key.data(), | 330 server_decrypter_key.data(), |
310 server_decrypter_key.length()); | 331 server_decrypter_key.length()); |
311 CompareCharArraysWithHexError("client write IV", | 332 CompareCharArraysWithHexError("client write IV", |
312 client_encrypter_iv.data(), | 333 client_encrypter_iv.data(), |
313 client_encrypter_iv.length(), | 334 client_encrypter_iv.length(), |
314 server_decrypter_iv.data(), | 335 server_decrypter_iv.data(), |
315 server_decrypter_iv.length()); | 336 server_decrypter_iv.length()); |
316 CompareCharArraysWithHexError("server write key", | 337 CompareCharArraysWithHexError("server write key", |
317 server_encrypter_key.data(), | 338 server_encrypter_key.data(), |
318 server_encrypter_key.length(), | 339 server_encrypter_key.length(), |
319 client_decrypter_key.data(), | 340 client_decrypter_key.data(), |
320 client_decrypter_key.length()); | 341 client_decrypter_key.length()); |
321 CompareCharArraysWithHexError("server write IV", | 342 CompareCharArraysWithHexError("server write IV", |
322 server_encrypter_iv.data(), | 343 server_encrypter_iv.data(), |
323 server_encrypter_iv.length(), | 344 server_encrypter_iv.length(), |
324 client_decrypter_iv.data(), | 345 client_decrypter_iv.data(), |
325 client_decrypter_iv.length()); | 346 client_decrypter_iv.length()); |
| 347 CompareCharArraysWithHexError("client forward secure write key", |
| 348 client_forward_secure_encrypter_key.data(), |
| 349 client_forward_secure_encrypter_key.length(), |
| 350 server_forward_secure_decrypter_key.data(), |
| 351 server_forward_secure_decrypter_key.length()); |
| 352 CompareCharArraysWithHexError("client forward secure write IV", |
| 353 client_forward_secure_encrypter_iv.data(), |
| 354 client_forward_secure_encrypter_iv.length(), |
| 355 server_forward_secure_decrypter_iv.data(), |
| 356 server_forward_secure_decrypter_iv.length()); |
| 357 CompareCharArraysWithHexError("server forward secure write key", |
| 358 server_forward_secure_encrypter_key.data(), |
| 359 server_forward_secure_encrypter_key.length(), |
| 360 client_forward_secure_decrypter_key.data(), |
| 361 client_forward_secure_decrypter_key.length()); |
| 362 CompareCharArraysWithHexError("server forward secure write IV", |
| 363 server_forward_secure_encrypter_iv.data(), |
| 364 server_forward_secure_encrypter_iv.length(), |
| 365 client_forward_secure_decrypter_iv.data(), |
| 366 client_forward_secure_decrypter_iv.length()); |
326 } | 367 } |
327 } // namespace test | 368 } // namespace test |
328 } // namespace net | 369 } // namespace net |
OLD | NEW |