/* * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * */ #include #include #include // This is necessary for the conversion between QuicServerConnectionState and // QuicConnectionStateBase and can be removed once ServerHandshake accepts // QuicServerConnectionState. #include namespace quic { FizzServerHandshake::FizzServerHandshake( QuicServerConnectionState* conn, std::shared_ptr fizzContext) : ServerHandshake(conn), fizzContext_(std::move(fizzContext)) {} void FizzServerHandshake::initializeImpl( HandshakeCallback* callback, std::unique_ptr validator) { auto context = std::make_shared( *fizzContext_->getContext()); context->setFactory(cryptoFactory_.getFizzFactory()); context->setSupportedCiphers({{fizz::CipherSuite::TLS_AES_128_GCM_SHA256}}); context->setVersionFallbackEnabled(false); // Since Draft-17, client won't sent EOED context->setOmitEarlyRecordLayer(true); state_.context() = std::move(context); callback_ = callback; if (validator) { state_.appTokenValidator() = std::move(validator); } else { state_.appTokenValidator() = std::make_unique(); } } EncryptionLevel FizzServerHandshake::getReadRecordLayerEncryptionLevel() { return getEncryptionLevelFromFizz( state_.readRecordLayer()->getEncryptionLevel()); } const CryptoFactory& FizzServerHandshake::getCryptoFactory() const { return cryptoFactory_; } void FizzServerHandshake::processAccept() { addProcessingActions(machine_.processAccept( state_, executor_, state_.context(), transportParams_)); } const fizz::server::FizzServerContext* FizzServerHandshake::getContext() const { return state_.context(); } } // namespace quic