curl-fuzzer C++ reference
Loading...
Searching...
No Matches
proto_fuzzer::TlsMockTransport Class Reference

Reusable TLS carrier for protocol-specific mock peers. More...

#include <tls_mock_server.h>

Public Member Functions

 TlsMockTransport (TlsApplicationProtocol protocol=TlsApplicationProtocol::kHttp11, curl::fuzzer::proto::TlsCertificateChainProfile certificate_chain=curl::fuzzer::proto::TLS_CERTIFICATE_CHAIN_DEFAULT_EC, TlsGroupPolicy group_policy=TlsGroupPolicy::kProviderDefault, curl::fuzzer::proto::TlsHandshakeProfile handshake_profile=curl::fuzzer::proto::TLS_HANDSHAKE_DEFAULT)
 Construct one reusable TLS context for a protocol-specific peer.
void Install (CURL *easy) const
 Install the stable local trust anchor and strict peer verification.
std::unique_ptr< MockConnection > CreateConnection ()
 Wrap one socketpair server endpoint in an OpenSSL acceptor.
std::unique_ptr< MockConnection > CreateAcceptedConnection (int accepted_fd)
 Wrap one accepted loopback descriptor in this transport's OpenSSL server context.
int negotiated_tls_version () const
std::size_t completed_handshake_count () const
std::size_t reused_session_count () const
std::size_t write_retry_count () const
std::string negotiated_alpn () const
TlsGroupPolicy group_policy () const
std::string negotiated_group () const
int ech_status () const
std::string ech_inner_name () const
std::string ech_outer_name () const

Detailed Description

Reusable TLS carrier for protocol-specific mock peers.

It owns the per-scenario server context, creates nonblocking TLS connections, and installs the checked-in trust anchor without taking ownership of curl's socket callbacks or application-protocol drive loop.

Definition at line 49 of file tls_mock_server.h.

Constructor & Destructor Documentation

◆ TlsMockTransport()

proto_fuzzer::TlsMockTransport::TlsMockTransport ( TlsApplicationProtocol protocol = TlsApplicationProtocol::kHttp11,
curl::fuzzer::proto::TlsCertificateChainProfile certificate_chain = curl::fuzzer::proto::TLS_CERTIFICATE_CHAIN_DEFAULT_EC,
TlsGroupPolicy group_policy = TlsGroupPolicy::kProviderDefault,
curl::fuzzer::proto::TlsHandshakeProfile handshake_profile = curl::fuzzer::proto::TLS_HANDSHAKE_DEFAULT )
explicit

Construct one reusable TLS context for a protocol-specific peer.

Parameters
protocolFixed ALPN application protocol offered by the server.
certificate_chainCertificate-chain profile presented to curl.
group_policyImmutable server key-exchange group policy.
handshake_profileClosed peer-side handshake terminal.

Definition at line 561 of file tls_mock_server.cc.

Member Function Documentation

◆ completed_handshake_count()

std::size_t proto_fuzzer::TlsMockTransport::completed_handshake_count ( ) const
Returns
Number of connections that completed TLS negotiation.

Definition at line 612 of file tls_mock_server.cc.

◆ CreateAcceptedConnection()

std::unique_ptr< MockConnection > proto_fuzzer::TlsMockTransport::CreateAcceptedConnection ( int accepted_fd)

Wrap one accepted loopback descriptor in this transport's OpenSSL server context.

The special pre-handshake terminal profiles apply only to the socketpair fuzz lanes; a listener-backed peer always performs real TLS.

Parameters
accepted_fdConnected descriptor whose ownership transfers.
Returns
TLS connection owning accepted_fd.

Definition at line 602 of file tls_mock_server.cc.

◆ CreateConnection()

std::unique_ptr< MockConnection > proto_fuzzer::TlsMockTransport::CreateConnection ( )

Wrap one socketpair server endpoint in an OpenSSL acceptor.

Returns
A failed connection when context setup was unavailable.

Definition at line 587 of file tls_mock_server.cc.

◆ ech_inner_name()

std::string proto_fuzzer::TlsMockTransport::ech_inner_name ( ) const
Returns
Decrypted inner SNI recovered by the ECH-capable server.

Definition at line 643 of file tls_mock_server.cc.

◆ ech_outer_name()

std::string proto_fuzzer::TlsMockTransport::ech_outer_name ( ) const
Returns
Public outer SNI visible before ECH decryption.

Definition at line 648 of file tls_mock_server.cc.

◆ ech_status()

int proto_fuzzer::TlsMockTransport::ech_status ( ) const
Returns
OpenSSL's ECH result, or a negative sentinel when unavailable.

Definition at line 640 of file tls_mock_server.cc.

◆ group_policy()

TlsGroupPolicy proto_fuzzer::TlsMockTransport::group_policy ( ) const
Returns
Immutable key-exchange group policy selected at construction.

Definition at line 632 of file tls_mock_server.cc.

◆ Install()

void proto_fuzzer::TlsMockTransport::Install ( CURL * easy) const

Install the stable local trust anchor and strict peer verification.

Socket callbacks remain owned by the protocol-specific server using this carrier.

Parameters
easyEasy handle that will connect to this TLS transport.

Definition at line 577 of file tls_mock_server.cc.

◆ negotiated_alpn()

std::string proto_fuzzer::TlsMockTransport::negotiated_alpn ( ) const
Returns
ALPN protocol selected by the most recent handshake.

Definition at line 627 of file tls_mock_server.cc.

◆ negotiated_group()

std::string proto_fuzzer::TlsMockTransport::negotiated_group ( ) const
Returns
Key-exchange group from the most recent completed handshake.

Definition at line 635 of file tls_mock_server.cc.

◆ negotiated_tls_version()

int proto_fuzzer::TlsMockTransport::negotiated_tls_version ( ) const
Returns
Protocol version selected by the most recent handshake, or zero.

Definition at line 607 of file tls_mock_server.cc.

◆ reused_session_count()

std::size_t proto_fuzzer::TlsMockTransport::reused_session_count ( ) const
Returns
Number of completed connections that resumed a cached session.

Definition at line 617 of file tls_mock_server.cc.

◆ write_retry_count()

std::size_t proto_fuzzer::TlsMockTransport::write_retry_count ( ) const
Returns
Number of application writes OpenSSL required an exact retry for.

Definition at line 622 of file tls_mock_server.cc.


The documentation for this class was generated from the following files: