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_CORE_QUIC_CRYPTO_STREAM_H_ | 5 #ifndef NET_QUIC_CORE_QUIC_CRYPTO_STREAM_H_ |
6 #define NET_QUIC_CORE_QUIC_CRYPTO_STREAM_H_ | 6 #define NET_QUIC_CORE_QUIC_CRYPTO_STREAM_H_ |
7 | 7 |
8 #include <cstddef> | 8 #include <cstddef> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "net/quic/core/crypto/crypto_framer.h" | 11 #include "net/quic/core/crypto/crypto_framer.h" |
12 #include "net/quic/core/crypto/crypto_utils.h" | 12 #include "net/quic/core/crypto/crypto_utils.h" |
13 #include "net/quic/core/quic_config.h" | 13 #include "net/quic/core/quic_config.h" |
14 #include "net/quic/core/quic_packets.h" | 14 #include "net/quic/core/quic_packets.h" |
15 #include "net/quic/core/quic_stream.h" | 15 #include "net/quic/core/quic_stream.h" |
16 #include "net/quic/platform/api/quic_export.h" | 16 #include "net/quic/platform/api/quic_export.h" |
| 17 #include "net/quic/platform/api/quic_string_piece.h" |
17 | 18 |
18 namespace net { | 19 namespace net { |
19 | 20 |
20 class CryptoHandshakeMessage; | 21 class CryptoHandshakeMessage; |
21 class QuicSession; | 22 class QuicSession; |
22 | 23 |
23 // Crypto handshake messages in QUIC take place over a reserved stream with the | 24 // Crypto handshake messages in QUIC take place over a reserved stream with the |
24 // id 1. Each endpoint (client and server) will allocate an instance of a | 25 // id 1. Each endpoint (client and server) will allocate an instance of a |
25 // subclass of QuicCryptoStream to send and receive handshake messages. (In the | 26 // subclass of QuicCryptoStream to send and receive handshake messages. (In the |
26 // normal 1-RTT handshake, the client will send a client hello, CHLO, message. | 27 // normal 1-RTT handshake, the client will send a client hello, CHLO, message. |
(...skipping 23 matching lines...) Expand all Loading... |
50 void OnDataAvailable() override; | 51 void OnDataAvailable() override; |
51 | 52 |
52 // Sends |message| to the peer. | 53 // Sends |message| to the peer. |
53 // TODO(wtc): return a success/failure status. | 54 // TODO(wtc): return a success/failure status. |
54 void SendHandshakeMessage(const CryptoHandshakeMessage& message); | 55 void SendHandshakeMessage(const CryptoHandshakeMessage& message); |
55 | 56 |
56 // Performs key extraction to derive a new secret of |result_len| bytes | 57 // Performs key extraction to derive a new secret of |result_len| bytes |
57 // dependent on |label|, |context|, and the stream's negotiated subkey secret. | 58 // dependent on |label|, |context|, and the stream's negotiated subkey secret. |
58 // Returns false if the handshake has not been confirmed or the parameters are | 59 // Returns false if the handshake has not been confirmed or the parameters are |
59 // invalid (e.g. |label| contains null bytes); returns true on success. | 60 // invalid (e.g. |label| contains null bytes); returns true on success. |
60 bool ExportKeyingMaterial(base::StringPiece label, | 61 bool ExportKeyingMaterial(QuicStringPiece label, |
61 base::StringPiece context, | 62 QuicStringPiece context, |
62 size_t result_len, | 63 size_t result_len, |
63 std::string* result) const; | 64 std::string* result) const; |
64 | 65 |
65 // Performs key extraction for Token Binding. Unlike ExportKeyingMaterial, | 66 // Performs key extraction for Token Binding. Unlike ExportKeyingMaterial, |
66 // this function can be called before forward-secure encryption is | 67 // this function can be called before forward-secure encryption is |
67 // established. Returns false if initial encryption has not been established, | 68 // established. Returns false if initial encryption has not been established, |
68 // and true on success. | 69 // and true on success. |
69 // | 70 // |
70 // Since this depends only on the initial keys, a signature over it can be | 71 // Since this depends only on the initial keys, a signature over it can be |
71 // repurposed by an attacker who obtains the client's or server's DH private | 72 // repurposed by an attacker who obtains the client's or server's DH private |
(...skipping 14 matching lines...) Expand all Loading... |
86 | 87 |
87 private: | 88 private: |
88 CryptoFramer crypto_framer_; | 89 CryptoFramer crypto_framer_; |
89 | 90 |
90 DISALLOW_COPY_AND_ASSIGN(QuicCryptoStream); | 91 DISALLOW_COPY_AND_ASSIGN(QuicCryptoStream); |
91 }; | 92 }; |
92 | 93 |
93 } // namespace net | 94 } // namespace net |
94 | 95 |
95 #endif // NET_QUIC_CORE_QUIC_CRYPTO_STREAM_H_ | 96 #endif // NET_QUIC_CORE_QUIC_CRYPTO_STREAM_H_ |
OLD | NEW |