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

Side by Side Diff: net/quic/test_tools/crypto_test_utils.h

Issue 1904213002: QUIC: support diversified keys with version 33. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@hkdf
Patch Set: Rebase Created 4 years, 8 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
« no previous file with comments | « net/quic/reliable_quic_stream_test.cc ('k') | net/quic/test_tools/crypto_test_utils.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 (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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 103
104 // SetupCryptoServerConfigForTest configures |config| and |crypto_config| 104 // SetupCryptoServerConfigForTest configures |config| and |crypto_config|
105 // with sensible defaults for testing. 105 // with sensible defaults for testing.
106 static void SetupCryptoServerConfigForTest( 106 static void SetupCryptoServerConfigForTest(
107 const QuicClock* clock, 107 const QuicClock* clock,
108 QuicRandom* rand, 108 QuicRandom* rand,
109 QuicConfig* config, 109 QuicConfig* config,
110 QuicCryptoServerConfig* crypto_config, 110 QuicCryptoServerConfig* crypto_config,
111 const FakeServerOptions& options); 111 const FakeServerOptions& options);
112 112
113 // CommunicateHandshakeMessages moves messages from |a| to |b| and back until 113 // CommunicateHandshakeMessages moves messages from |client| to |server| and
114 // |a|'s handshake has completed. 114 // back until |clients|'s handshake has completed.
115 static void CommunicateHandshakeMessages(PacketSavingConnection* a_conn, 115 static void CommunicateHandshakeMessages(PacketSavingConnection* client_conn,
116 QuicCryptoStream* a, 116 QuicCryptoStream* client,
117 PacketSavingConnection* b_conn, 117 PacketSavingConnection* server_conn,
118 QuicCryptoStream* b); 118 QuicCryptoStream* server);
119 119
120 // CommunicateHandshakeMessagesAndRunCallbacks moves messages from |a| to |b| 120 // CommunicateHandshakeMessagesAndRunCallbacks moves messages from |client|
121 // and back until |a|'s handshake has completed. If |callback_source| is not 121 // to |server| and back until |client|'s handshake has completed. If
122 // nullptr, CommunicateHandshakeMessagesAndRunCallbacks also runs callbacks 122 // |callback_source| is not nullptr,
123 // from 123 // CommunicateHandshakeMessagesAndRunCallbacks also runs callbacks from
124 // |callback_source| between processing messages. 124 // |callback_source| between processing messages.
125 static void CommunicateHandshakeMessagesAndRunCallbacks( 125 static void CommunicateHandshakeMessagesAndRunCallbacks(
126 PacketSavingConnection* a_conn, 126 PacketSavingConnection* client_conn,
127 QuicCryptoStream* a, 127 QuicCryptoStream* client,
128 PacketSavingConnection* b_conn, 128 PacketSavingConnection* server_conn,
129 QuicCryptoStream* b, 129 QuicCryptoStream* server,
130 CallbackSource* callback_source); 130 CallbackSource* callback_source);
131 131
132 // AdvanceHandshake attempts to moves messages from |a| to |b| and |b| to |a|. 132 // AdvanceHandshake attempts to moves messages from |client| to |server| and
133 // Returns the number of messages moved. 133 // |server| to |client|. Returns the number of messages moved.
134 static std::pair<size_t, size_t> AdvanceHandshake( 134 static std::pair<size_t, size_t> AdvanceHandshake(
135 PacketSavingConnection* a_conn, 135 PacketSavingConnection* client_conn,
136 QuicCryptoStream* a, 136 QuicCryptoStream* client,
137 size_t a_i, 137 size_t client_i,
138 PacketSavingConnection* b_conn, 138 PacketSavingConnection* server_conn,
139 QuicCryptoStream* b, 139 QuicCryptoStream* server,
140 size_t b_i); 140 size_t server_i);
141 141
142 // Returns the value for the tag |tag| in the tag value map of |message|. 142 // Returns the value for the tag |tag| in the tag value map of |message|.
143 static std::string GetValueForTag(const CryptoHandshakeMessage& message, 143 static std::string GetValueForTag(const CryptoHandshakeMessage& message,
144 QuicTag tag); 144 QuicTag tag);
145 145
146 // Returns a |ProofSource| that serves up test certificates. 146 // Returns a |ProofSource| that serves up test certificates.
147 static ProofSource* ProofSourceForTesting(); 147 static ProofSource* ProofSourceForTesting();
148 148
149 // Returns a |ProofVerifier| that uses the QUIC testing root CA. 149 // Returns a |ProofVerifier| that uses the QUIC testing root CA.
150 static ProofVerifier* ProofVerifierForTesting(); 150 static ProofVerifier* ProofVerifierForTesting();
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 // method never returns QUIC_PENDING. 193 // method never returns QUIC_PENDING.
194 static ChannelIDSource* ChannelIDSourceForTesting(); 194 static ChannelIDSource* ChannelIDSourceForTesting();
195 195
196 // MovePackets parses crypto handshake messages from packet number 196 // MovePackets parses crypto handshake messages from packet number
197 // |*inout_packet_index| through to the last packet (or until a packet fails 197 // |*inout_packet_index| through to the last packet (or until a packet fails
198 // to decrypt) and has |dest_stream| process them. |*inout_packet_index| is 198 // to decrypt) and has |dest_stream| process them. |*inout_packet_index| is
199 // updated with an index one greater than the last packet processed. 199 // updated with an index one greater than the last packet processed.
200 static void MovePackets(PacketSavingConnection* source_conn, 200 static void MovePackets(PacketSavingConnection* source_conn,
201 size_t* inout_packet_index, 201 size_t* inout_packet_index,
202 QuicCryptoStream* dest_stream, 202 QuicCryptoStream* dest_stream,
203 PacketSavingConnection* dest_conn); 203 PacketSavingConnection* dest_conn,
204 Perspective dest_perspective);
204 205
205 private: 206 private:
206 static void CompareClientAndServerKeys(QuicCryptoClientStream* client, 207 static void CompareClientAndServerKeys(QuicCryptoClientStream* client,
207 QuicCryptoServerStream* server); 208 QuicCryptoServerStream* server);
208 209
209 DISALLOW_COPY_AND_ASSIGN(CryptoTestUtils); 210 DISALLOW_COPY_AND_ASSIGN(CryptoTestUtils);
210 }; 211 };
211 212
212 } // namespace test 213 } // namespace test
213 214
214 } // namespace net 215 } // namespace net
215 216
216 #endif // NET_QUIC_TEST_TOOLS_CRYPTO_TEST_UTILS_H_ 217 #endif // NET_QUIC_TEST_TOOLS_CRYPTO_TEST_UTILS_H_
OLDNEW
« no previous file with comments | « net/quic/reliable_quic_stream_test.cc ('k') | net/quic/test_tools/crypto_test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698