OLD | NEW |
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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 #include "net/quic/quartc/quartc_session.h" | 5 #include "net/quic/quartc/quartc_session.h" |
6 | 6 |
7 #include "base/rand_util.h" | 7 #include "base/rand_util.h" |
8 | 8 |
9 namespace { | 9 namespace { |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 const size_t kInputKeyingMaterialLength = 32; | 21 const size_t kInputKeyingMaterialLength = 32; |
22 | 22 |
23 // Used by QuicCryptoServerConfig to provide dummy proof credentials. | 23 // Used by QuicCryptoServerConfig to provide dummy proof credentials. |
24 // TODO(zhihuang): Remove when secure P2P QUIC handshake is possible. | 24 // TODO(zhihuang): Remove when secure P2P QUIC handshake is possible. |
25 class DummyProofSource : public net::ProofSource { | 25 class DummyProofSource : public net::ProofSource { |
26 public: | 26 public: |
27 DummyProofSource() {} | 27 DummyProofSource() {} |
28 ~DummyProofSource() override {} | 28 ~DummyProofSource() override {} |
29 | 29 |
30 // ProofSource override. | 30 // ProofSource override. |
31 bool GetProof( | |
32 const net::QuicSocketAddress& server_addr, | |
33 const std::string& hostname, | |
34 const std::string& server_config, | |
35 net::QuicVersion quic_version, | |
36 base::StringPiece chlo_hash, | |
37 const net::QuicTagVector& connection_options, | |
38 net::QuicReferenceCountedPointer<net::ProofSource::Chain>* out_chain, | |
39 net::QuicCryptoProof* proof) override { | |
40 std::vector<std::string> certs; | |
41 certs.push_back("Dummy cert"); | |
42 *out_chain = new ProofSource::Chain(certs); | |
43 proof->signature = "Dummy signature"; | |
44 proof->leaf_cert_scts = "Dummy timestamp"; | |
45 return true; | |
46 } | |
47 | |
48 void GetProof(const net::QuicSocketAddress& server_addr, | 31 void GetProof(const net::QuicSocketAddress& server_addr, |
49 const std::string& hostname, | 32 const std::string& hostname, |
50 const std::string& server_config, | 33 const std::string& server_config, |
51 net::QuicVersion quic_version, | 34 net::QuicVersion quic_version, |
52 base::StringPiece chlo_hash, | 35 base::StringPiece chlo_hash, |
53 const net::QuicTagVector& connection_options, | 36 const net::QuicTagVector& connection_options, |
54 std::unique_ptr<Callback> callback) override {} | 37 std::unique_ptr<Callback> callback) override { |
| 38 net::QuicReferenceCountedPointer<net::ProofSource::Chain> chain; |
| 39 net::QuicCryptoProof proof; |
| 40 std::vector<std::string> certs; |
| 41 certs.push_back("Dummy cert"); |
| 42 chain = new ProofSource::Chain(certs); |
| 43 proof.signature = "Dummy signature"; |
| 44 proof.leaf_cert_scts = "Dummy timestamp"; |
| 45 callback->Run(true, chain, proof, nullptr /* details */); |
| 46 } |
55 }; | 47 }; |
56 | 48 |
57 // Used by QuicCryptoClientConfig to ignore the peer's credentials | 49 // Used by QuicCryptoClientConfig to ignore the peer's credentials |
58 // and establish an insecure QUIC connection. | 50 // and establish an insecure QUIC connection. |
59 // TODO(zhihuang): Remove when secure P2P QUIC handshake is possible. | 51 // TODO(zhihuang): Remove when secure P2P QUIC handshake is possible. |
60 class InsecureProofVerifier : public net::ProofVerifier { | 52 class InsecureProofVerifier : public net::ProofVerifier { |
61 public: | 53 public: |
62 InsecureProofVerifier() {} | 54 InsecureProofVerifier() {} |
63 ~InsecureProofVerifier() override {} | 55 ~InsecureProofVerifier() override {} |
64 | 56 |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 ActivateStream(std::unique_ptr<QuicStream>(stream)); | 275 ActivateStream(std::unique_ptr<QuicStream>(stream)); |
284 // Register the stream to the QuicWriteBlockedList. |priority| is clamped | 276 // Register the stream to the QuicWriteBlockedList. |priority| is clamped |
285 // between 0 and 7, with 0 being the highest priority and 7 the lowest | 277 // between 0 and 7, with 0 being the highest priority and 7 the lowest |
286 // priority. | 278 // priority. |
287 write_blocked_streams()->RegisterStream(stream->id(), priority); | 279 write_blocked_streams()->RegisterStream(stream->id(), priority); |
288 } | 280 } |
289 return stream; | 281 return stream; |
290 } | 282 } |
291 | 283 |
292 } // namespace net | 284 } // namespace net |
OLD | NEW |