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

Side by Side Diff: net/quic/crypto/crypto_handshake.h

Issue 12381018: QUIC - Some sketching of the crypto handshake. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « net/quic/crypto/crypto_framer.cc ('k') | net/quic/crypto/crypto_handshake.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef NET_QUIC_CRYPTO_CRYPTO_HANDSHAKE_H_
6 #define NET_QUIC_CRYPTO_CRYPTO_HANDSHAKE_H_
7
8 #include <map>
9 #include <string>
10
11 #include "net/base/net_export.h"
12 #include "net/quic/crypto/crypto_protocol.h"
13
14 namespace net {
15
16 class KeyExchange;
17 class QuicRandom;
18 class QuicClock;
19
20 // QuicCryptoClientConfig contains crypto-related configuration settings for a
21 // client.
22 class NET_EXPORT_PRIVATE QuicCryptoClientConfig {
23 public:
24 // Initializes the members to 0 or empty values.
25 QuicCryptoClientConfig();
26 ~QuicCryptoClientConfig();
27
28 // Sets the members to reasonable, default values.
29 void SetDefaults();
30
31 // FillClientHello sets |out| to be a CHLO message based on the configuration
32 // of this object.
33 void FillClientHello(const std::string& nonce,
34 const std::string& server_hostname,
35 CryptoHandshakeMessage* out);
36
37 // Protocol version
38 uint16 version;
39 // Key exchange methods
40 CryptoTagVector key_exchange;
41 // Authenticated encryption with associated data (AEAD) algorithms
42 CryptoTagVector aead;
43 // Congestion control feedback types
44 CryptoTagVector congestion_control;
45 // Idle connection state lifetime
46 QuicTime::Delta idle_connection_state_lifetime;
47 // Keepalive timeout, or 0 to turn off keepalive probes
48 QuicTime::Delta keepalive_timeout;
49 };
50
51 // TODO(rtenneti): Delete QuicCryptoServerConfig.
52 //
53 // QuicCryptoServerConfig contains the crypto configuration of a QUIC server.
54 // Unlike a client, a QUIC server can have multiple configurations active in
55 // order to support clients resuming with a previous configuration.
56 // TODO(agl): when adding configurations at runtime is added, this object will
57 // need to consider locking.
58 class NET_EXPORT_PRIVATE QuicCryptoServerConfig {
59 public:
60 QuicCryptoServerConfig();
61 ~QuicCryptoServerConfig();
62
63 // AddTestingConfig adds a single, testing config.
64 void AddTestingConfig(QuicRandom* rand, const QuicClock* clock);
65
66 // ProcessClientHello processes |client_hello| and decides whether to accept
67 // or reject the connection. If the connection is to be accepted, |out| is
68 // set to the contents of the ServerHello and true is returned. |nonce| is
69 // used as the server's nonce. Otherwise |out| is set to be a REJ message
70 // and false is returned.
71 bool ProcessClientHello(const CryptoHandshakeMessage& client_hello,
72 const std::string& nonce,
73 CryptoHandshakeMessage* out);
74
75 private:
76 // Config represents a server config: a collection of preferences and
77 // Diffie-Hellman public values.
78 struct Config {
79 Config();
80 ~Config();
81
82 // serialized contains the bytes of this server config, suitable for sending
83 // on the wire.
84 std::string serialized;
85 // key_exchange_tags contains the key exchange methods from the config,
86 // in preference order.
87 CryptoTagVector key_exchange_tags;
88 // key_exchanges maps from elements of |key_exchange_tags| to the object
89 // that implements the specific key exchange.
90 std::map<CryptoTag, KeyExchange*> key_exchanges;
91 };
92
93 std::map<ServerConfigID, Config*> configs_;
94
95 std::string active_config_;
96 };
97
98 // Parameters negotiated by the crypto handshake.
99 struct NET_EXPORT_PRIVATE QuicCryptoNegotiatedParams {
100 // Initializes the members to 0 or empty values.
101 QuicCryptoNegotiatedParams();
102 ~QuicCryptoNegotiatedParams();
103
104 // Sets the members to the values that would be negotiated from the default
105 // client-side and server-side configuration settings.
106 void SetDefaults();
107
108 uint16 version;
109 CryptoTag key_exchange;
110 CryptoTag aead;
111 CryptoTag congestion_control;
112 QuicTime::Delta idle_connection_state_lifetime;
113 };
114
115 } // namespace net
116
117 #endif // NET_QUIC_CRYPTO_CRYPTO_HANDSHAKE_H_
OLDNEW
« no previous file with comments | « net/quic/crypto/crypto_framer.cc ('k') | net/quic/crypto/crypto_handshake.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698