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 #ifndef NET_QUIC_TEST_TOOLS_CRYPTO_TEST_UTILS_H_ | 5 #ifndef NET_QUIC_TEST_TOOLS_CRYPTO_TEST_UTILS_H_ |
6 #define NET_QUIC_TEST_TOOLS_CRYPTO_TEST_UTILS_H_ | 6 #define NET_QUIC_TEST_TOOLS_CRYPTO_TEST_UTILS_H_ |
7 | 7 |
8 #include <stdarg.h> | 8 #include <stdarg.h> |
9 #include <stddef.h> | 9 #include <stddef.h> |
10 #include <stdint.h> | 10 #include <stdint.h> |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 // MovePackets parses crypto handshake messages from packet number | 198 // MovePackets parses crypto handshake messages from packet number |
199 // |*inout_packet_index| through to the last packet (or until a packet fails | 199 // |*inout_packet_index| through to the last packet (or until a packet fails |
200 // to decrypt) and has |dest_stream| process them. |*inout_packet_index| is | 200 // to decrypt) and has |dest_stream| process them. |*inout_packet_index| is |
201 // updated with an index one greater than the last packet processed. | 201 // updated with an index one greater than the last packet processed. |
202 static void MovePackets(PacketSavingConnection* source_conn, | 202 static void MovePackets(PacketSavingConnection* source_conn, |
203 size_t* inout_packet_index, | 203 size_t* inout_packet_index, |
204 QuicCryptoStream* dest_stream, | 204 QuicCryptoStream* dest_stream, |
205 PacketSavingConnection* dest_conn, | 205 PacketSavingConnection* dest_conn, |
206 Perspective dest_perspective); | 206 Perspective dest_perspective); |
207 | 207 |
| 208 // Return an inchoate CHLO with some basic tag value std:pairs. |
| 209 static CryptoHandshakeMessage GenerateDefaultInchoateCHLO( |
| 210 const QuicClock* clock, |
| 211 QuicVersion version, |
| 212 QuicCryptoServerConfig* crypto_config); |
| 213 |
208 // Takes a inchoate CHLO, returns a full CHLO in |out| which can pass | 214 // Takes a inchoate CHLO, returns a full CHLO in |out| which can pass |
209 // |crypto_config|'s validation. | 215 // |crypto_config|'s validation. |
210 static void GenerateFullCHLO(const CryptoHandshakeMessage& inchoate_chlo, | 216 static void GenerateFullCHLO(const CryptoHandshakeMessage& inchoate_chlo, |
211 QuicCryptoServerConfig* crypto_config, | 217 QuicCryptoServerConfig* crypto_config, |
212 IPAddress server_ip, | 218 IPAddress server_ip, |
213 IPEndPoint client_addr, | 219 IPEndPoint client_addr, |
214 QuicVersion version, | 220 QuicVersion version, |
215 const QuicClock* clock, | 221 const QuicClock* clock, |
216 QuicCryptoProof* proof, | 222 QuicCryptoProof* proof, |
217 QuicCompressedCertsCache* compressed_certs_cache, | 223 QuicCompressedCertsCache* compressed_certs_cache, |
218 CryptoHandshakeMessage* out); | 224 CryptoHandshakeMessage* out); |
219 | 225 |
220 private: | 226 private: |
221 static void CompareClientAndServerKeys(QuicCryptoClientStream* client, | 227 static void CompareClientAndServerKeys(QuicCryptoClientStream* client, |
222 QuicCryptoServerStream* server); | 228 QuicCryptoServerStream* server); |
223 | 229 |
| 230 // Return a CHLO nonce in hexadecimal. |
| 231 static std::string GenerateClientNonceHex( |
| 232 const QuicClock* clock, |
| 233 QuicCryptoServerConfig* crypto_config); |
| 234 |
| 235 // Return a CHLO PUBS in hexadecimal. |
| 236 static std::string GenerateClientPublicValuesHex(); |
| 237 |
224 DISALLOW_COPY_AND_ASSIGN(CryptoTestUtils); | 238 DISALLOW_COPY_AND_ASSIGN(CryptoTestUtils); |
225 }; | 239 }; |
226 | 240 |
227 } // namespace test | 241 } // namespace test |
228 | 242 |
229 } // namespace net | 243 } // namespace net |
230 | 244 |
231 #endif // NET_QUIC_TEST_TOOLS_CRYPTO_TEST_UTILS_H_ | 245 #endif // NET_QUIC_TEST_TOOLS_CRYPTO_TEST_UTILS_H_ |
OLD | NEW |