#include "remoting/protocol/ssl_hmac_channel_authenticator.h"
#include <stdint.h>
#include <utility>
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/logging.h"
#include "build/build_config.h"
#include "crypto/secure_util.h"
#include "net/base/host_port_pair.h"
#include "net/base/io_buffer.h"
#include "net/base/ip_address.h"
#include "net/base/net_errors.h"
#include "net/cert/cert_status_flags.h"
#include "net/cert/cert_verifier.h"
#include "net/cert/cert_verify_result.h"
#include "net/cert/signed_certificate_timestamp_and_status.h"
#include "net/cert/x509_certificate.h"
#include "net/http/transport_security_state.h"
#include "net/log/net_log_with_source.h"
#include "net/socket/client_socket_factory.h"
#include "net/socket/ssl_client_socket.h"
#include "net/socket/ssl_server_socket.h"
#include "net/socket/stream_socket.h"
#include "net/ssl/ssl_config_service.h"
#include "net/ssl/ssl_server_config.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "remoting/base/rsa_key_pair.h"
#include "remoting/protocol/auth_util.h"
#include "remoting/protocol/p2p_stream_socket.h"
namespace remoting::protocol {
namespace {
constexpr net::NetworkTrafficAnnotationTag kTrafficAnnotation = …;
class FailingCertVerifier : public net::CertVerifier { … };
class NetStreamSocketAdapter : public net::StreamSocket { … };
}
class SslHmacChannelAuthenticator::P2PStreamSocketAdapter
: public P2PStreamSocket { … };
SslHmacChannelAuthenticator::SslSocketContext::SslSocketContext() = default;
SslHmacChannelAuthenticator::SslSocketContext::SslSocketContext(
SslSocketContext&&) = default;
SslHmacChannelAuthenticator::SslSocketContext::~SslSocketContext() = default;
SslHmacChannelAuthenticator::SslSocketContext&
SslHmacChannelAuthenticator::SslSocketContext::operator=(SslSocketContext&&) =
default;
std::unique_ptr<SslHmacChannelAuthenticator>
SslHmacChannelAuthenticator::CreateForClient(const std::string& remote_cert,
const std::string& auth_key) { … }
std::unique_ptr<SslHmacChannelAuthenticator>
SslHmacChannelAuthenticator::CreateForHost(const std::string& local_cert,
scoped_refptr<RsaKeyPair> key_pair,
const std::string& auth_key) { … }
SslHmacChannelAuthenticator::SslHmacChannelAuthenticator(
const std::string& auth_key)
: … { … }
SslHmacChannelAuthenticator::~SslHmacChannelAuthenticator() { … }
void SslHmacChannelAuthenticator::SecureAndAuthenticate(
std::unique_ptr<P2PStreamSocket> socket,
DoneCallback done_callback) { … }
bool SslHmacChannelAuthenticator::is_ssl_server() { … }
void SslHmacChannelAuthenticator::OnConnected(int result) { … }
void SslHmacChannelAuthenticator::WriteAuthenticationBytes(
bool* callback_called) { … }
void SslHmacChannelAuthenticator::OnAuthBytesWritten(int result) { … }
bool SslHmacChannelAuthenticator::HandleAuthBytesWritten(
int result,
bool* callback_called) { … }
void SslHmacChannelAuthenticator::ReadAuthenticationBytes() { … }
void SslHmacChannelAuthenticator::OnAuthBytesRead(int result) { … }
bool SslHmacChannelAuthenticator::HandleAuthBytesRead(int read_result) { … }
bool SslHmacChannelAuthenticator::VerifyAuthBytes(
const std::string& received_auth_bytes) { … }
void SslHmacChannelAuthenticator::CheckDone(bool* callback_called) { … }
void SslHmacChannelAuthenticator::NotifyError(int error) { … }
}