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

Side by Side Diff: net/quic/quic_crypto_stream.h

Issue 2193073003: Move shared files in net/quic/ into net/quic/core/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: io_thread_unittest.cc Created 4 years, 4 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/quic_crypto_server_stream_test.cc ('k') | net/quic/quic_crypto_stream.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) 2012 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_QUIC_CRYPTO_STREAM_H_
6 #define NET_QUIC_QUIC_CRYPTO_STREAM_H_
7
8 #include <stddef.h>
9
10 #include "base/macros.h"
11 #include "net/quic/crypto/crypto_framer.h"
12 #include "net/quic/crypto/crypto_utils.h"
13 #include "net/quic/quic_config.h"
14 #include "net/quic/quic_protocol.h"
15 #include "net/quic/reliable_quic_stream.h"
16
17 namespace net {
18
19 class CryptoHandshakeMessage;
20 class QuicSession;
21
22 // Crypto handshake messages in QUIC take place over a reserved
23 // reliable stream with the id 1. Each endpoint (client and server)
24 // will allocate an instance of a subclass of QuicCryptoStream
25 // to send and receive handshake messages. (In the normal 1-RTT
26 // handshake, the client will send a client hello, CHLO, message.
27 // The server will receive this message and respond with a server
28 // hello message, SHLO. At this point both sides will have established
29 // a crypto context they can use to send encrypted messages.
30 //
31 // For more details: http://goto.google.com/quic-crypto
32 class NET_EXPORT_PRIVATE QuicCryptoStream
33 : public ReliableQuicStream,
34 public CryptoFramerVisitorInterface {
35 public:
36 explicit QuicCryptoStream(QuicSession* session);
37
38 // CryptoFramerVisitorInterface implementation
39 void OnError(CryptoFramer* framer) override;
40 void OnHandshakeMessage(const CryptoHandshakeMessage& message) override;
41
42 // ReliableQuicStream implementation
43 void OnDataAvailable() override;
44
45 // Sends |message| to the peer.
46 // TODO(wtc): return a success/failure status.
47 void SendHandshakeMessage(const CryptoHandshakeMessage& message);
48 // As above, but registers |delegate| for notification when |message| has been
49 // ACKed by the peer.
50 void SendHandshakeMessage(const CryptoHandshakeMessage& message,
51 QuicAckListenerInterface* listener);
52
53 // Performs key extraction to derive a new secret of |result_len| bytes
54 // dependent on |label|, |context|, and the stream's negotiated subkey secret.
55 // Returns false if the handshake has not been confirmed or the parameters are
56 // invalid (e.g. |label| contains null bytes); returns true on success.
57 bool ExportKeyingMaterial(base::StringPiece label,
58 base::StringPiece context,
59 size_t result_len,
60 std::string* result) const;
61
62 // Performs key extraction for Token Binding. Unlike ExportKeyingMaterial,
63 // this function can be called before forward-secure encryption is
64 // established. Returns false if initial encryption has not been established,
65 // and true on success.
66 //
67 // Since this depends only on the initial keys, a signature over it can be
68 // repurposed by an attacker who obtains the client's or server's DH private
69 // value.
70 bool ExportTokenBindingKeyingMaterial(std::string* result) const;
71
72 bool encryption_established() const { return encryption_established_; }
73 bool handshake_confirmed() const { return handshake_confirmed_; }
74
75 const QuicCryptoNegotiatedParameters& crypto_negotiated_params() const;
76
77 protected:
78 bool encryption_established_;
79 bool handshake_confirmed_;
80
81 QuicCryptoNegotiatedParameters crypto_negotiated_params_;
82
83 private:
84 CryptoFramer crypto_framer_;
85
86 DISALLOW_COPY_AND_ASSIGN(QuicCryptoStream);
87 };
88
89 } // namespace net
90
91 #endif // NET_QUIC_QUIC_CRYPTO_STREAM_H_
OLDNEW
« no previous file with comments | « net/quic/quic_crypto_server_stream_test.cc ('k') | net/quic/quic_crypto_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698