Skip to main content
Version: Next

TLS component

The NoxTLS TLS component implements Transport Layer Security (TLS) and Datagram TLS (DTLS) for secure client and server connections over callback-based I/O (sockets, custom transports, or test harnesses).

Default build profile: TLS 1.2 and 1.3, plus DTLS 1.2 and 1.3. TLS 1.0 and 1.1 remain available when enabled in noxtls_config.h (NOXTLS_FEATURE_TLS10, NOXTLS_FEATURE_TLS11).

Protocol overview

ProtocolWire versionsDefault buildPrimary APIs
TLS 1.20x0303Ontls12, unified
TLS 1.30x0304Ontls13, unified
TLS 1.0 / 1.10x0301 / 0x0302Offtls10, tls11
DTLS 1.20xFEFDOndtls12 via noxtls_dtls12_context_init
DTLS 1.30xFEFCOndtls13 via noxtls_dtls13_context_init

TLS 1.3 features

AreaSupport
Full handshake (1-RTT)Client and server
HelloRetryRequestSupported
KeyUpdateSend and receive
Session resumptionNewSessionTicket, PSK binder, external PSK
0-RTT early dataClient and server paths (some edge cases still under test)
PSK modespsk_ke, psk_dhe_ke (ECDHE-PSK)
Client authentication (mTLS)RSA, ECDSA, Ed25519, Ed448, ML-DSA (feature-gated)
ALPNOffer, select, and verify
SNIClient send and server validation
Record Size Limit (RFC 8449)Negotiation and send chunking
Channel bindings (RFC 5929)tls-unique style export API
Signature algorithmsRSA-PSS, ECDSA (P-256/P-384/P-521), Ed25519
Named groupsX25519, X448, FFDHE (RFC 7919), optional ML-KEM / hybrids

TLS 1.2 features

AreaSupport
Cipher suitesECDHE-RSA, ECDHE-ECDSA, DHE-RSA, RSA key transport, AES-GCM, AES-CBC, AES-CCM, ChaCha20-Poly1305, ARIA
Secure renegotiation (RFC 5746)renegotiation_info and fallback SCSV handling
Encrypt-then-MAC (RFC 7366)Negotiated and applied on record layer
Extended Master Secret (RFC 7627)Offer, negotiation, session/ticket binding
Session tickets (RFC 5077)ServerHello echo, NewSessionTicket, cache hooks
Maximum fragment length (RFC 6066)noxtls_tls12_set_max_fragment_length
SNI, ALPNSame extension framework as TLS 1.3 stack
Raw public keys (RFC 7250)Certificate type negotiation
OCSP stapling (RFC 6066)Client status_request, server CertificateStatus send/receive
Heartbeat (RFC 6520)Extension and record handling (conformance still improving)

DTLS 1.2 features (RFC 6347)

AreaSupport
Record layer13-byte header, epoch and 48-bit sequence
HandshakeFragmentation and reassembly
Loss recoveryRetransmission timer, flight buffers
DoS mitigationHelloVerifyRequest cookie (generate/verify)
Replay protectionSliding window per epoch
Configurationnoxtls_dtls_set_mtu, dtls_set_retransmit, anti-amplification limit

Initialize with noxtls_dtls12_context_init, then use the same noxtls_tls12_connect / noxtls_tls12_accept and send/recv APIs as for TLS over TCP.

DTLS 1.3 features (RFC 9147)

DTLS 1.3 shares the TLS 1.3 handshake and cipher suites but uses a datagram record layer. NoxTLS implements the following (see also the DTLS 1.3 guide):

