blob: a4ee9d1b0c5ec984797c92f4346cafea47e5f082 [file] [log] [blame]
QUICHE teama6ef0a62019-03-07 20:34:33 -05001// 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>
vasilvv872e7a32019-03-12 16:42:44 -07008#include <string>
bnc463f2352019-10-10 04:49:34 -07009#include <utility>
QUICHE teama6ef0a62019-03-07 20:34:33 -050010
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"
dschinazi56fb53e2019-06-21 15:30:04 -070015#include "net/third_party/quiche/src/quic/core/proto/cached_network_parameters_proto.h"
QUICHE teama6ef0a62019-03-07 20:34:33 -050016#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 teama6ef0a62019-03-07 20:34:33 -050024
25namespace quic {
26
27QuicCryptoServerStreamBase::QuicCryptoServerStreamBase(QuicSession* session)
28 : QuicCryptoStream(session) {}
29
nharper23d40742020-01-03 14:55:01 -080030std::unique_ptr<QuicCryptoServerStreamBase> CreateCryptoServerStream(
nharpere5e28f92020-01-03 14:10:07 -080031 const QuicCryptoServerConfig* crypto_config,
32 QuicCompressedCertsCache* compressed_certs_cache,
33 QuicSession* session,
nharper5f23a2d2020-02-20 10:44:09 -080034 QuicCryptoServerStreamBase::Helper* helper) {
nharperf579b5e2020-01-21 14:11:18 -080035 switch (session->connection()->version().handshake_protocol) {
36 case PROTOCOL_QUIC_CRYPTO:
nharperbb7d1f32020-02-21 17:20:33 -080037 return std::unique_ptr<QuicCryptoServerHandshaker>(
38 new QuicCryptoServerHandshaker(crypto_config, compressed_certs_cache,
39 session, helper));
nharperf579b5e2020-01-21 14:11:18 -080040 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;
nharpere5e28f92020-01-03 14:10:07 -080050}
51
QUICHE teama6ef0a62019-03-07 20:34:33 -050052} // namespace quic