wired
libc-free QUIC/HTTP3 SDK in C for x86_64-linux
Loading...
Searching...
No Matches
quic_sdrv Struct Reference

Server-side handshake driver state. More...

#include <sdrv.h>

Data Fields

u8 server_priv [32]
 ECDHE private scalar (RFC 7748 x25519 or the P-256 SEC1 scalar, per group below); always 32 bytes for either supported group.
u8 server_pub [65]
 ECDHE public key_share: 32-byte RFC 7748 x25519, or 65-byte SEC1 uncompressed P-256 (RFC 8446 4.2.8.2), per group below.
u16 group
 RFC 8446 4.2.7 NamedGroup negotiated for the ECDHE key_share (QUIC_GROUP_X25519 or QUIC_GROUP_SECP256R1); QUIC_GROUP_X25519 unless quic_sdrv_set_group selects otherwise.
u8 p256_priv [32]
 RFC 5480 ECDSA P-256 signing scalar; also the TBS signer for a self-built certificate.
u8 cert_buf [512]
 self-signed P-256 cert DER (owned)
u8 san_ipv4 [4]
 RFC 5280 4.2.1.6: see wired_srvboot_id.san_ipv4's doc.
quic_span certs [QUIC_TLS_CERT_CHAIN_MAX]
 RFC 8446 4.4.2 certificate_list, leaf first (caller-owned views in external-chain mode).
usz cert_count
 0 = nothing to send (flight build fails)
u8 client_pub [65]
 RFC 8446 4.2.8 client key_share, group above.
u8 client_sid [32]
 RFC 8446 4.1.2 legacy_session_id.
u8 client_sid_len
 0..32
u8 ticket_key [QUIC_TICKET_KEY_LEN]
 RFC 8446 4.6.1: this server's session-ticket encryption key, or has_ticket_key 0 to disable resumption entirely (pre_shared_key is then never inspected).
int has_ticket_key
 1 when ticket_key above is set; 0 disables resumption.
int psk_accepted
 RFC 8446 4.2.11/4.2.11.2: set by quic_sdrv_recv_client_hello when the ClientHello's pre_shared_key ticket opened under ticket_key and its binder verified.
u8 psk_secret [QUIC_TICKET_SECRET_LEN]
 The opened ticket's resumption secret; meaningful when psk_accepted.
int early_data_accepted
 RFC 8446 4.2.10 / RFC 9001 4.6.1/9.2: set by quic_sdrv_recv_client_hello when the ClientHello carries early_data (0x002a) alongside an accepted pre_shared_key AND the presented ticket is on its first use (RFC 8446 8.1 single-use enforcement, quic_zerortt_seen_check).
quic_initial_keys early_keys
 RFC 8446 4.2.10 / RFC 9001 4.6.1: the 0-RTT packet-protection keys, meaningful only when early_data_accepted is 1.
u8 hs_secret [QUIC_HKDF_PRK]
 RFC 8446 7.1 Handshake Secret.
u8 s_hs_traffic [QUIC_HKDF_PRK]
 RFC 8446 7.1 server hs traffic secret.
int hs_ready
 hs_secret derived
quic_transcript tr
 RFC 8446 4.4.1 Transcript-Hash.
u8 odcid [20]
 RFC 9001 5.2 Initial-key derivation input: the DCID of the Initial packet actually being processed right now.
u8 odcid_len
 bytes used in odcid (0..20)
u8 iscid [20]
 RFC 9000 7.3 server SCID.
u8 iscid_len
 bytes used in iscid (0..20)
u8 tp_odcid [20]
 RFC 9000 7.3 original_destination_connection_id transport parameter value: the true first Initial's DCID.
u8 tp_odcid_len
 bytes used in tp_odcid (0..20)
u8 rscid [20]
 RFC 9000 7.3 retry_source_connection_id – the Retry packet's SCID, advertised only when a Retry preceded this handshake.
u8 rscid_len
 bytes used in rscid; 0 = no Retry
quic_stp_limits limits
 advertised tunable limits (0 = defaults)
u64 peer_max_datagram_frame_size
 peer's max_datagram_frame_size (0x20, RFC 9221 3) from the ClientHello transport parameters; 0 = not advertised (peer does not support DATAGRAM)
u64 peer_initial_max_data
 peer's initial_max_data (0x04, RFC 9000 18.2) from the ClientHello transport parameters – the connection-level credit this endpoint may send the peer, before any MAX_DATA update; 0 = absent (send nothing, the RFC's safe default)