AreaSupport
Key scheduleHKDF labels use the dtls13 prefix (not tls13)
ClientHelloEmpty legacy_session_id, zero-length legacy_cookie in first flight
Unified record headerConnection ID bit, sequence number length bit, optional length field
Record number protectionTruncated on wire, reconstructed before AEAD
Replay detectionPer low epoch; benign epoch mismatch discarded
Handshake reassemblyOverlap checks, bounded future-message queue
ACK recordsParse ACK ranges; retransmit skips acknowledged records
RetransmissionRTT-based timer when ACKs available; final-flight ACK retention (2 MSL window)
Connection IDRequestConnectionId / NewConnectionId APIs, spare CID pool, rotation hooks
KeyUpdateIndependent read/write epoch tracking across epoch wrap
Short tagsCCM_8 suites padded before AEAD when tag length < 16 bytes
MTU-aware fragmentationHandshake fragment size accounts for unified header overhead

Initialize with noxtls_dtls13_context_init. Configure the shared DTLS base via DTLS API (MTU, retransmit, ACK range limit).

Interoperability note

DTLS 1.3 wire format and key derivation changed to align with RFC 9147. Peers built before this alignment are not interoperable with RFC 9147-conformant builds.

Extensions and security properties (summary)

RFCFeatureTLS 1.2TLS 1.3DTLS
5746Secure renegotiationYesN/AN/A
6066SNIYesYesYes
6066Max fragment lengthYes
6066OCSP staplingYesPartial / planned
7366Encrypt-then-MACYesN/AN/A
7627Extended Master SecretYesN/AN/A
5077Session ticketsYesYesYes (TLS 1.3 path)
7301ALPNYesYesYes
8449Record size limitYesYes
9146 / 9147Connection IDDTLS 1.3
6520HeartbeatPartial
7250Raw public keysYes

Extension constants exist for SCT, certificate compression, delegated credentials, and token binding; dedicated handling is not yet complete. See the TLS RFC feature analysis in the repository for a full matrix.

Post-quantum TLS (experimental)

When NOXTLS_FEATURE_ML_KEM and NOXTLS_FEATURE_ML_DSA are enabled:

  • TLS 1.3 key shares: ML-KEM-768 / ML-KEM-1024 and X25519+ML-KEM hybrids (private-use code points).
  • TLS 1.3 signatures: ML-DSA-65 / ML-DSA-87 and RSA+ML-DSA composites.

See Quantum crypto, TLS 1.3 PQC, ML-KEM, and ML-DSA.

Architecture

Typical usage

TLS client (TLS 1.2 or 1.3)

  1. noxtls_tls12_context_init or noxtls_tls13_context_init.
  2. noxtls_tls_set_io_callbacks.
  3. Optional SNI on ctx->server_name / server_name_len.
  4. Optional client cert: noxtls_tls13_set_client_cert (or ECDSA / Ed25519 / ML-DSA variants).
  5. noxtls_tls12_connect or noxtls_tls13_connect.
  6. noxtls_tls12_send / noxtls_tls12_recv or TLS 1.3 equivalents.
  7. noxtls_tls12_close and context free.

TLS server

  1. Initialize context, set I/O, load DER certificate and private key (RSA via noxtls_tls12_set_server_private_rsa or noxtls_tls13_set_server_private_rsa; ECDSA via noxtls_tls*_set_server_private_ecdsa).
  2. noxtls_tls12_accept or noxtls_tls13_accept.

Unified API (TLS 1.2 + 1.3 auto-negotiation)

Use noxtls_tls_connection_t for one handle per TCP connection:

DTLS client or server

  1. noxtls_dtls12_context_init or noxtls_dtls13_context_init.
  2. noxtls_dtls_set_mtu and dtls_set_retransmit on ctx->base (DTLS base inside the TLS context).
  3. noxtls_tls13_connect / noxtls_tls13_accept (or TLS 1.2 equivalents for DTLS 1.2).
  4. Application data via noxtls_tls13_send / noxtls_tls13_recv.

Interoperability testing

HarnessPurpose
tlsfuzzerScripted negative and edge-case tests — see tlsfuzzer-script-status.md in the repo

Configuration

API reference

Sample applications