QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 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 | #include "net/third_party/quiche/src/quic/core/quic_crypto_server_stream.h" |
| 6 | |
| 7 | #include <memory> |
vasilvv | 872e7a3 | 2019-03-12 16:42:44 -0700 | [diff] [blame] | 8 | #include <string> |
bnc | 463f235 | 2019-10-10 04:49:34 -0700 | [diff] [blame] | 9 | #include <utility> |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 10 | |
| 11 | #include "net/third_party/quiche/src/quic/core/crypto/crypto_protocol.h" |
| 12 | #include "net/third_party/quiche/src/quic/core/crypto/crypto_utils.h" |
| 13 | #include "net/third_party/quiche/src/quic/core/crypto/quic_crypto_server_config.h" |
| 14 | #include "net/third_party/quiche/src/quic/core/crypto/quic_random.h" |
dschinazi | 56fb53e | 2019-06-21 15:30:04 -0700 | [diff] [blame] | 15 | #include "net/third_party/quiche/src/quic/core/proto/cached_network_parameters_proto.h" |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 16 | #include "net/third_party/quiche/src/quic/core/quic_config.h" |
| 17 | #include "net/third_party/quiche/src/quic/core/quic_crypto_server_handshaker.h" |
| 18 | #include "net/third_party/quiche/src/quic/core/quic_packets.h" |
| 19 | #include "net/third_party/quiche/src/quic/core/quic_session.h" |
| 20 | #include "net/third_party/quiche/src/quic/core/tls_server_handshaker.h" |
| 21 | #include "net/third_party/quiche/src/quic/platform/api/quic_flag_utils.h" |
| 22 | #include "net/third_party/quiche/src/quic/platform/api/quic_flags.h" |
| 23 | #include "net/third_party/quiche/src/quic/platform/api/quic_logging.h" |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 24 | |
| 25 | namespace quic { |
| 26 | |
| 27 | QuicCryptoServerStreamBase::QuicCryptoServerStreamBase(QuicSession* session) |
| 28 | : QuicCryptoStream(session) {} |
| 29 | |
nharper | 23d4074 | 2020-01-03 14:55:01 -0800 | [diff] [blame] | 30 | std::unique_ptr<QuicCryptoServerStreamBase> CreateCryptoServerStream( |
nharper | e5e28f9 | 2020-01-03 14:10:07 -0800 | [diff] [blame] | 31 | const QuicCryptoServerConfig* crypto_config, |
| 32 | QuicCompressedCertsCache* compressed_certs_cache, |
| 33 | QuicSession* session, |
nharper | 5f23a2d | 2020-02-20 10:44:09 -0800 | [diff] [blame] | 34 | QuicCryptoServerStreamBase::Helper* helper) { |
nharper | f579b5e | 2020-01-21 14:11:18 -0800 | [diff] [blame] | 35 | switch (session->connection()->version().handshake_protocol) { |
| 36 | case PROTOCOL_QUIC_CRYPTO: |
nharper | bb7d1f3 | 2020-02-21 17:20:33 -0800 | [diff] [blame^] | 37 | return std::unique_ptr<QuicCryptoServerHandshaker>( |
| 38 | new QuicCryptoServerHandshaker(crypto_config, compressed_certs_cache, |
| 39 | session, helper)); |
nharper | f579b5e | 2020-01-21 14:11:18 -0800 | [diff] [blame] | 40 | case PROTOCOL_TLS1_3: |
| 41 | return std::unique_ptr<TlsServerHandshaker>(new TlsServerHandshaker( |
| 42 | session, crypto_config->ssl_ctx(), crypto_config->proof_source())); |
| 43 | case PROTOCOL_UNSUPPORTED: |
| 44 | break; |
| 45 | } |
| 46 | QUIC_BUG << "Unknown handshake protocol: " |
| 47 | << static_cast<int>( |
| 48 | session->connection()->version().handshake_protocol); |
| 49 | return nullptr; |
nharper | e5e28f9 | 2020-01-03 14:10:07 -0800 | [diff] [blame] | 50 | } |
| 51 | |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 52 | } // namespace quic |