u64 peer_initial_max_stream_data_bidi_local
 peer's initial_max_stream_data_bidi_local (0x05, RFC 9000 18.2): the TP sender's own locally-initiated streams' credit, i.e.
u64 peer_initial_max_stream_data_bidi_remote
 peer's initial_max_stream_data_bidi_remote (0x06, RFC 9000 18.2): the per-stream credit for bidi streams the REMOTE endpoint (this server) initiates toward the TP sender, e.g.
u64 peer_initial_max_stream_data_uni
 peer's initial_max_stream_data_uni (0x07, RFC 9000 18.2): the per-stream credit for uni streams this server opens toward the TP sender, e.g.
quic_salpn_choice alpn
 RFC 7301 3.1/3.2: this server's negotiated ALPN protocol (h3 preferred, hq-interop fallback), from the ClientHello's ALPN extension.
u16 cipher_suite
 RFC 8446 B.4 / RFC 9001 9.3: this server's negotiated TLS 1.3 cipher suite (AES_128_GCM_ SHA256 preferred, CHACHA20_POLY1305_SHA256 fallback), set by quic_sdrv_recv_client_hello.
u64 last_error
 RFC 9001 8.2: the CRYPTO_ERROR (0x0100 | TLS alert) recorded when quic_sdrv_recv_client_hello rejects the ClientHello – currently only set to missing_extension (RFC 8446 B.2: alert 109 = 0x6d, so 0x016d) when the quic_transport_parameters extension (0x39) is absent.
int hrr_needed
 RFC 8446 4.1.4: set by quic_sdrv_recv_client_hello when the ClientHello carried no x25519 key_share, meaning a HelloRetryRequest must be sent (quic_sdrv_build_hrr) instead of the normal server flight.
int hrr_sent
 1 once quic_sdrv_build_hrr has emitted a HelloRetryRequest for this connection; the next quic_sdrv_recv_client_hello call is then the post-HRR second ClientHello and must offer the same cipher_suite (RFC 8446 4.1.2) and gets its transcript message_hash-transformed (4.4.1).
u16 hrr_cipher_suite
 The cipher_suite negotiated from ClientHello1, recorded when hrr_sent becomes 1 so ClientHello2 can be checked against it.
u8 ch1_hash [32]
 RFC 8446 4.4.1: SHA-256(ClientHello1), computed when hrr_needed is set so quic_sdrv_build_hrr can fold the message_hash synthetic message into the transcript without keeping ClientHello1's raw bytes around.
quic_salpn_sni_outcome sni_outcome
 RFC 6066 3: the ClientHello's server_name extension checked against this driver's own certificate (quic_salpn_sni_check), set by quic_sdrv_recv_client_hello.

Detailed Description

Server-side handshake driver state.

Field Documentation

◆ alpn

quic_salpn_choice quic_sdrv::alpn

RFC 7301 3.1/3.2: this server's negotiated ALPN protocol (h3 preferred, hq-interop fallback), from the ClientHello's ALPN extension.

QUIC_SALPN_NONE if the client offered neither – the caller (server.c) must fail the handshake rather than proceed.

◆ cipher_suite

u16 quic_sdrv::cipher_suite

RFC 8446 B.4 / RFC 9001 9.3: this server's negotiated TLS 1.3 cipher suite (AES_128_GCM_ SHA256 preferred, CHACHA20_POLY1305_SHA256 fallback), set by quic_sdrv_recv_client_hello.

Governs ServerHello.cipher_suite and the Handshake/1-RTT key derivation and packet protection; Initial packet protection (RFC 9001 5.2) is unaffected and stays AES-128-GCM.

◆ early_data_accepted

int quic_sdrv::early_data_accepted

RFC 8446 4.2.10 / RFC 9001 4.6.1/9.2: set by quic_sdrv_recv_client_hello when the ClientHello carries early_data (0x002a) alongside an accepted pre_shared_key AND the presented ticket is on its first use (RFC 8446 8.1 single-use enforcement, quic_zerortt_seen_check).

A replayed ticket's early_data is refused (this stays 0) even though psk_accepted may still be 1 – 0-RTT alone is rejected, ordinary PSK/1-RTT resumption still proceeds.

◆ group

u16 quic_sdrv::group

RFC 8446 4.2.7 NamedGroup negotiated for the ECDHE key_share (QUIC_GROUP_X25519 or QUIC_GROUP_SECP256R1); QUIC_GROUP_X25519 unless quic_sdrv_set_group selects otherwise.

