| OLD | NEW |
| 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 #ifndef NET_QUIC_CRYPTO_QUIC_CRYPTO_CLIENT_CONFIG_H_ | 5 #ifndef NET_QUIC_CRYPTO_QUIC_CRYPTO_CLIENT_CONFIG_H_ |
| 6 #define NET_QUIC_CRYPTO_QUIC_CRYPTO_CLIENT_CONFIG_H_ | 6 #define NET_QUIC_CRYPTO_QUIC_CRYPTO_CLIENT_CONFIG_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 // of this object. This object must have cached enough information about | 173 // of this object. This object must have cached enough information about |
| 174 // |server_hostname| in order to perform a handshake. This can be checked | 174 // |server_hostname| in order to perform a handshake. This can be checked |
| 175 // with the |IsComplete| member of |CachedState|. | 175 // with the |IsComplete| member of |CachedState|. |
| 176 // | 176 // |
| 177 // |clock| and |rand| are used to generate the nonce and |out_params| is | 177 // |clock| and |rand| are used to generate the nonce and |out_params| is |
| 178 // filled with the results of the handshake that the server is expected to | 178 // filled with the results of the handshake that the server is expected to |
| 179 // accept. |preferred_version| is the version of the QUIC protocol that this | 179 // accept. |preferred_version| is the version of the QUIC protocol that this |
| 180 // client chose to use initially. This allows the server to detect downgrade | 180 // client chose to use initially. This allows the server to detect downgrade |
| 181 // attacks. | 181 // attacks. |
| 182 QuicErrorCode FillClientHello(const std::string& server_hostname, | 182 QuicErrorCode FillClientHello(const std::string& server_hostname, |
| 183 QuicGuid guid, | 183 QuicConnectionId connection_id, |
| 184 const QuicVersion preferred_version, | 184 const QuicVersion preferred_version, |
| 185 const CachedState* cached, | 185 const CachedState* cached, |
| 186 QuicWallTime now, | 186 QuicWallTime now, |
| 187 QuicRandom* rand, | 187 QuicRandom* rand, |
| 188 QuicCryptoNegotiatedParameters* out_params, | 188 QuicCryptoNegotiatedParameters* out_params, |
| 189 CryptoHandshakeMessage* out, | 189 CryptoHandshakeMessage* out, |
| 190 std::string* error_details) const; | 190 std::string* error_details) const; |
| 191 | 191 |
| 192 // ProcessRejection processes a REJ message from a server and updates the | 192 // ProcessRejection processes a REJ message from a server and updates the |
| 193 // cached information about that server. After this, |IsComplete| may return | 193 // cached information about that server. After this, |IsComplete| may return |
| 194 // true for that server's CachedState. If the rejection message contains | 194 // true for that server's CachedState. If the rejection message contains |
| 195 // state about a future handshake (i.e. an nonce value from the server), then | 195 // state about a future handshake (i.e. an nonce value from the server), then |
| 196 // it will be saved in |out_params|. |now| is used to judge whether the | 196 // it will be saved in |out_params|. |now| is used to judge whether the |
| 197 // server config in the rejection message has expired. | 197 // server config in the rejection message has expired. |
| 198 QuicErrorCode ProcessRejection(const CryptoHandshakeMessage& rej, | 198 QuicErrorCode ProcessRejection(const CryptoHandshakeMessage& rej, |
| 199 QuicWallTime now, | 199 QuicWallTime now, |
| 200 CachedState* cached, | 200 CachedState* cached, |
| 201 QuicCryptoNegotiatedParameters* out_params, | 201 QuicCryptoNegotiatedParameters* out_params, |
| 202 std::string* error_details); | 202 std::string* error_details); |
| 203 | 203 |
| 204 // ProcessServerHello processes the message in |server_hello|, updates the | 204 // ProcessServerHello processes the message in |server_hello|, updates the |
| 205 // cached information about that server, writes the negotiated parameters to | 205 // cached information about that server, writes the negotiated parameters to |
| 206 // |out_params| and returns QUIC_NO_ERROR. If |server_hello| is unacceptable | 206 // |out_params| and returns QUIC_NO_ERROR. If |server_hello| is unacceptable |
| 207 // then it puts an error message in |error_details| and returns an error | 207 // then it puts an error message in |error_details| and returns an error |
| 208 // code. |negotiated_versions| contains the list of version, if any, that were | 208 // code. |negotiated_versions| contains the list of version, if any, that were |
| 209 // present in a version negotiation packet previously recevied from the | 209 // present in a version negotiation packet previously recevied from the |
| 210 // server. The contents of this list will be compared against the list of | 210 // server. The contents of this list will be compared against the list of |
| 211 // versions provided in the VER tag of the server hello. | 211 // versions provided in the VER tag of the server hello. |
| 212 QuicErrorCode ProcessServerHello(const CryptoHandshakeMessage& server_hello, | 212 QuicErrorCode ProcessServerHello(const CryptoHandshakeMessage& server_hello, |
| 213 QuicGuid guid, | 213 QuicConnectionId connection_id, |
| 214 const QuicVersionVector& negotiated_versions, | 214 const QuicVersionVector& negotiated_versions, |
| 215 CachedState* cached, | 215 CachedState* cached, |
| 216 QuicCryptoNegotiatedParameters* out_params, | 216 QuicCryptoNegotiatedParameters* out_params, |
| 217 std::string* error_details); | 217 std::string* error_details); |
| 218 | 218 |
| 219 ProofVerifier* proof_verifier() const; | 219 ProofVerifier* proof_verifier() const; |
| 220 | 220 |
| 221 // SetProofVerifier takes ownership of a |ProofVerifier| that clients are | 221 // SetProofVerifier takes ownership of a |ProofVerifier| that clients are |
| 222 // free to use in order to verify certificate chains from servers. If a | 222 // free to use in order to verify certificate chains from servers. If a |
| 223 // ProofVerifier is set then the client will request a certificate chain from | 223 // ProofVerifier is set then the client will request a certificate chain from |
| (...skipping 22 matching lines...) Expand all Loading... |
| 246 | 246 |
| 247 scoped_ptr<ProofVerifier> proof_verifier_; | 247 scoped_ptr<ProofVerifier> proof_verifier_; |
| 248 scoped_ptr<ChannelIDSigner> channel_id_signer_; | 248 scoped_ptr<ChannelIDSigner> channel_id_signer_; |
| 249 | 249 |
| 250 DISALLOW_COPY_AND_ASSIGN(QuicCryptoClientConfig); | 250 DISALLOW_COPY_AND_ASSIGN(QuicCryptoClientConfig); |
| 251 }; | 251 }; |
| 252 | 252 |
| 253 } // namespace net | 253 } // namespace net |
| 254 | 254 |
| 255 #endif // NET_QUIC_CRYPTO_QUIC_CRYPTO_CLIENT_CONFIG_H_ | 255 #endif // NET_QUIC_CRYPTO_QUIC_CRYPTO_CLIENT_CONFIG_H_ |
| OLD | NEW |