Governs how server_priv/ server_pub/client_pub are interpreted.

◆ hrr_needed

int quic_sdrv::hrr_needed

RFC 8446 4.1.4: set by quic_sdrv_recv_client_hello when the ClientHello carried no x25519 key_share, meaning a HelloRetryRequest must be sent (quic_sdrv_build_hrr) instead of the normal server flight.

Cleared once quic_sdrv_build_hrr has produced the HRR.

◆ last_error

u64 quic_sdrv::last_error

RFC 9001 8.2: the CRYPTO_ERROR (0x0100 | TLS alert) recorded when quic_sdrv_recv_client_hello rejects the ClientHello – currently only set to missing_extension (RFC 8446 B.2: alert 109 = 0x6d, so 0x016d) when the quic_transport_parameters extension (0x39) is absent.

0 when the last call succeeded.

◆ odcid

u8 quic_sdrv::odcid[20]

RFC 9001 5.2 Initial-key derivation input: the DCID of the Initial packet actually being processed right now.

After a Retry this is the Retry's own SCID (the client's second Initial is keyed off it), never the original DCID – mixing the two here breaks decryption of every post-Retry Initial.

◆ peer_initial_max_stream_data_bidi_local

u64 quic_sdrv::peer_initial_max_stream_data_bidi_local

peer's initial_max_stream_data_bidi_local (0x05, RFC 9000 18.2): the TP sender's own locally-initiated streams' credit, i.e.

what THIS endpoint may send on a client-initiated (HTTP/3 request) stream; 0 = absent

◆ peer_initial_max_stream_data_bidi_remote

u64 quic_sdrv::peer_initial_max_stream_data_bidi_remote

peer's initial_max_stream_data_bidi_remote (0x06, RFC 9000 18.2): the per-stream credit for bidi streams the REMOTE endpoint (this server) initiates toward the TP sender, e.g.

a server-opened WebTransport bidi stream; 0 = absent (send nothing until MAX_STREAM_DATA).

◆ peer_initial_max_stream_data_uni

u64 quic_sdrv::peer_initial_max_stream_data_uni

peer's initial_max_stream_data_uni (0x07, RFC 9000 18.2): the per-stream credit for uni streams this server opens toward the TP sender, e.g.

a server-opened WebTransport uni stream; 0 = absent.

◆ psk_accepted

int quic_sdrv::psk_accepted

RFC 8446 4.2.11/4.2.11.2: set by quic_sdrv_recv_client_hello when the ClientHello's pre_shared_key ticket opened under ticket_key and its binder verified.

psk_secret (the opened ticket's resumption secret) is only meaningful when this is 1.

◆ san_ipv4

u8 quic_sdrv::san_ipv4[4]

RFC 5280 4.2.1.6: see wired_srvboot_id.san_ipv4's doc.

All-zero (the zero-initialized default) means omit – 0.0.0.0 is never a real peer, so this needs no separate "is it set" flag.

◆ sni_outcome

quic_salpn_sni_outcome quic_sdrv::sni_outcome

RFC 6066 3: the ClientHello's server_name extension checked against this driver's own certificate (quic_salpn_sni_check), set by quic_sdrv_recv_client_hello.

QUIC_SALPN_SNI_ABSENT when the client sent no server_name (or it was malformed); this SDK's policy is to continue the handshake in every case (RFC 6066 3 leaves both a mismatch alert and silently continuing as valid server behavior) – the field is exposed so a caller (server.c) MAY choose to send unrecognized_name (QUIC_TLS_ALERT_UNRECOGNIZED_NAME) on QUIC_SALPN_SNI_MISMATCH instead.

◆ ticket_key

u8 quic_sdrv::ticket_key[QUIC_TICKET_KEY_LEN]

RFC 8446 4.6.1: this server's session-ticket encryption key, or has_ticket_key 0 to disable resumption entirely (pre_shared_key is then never inspected).

Set once at quic_sdrv_init from quic_sdrv_init_in.ticket_key.

◆ tp_odcid

u8 quic_sdrv::tp_odcid[20]

RFC 9000 7.3 original_destination_connection_id transport parameter value: the true first Initial's DCID.

Equal to odcid on the direct accept path; after a Retry it is the token-recovered original while odcid above has already moved on to the Retry's SCID.


The documentation for this struct was generated from the following file:
  • tls/handshake/core/sdrv/sdrv.h