nish/net/tls

The server side of a TLS 1.3 handshake (RFC 8446), from the client's first ClientHello to its Finished, carrier-agnostic and sans-IO.

import {
  TLS_LEVEL_APPLICATION,
  TLS_LEVEL_HANDSHAKE,
  TLS_LEVEL_INITIAL,
  TLS_MAX_HANDSHAKE_MESSAGE,
  TLS_SECRET_BINDER_KEY,
  TLS_SECRET_CLIENT_APPLICATION,
  TLS_SECRET_CLIENT_FINISHED,
  TLS_SECRET_CLIENT_HANDSHAKE,
  TLS_SECRET_EARLY,
  TLS_SECRET_EXPORTER,
  TLS_SECRET_HANDSHAKE,
  TLS_SECRET_PSK,
  TLS_SECRET_RESUMPTION,
  TLS_SECRET_SERVER_APPLICATION,
  TLS_SECRET_SERVER_HANDSHAKE,
  TLS_SECRET_TO_BE_SIGNED,
  TLS_STATE_CONNECTED,
  TLS_STATE_FAILED,
  TLS_STATE_WAIT_CLIENT_HELLO,
  TLS_STATE_WAIT_FINISHED,
  TLS_STATE_WAIT_SIGNATURE,
  TLS_STATE_WAIT_TICKET,
  TlsP256Signer,
  TlsSecretPool,
  TlsServer,
  TlsServerConfig,
  tlsEcdsaDerSignature,
  tlsHeldClone,
  tlsHeldCopyIn,
  tlsHeldCopyOver,
  tlsIsZeroSecret,
  tlsSignEcdsaP256,
  tlsZeroHeld,
} from "nish/net/tls";
import { TlsServer, TLS_LEVEL_INITIAL } from "nish/net/tls";

const server = new TlsServer(config, serverRandom, x25519Private);
const alert: i32 = server.receive(TLS_LEVEL_INITIAL, bytes, 0, n);
// …and for the slot's next connection:
server.restart(nextRandom, nextPrivate);
// send server.takeOutput(TLS_LEVEL_INITIAL), install the handshake
// secrets, sign server.signatureInput(), call server.sign(signature), …
Carrier-agnostic

The server reads and writes handshake messages, not records or packets. Bytes go in and come out tagged with the level they belong to — Initial (cleartext: ClientHello, ServerHello), Handshake (EncryptedExtensions through both Finished messages) or Application — and the secrets for each level are readable as soon as they are known. TLS over TCP (WP34 T2) wraps a level's bytes in records protected under that level's secret; QUIC (Q2) puts them in CRYPTO frames of the matching packet number space (RFC 9001 §4.1.3). Neither needs anything else from here.

Sans-IO

Nothing here reads a socket, a clock or the random device. The server random and the ephemeral private key (32 bytes, the x25519 key or, its top bit cleared, the secp256r1 scalar) are constructor arguments, so a test injects RFC 8448's and a server draws them with crypto.getRandomValues. Signing is handed off the same way: once the Certificate is written the server stops at TLS_STATE_WAIT_SIGNATURE, the caller signs signatureInput() with its own key (tlsSignEcdsaP256 for a P-256 key) and hands the signature to sign. That keeps the private key out of this module, and it lets RFC 8448's trace, which signs with RSA-PSS, be replayed with its own signature.

What is negotiated

TLS 1.3 only. The suites TLS_AES_128_GCM_SHA256, TLS_CHACHA20_POLY1305_SHA256 and TLS_AES_256_GCM_SHA384, the first of them the client lists; the group x25519 whenever the client lists it, and secp256r1 for a client that lists only that; the configuration's one signature scheme. A client that lists the chosen group in supported_groups without a share for it gets one HelloRetryRequest (§4.1.4), and a second ClientHello still without the share is refused. A secp256r1 share must be an uncompressed point on the curve (§4.2.8.2); any other is illegal_parameter. server_name is read and exposed as serverName. ALPN picks the first of the configuration's protocols the client offers. quic_transport_parameters is read and written only when the configuration says the carrier is QUIC. 0-RTT and client authentication are not here: an early-data offer is ignored.

Resumption

A server the carrier calls enableTickets on, over TCP only, resumes with a session ticket in psk_dhe_ke mode (RFC 8446 §2.2, §4.2.11) and issues one after each handshake. The ticket keys and the strike register are the program's, lent to each call and never kept: a ClientHello that offers a ticket stops at TLS_STATE_WAIT_TICKET, and resume reads the identities in the client's order, verifies the binder of the one it selects, records its id, and answers a resumed flight — or a full handshake when no identity can be used (docs/security/tls.md, "Resumption").

Once connected, issue writes one NewSessionTicket at the Application level. Sealing draws the ticket's nonce and issue the ticket_age_add from the random device; nothing else here does. Over QUIC the hand-off is never called, so a PSK offer gets a full handshake.

Refusals are alerts. receive and sign answer 0 or a TLS alert description (TLS_ALERT_* in nish/net/tls/codec); after one the server is in TLS_STATE_FAILED and answers the same alert to every call. Nothing the peer sends can make it panic.

Secrets

Every secret the server holds is a Secret (nish:secret): the ECDHE secret and the words it is computed in, wiped on every path; the ephemeral key, copied into the ephemeral field by restart with the caller's array zeroed; and the handshake, traffic, exporter and resumption secrets, and a resumed handshake's PSK, early secret and binder key, fields of the two TlsSecretPools, read only inside expose.

wipe zeroes them all, and restart calls it before the next connection; the carriers call it when a connection ends, and wipeSecret and wipeEphemeral as each secret's work is done. fail wipes the resumption master secret and the PSK's secrets, and issue the resumption master secret once the ticket is sealed (CLAUDE.md §Security; TLS-1 in docs/security/tls.md).

Memory

A TlsServer keeps its state in buffers it allocates once — the messages in and out, the transcript, the secrets, the HKDF scratch — and restart hands them to the next connection, so a carrier that keeps one per slot runs every handshake after the first without moving the arena (TLS-3; tests/link/net_tls_memory). What a message allocates on the way dies inside a using a = arena() block or an arena scope of its own.

The state is a class and a switch, with no closures. Written from RFC 8446, RFC 7301, RFC 6066 and RFC 9001, not ported from another implementation.

Functions

tlsEcdsaDerSignature

An ECDSA signature r || s (32 bytes each, as nish/crypto/p256 answers it) as the DER ECDSA-Sig-Value a CertificateVerify carries (RFC 8446 §4.2.3), or null when rs is not 64 bytes.

const tlsEcdsaDerSignature: (rs: u8[]) => u8[] | null
rsu8[]required

The signature's r then s, 32 big-endian bytes each.

returnsu8[] | null

A fresh array of 8 to 72 bytes holding the DER encoding, or null.

tlsHeldClone

A plain copy of a held secret, for a derivation that runs on its bytes inside a using arena() block: the copy dies with the block, and its caller secureZeros it before the block ends.

const tlsHeldClone: (held: u8[]) => u8[]
heldu8[]required

The exposed bytes to copy.

returnsu8[]

A fresh plain array of the same length, which the caller must wipe.

tlsHeldCopyIn

Overwrites the bytes a Secret holds with from's, for exposeWith to run on the destination. Only as many bytes as the shorter of the two holds are copied; the rest of held is left as it was.

const tlsHeldCopyIn: (held: u8[], from: u8[]) => i32
heldu8[]required

The destination's exposed bytes, written in place.

fromu8[]required

The bytes to copy in, read from index 0.

returnsi32

tlsHeldCopyOver

Copies the bytes one Secret holds over another's, for exposeWith to run on the source with the destination as its argument: no plain copy is made on the way. Answers 0.

const tlsHeldCopyOver: (from: u8[], to: Secret<u8[]>) => i32
fromu8[]required

The source's exposed bytes.

toSecret<u8[]>required

The destination secret, borrowed; as many bytes as the shorter of the two holds are overwritten.

returnsi32

tlsIsZeroSecret

Whether an x25519 shared secret is all zeros, reading every byte (run inside expose).

const tlsIsZeroSecret: (shared: u8[]) => boolean
sharedu8[]required

The exposed shared secret, X25519_SIZE bytes.

returnsboolean

True when every byte is zero (a low-order peer share, RFC 7748 §6.1), which the handshake refuses.

tlsSignEcdsaP256

Signs a CertificateVerify input for ecdsa_secp256r1_sha256 with the P-256 private key priv: p256SignSha256 (RFC 6979's deterministic nonce), DER encoded. null for a malformed key. The answer is what TlsServer.sign takes. The key is borrowed, as every Secret parameter is: the caller made it, and wipes it.

const tlsSignEcdsaP256: (
  priv: Secret<u8[]>,
  content: u8[],
) => u8[] | null
privSecret<u8[]>required

The server's P-256 private key, borrowed.

contentu8[]required

The CertificateVerify input, as TlsServer.signatureInput answers it.

returnsu8[] | null

A fresh array holding the DER signature, or null for a malformed key.

tlsZeroHeld

Wipes the bytes a Secret holds, for exposeWith to run on one secret of a holder outside its wipe().

const tlsZeroHeld: (held: u8[], answer: i32) => i32
heldu8[]required

The exposed bytes, zeroed in place.

answeri32required

The value to hand back, so a caller can wipe and answer in one expression.

returnsi32

answer, unchanged.

Classes

TlsP256Signer

Signs CertificateVerify inputs for ecdsa_secp256r1_sha256 with nothing kept per signature: tlsSignEcdsaP256's answer, made in a P256SignScratch and handed back in one of this signer's own arrays, one per DER length (8 to 72 bytes), since TlsServer.sign takes the signature's length from its array and stores what it computes, so a signature it is handed cannot be a temporary. A carrier keeps one signer, not one per slot: signing is synchronous, and the array it answers is read by sign before the next signature replaces it.

class TlsP256Signer
Member
new TlsP256Signer() Makes the signer's scratch and one signature array per DER length, so a signature keeps nothing: the P-256 step releases what it allocates per call, and the DER is written into one of these arrays.
sign(priv: Secret<u8[]>, content: u8[]): u8[] | null tlsSignEcdsaP256(priv, content), byte for byte, in the array of this signer's that has its length; null for a malformed key. It keeps nothing: the P-256 signature releases what it allocated, and the DER is written in place. The key is borrowed.

TlsSecretPool

The secrets of one connection under one hash, as TlsServer holds them in secrets256 and secrets384: an array of exactly hashLength bytes for each, allocated once and reused by every connection. The ten the key schedule derives are Secrets (nish:secret), read only inside expose and wiped by wipe, so the checker proves no copy of them leaves the pool and that wipe reaches every one. The expected client Finished and the CertificateVerify input are what the wire carries, and stay plain; wipe zeroes them too (TLS-1).

class TlsSecretPool
Member
new TlsSecretPool(hashLength: i32) Allocates every array of the pool once, all zero, so a connection never allocates one for a secret.
readonly binderKey: Secret<u8[]> The binder key, from the selected ticket's early secret.
readonly clientApplication: Secret<u8[]> client_application_traffic_secret_0 (RFC 8446 §7.1), hash-length bytes; read it inside expose.
clientFinished: u8[] The client Finished's verify_data, known once the server's Finished is written.
readonly clientHandshake: Secret<u8[]> client_handshake_traffic_secret (RFC 8446 §7.1), hash-length bytes; read it inside expose.
readonly early: Secret<u8[]> The PSK early secret, on a resumed handshake only.
readonly exporter: Secret<u8[]> exporter_master_secret (RFC 8446 §7.5), for a caller's own exporters.
readonly handshake: Secret<u8[]> handshake_secret (RFC 8446 §7.1), hash-length bytes; read it inside expose.
readonly psk: Secret<u8[]> The PSK the selected ticket opened to, on a resumed handshake only.
readonly resumption: Secret<u8[]> resumption_master_secret (RFC 8446 §7.1), derived by sign and the connection's once the client's Finished is accepted: what a NewSessionTicket's PSK would be derived from.
readonly serverApplication: Secret<u8[]> server_application_traffic_secret_0 (RFC 8446 §7.1), hash-length bytes; read it inside expose.
readonly serverHandshake: Secret<u8[]> server_handshake_traffic_secret (RFC 8446 §7.1), hash-length bytes; read it inside expose.
toBeSigned: u8[] The CertificateVerify input, 98 bytes longer than the rest.

TlsServer

One TLS 1.3 server handshake. Make one per connection, or one per slot and restart it for each connection the slot takes; feed it what the client sends with receive, send what takeOutput answers (or what the output buffers hold, for a carrier that reads them in place), and sign when the state says so.

The fields are readable: state and alert, the negotiated suite, serverName, alpn and the client's clientTransportParameters, and the held bits of the secrets derived so far. The secrets themselves are Secret fields of secrets(), read through expose; readKnown and writeKnown say whether the traffic secrets of a level are known yet.

What it allocates. Everything it keeps is allocated by the constructor and reused by restart: the input and output buffers, the transcript's hashers, the HKDF scratch, the ephemeral key's 32 bytes, and HashLen bytes for every secret under each hash, which each derivation writes over in place and wipe zeroes before the next connection starts. receive and sign do their work inside using a = arena() blocks, so the compiler has proved that what they allocate on the way dies before they return.

Four things grow or are made outside those blocks: the input buffer, doubled up to the largest message when a ClientHello does not fit (once per slot); the Handshake-level output, when a signature is longer than an ECDSA one; the serverName string, made when the client's host name differs from the last one this server held; and, over QUIC only, the array the client's transport parameters are copied into, which grows only when a client's are longer than any before (TLS-3).

class TlsServer
Member
new TlsServer(config: TlsServerConfig, serverRandom: u8[], ephemeralPrivate: u8[]) A server for one connection under config, with the 32-byte server random and the 32-byte ephemeral private key drawn for it. A random or key of another length, or a configuration tlsConfigFits refuses, leaves the server failed with internal_error before it reads anything.
alert: i32 The alert the server failed with, or 0.
alpn: string The ALPN protocol chosen, one of the configuration's, or empty.
clientTransportParameters: u8[] The client's quic_transport_parameters, opaque; empty unless the carrier is QUIC.
config: TlsServerConfig The configuration this server was built with: its certificate chain, ALPN list and QUIC transport parameters.
readonly ephemeral: Secret<u8[]> The connection's 32-byte ephemeral private key (x25519, or the secp256r1 scalar with its top bit cleared), copied in by restart and wiped by the record layer once the ServerHello is written.
exchange: TlsExchangeWords The exchange's words (tlsExchange).
group: i32 The key exchange group: TLS_GROUP_X25519 or TLS_GROUP_SECP256R1 once the ClientHello chose it or a HelloRetryRequest asked for it, 0 before.
held: i32 Which of the negotiated pool's secrets the handshake has derived: bit 1 << TLS_SECRET_* for each. A secret wiped by wipeSecret keeps its bit, since its place is still the one it was derived into.
input: u8[] The bytes received at the current level and not yet a whole message: input[0 .. inputLength).
issuing: TlsTicketState What issue seals; its PSK is zeroed once sealed.
opened: TlsTicketState What the ticket resume is reading opened to; its PSK is zeroed once read.
peerRecordSizeLimit: i32 The client's record_size_limit (RFC 8449): the most plaintext, content type and padding included, a protected record to it may carry, from TLS_RECORD_SIZE_LIMIT_MIN to TLS_RECORD_SIZE_LIMIT_MAX. 0 when the client sent none, and always over QUIC, which has no TLS records.
resumed: boolean Whether this connection resumed a ticket (row 1 of the record's table).
retried: boolean Whether a HelloRetryRequest was sent, so a second miss is fatal.
salt: u8[] The salt the handshake secret is extracted under, HashLen bytes of it: the TLS_DERIVED_SALT_* constant on a full handshake, derived from the PSK early secret on a resumed one. exchangeKeys reads it into the exchange's words and zeroes it.
secrets256: TlsSecretPool The secrets under each hash (TlsSecretPool); secrets() answers the negotiated hash's.
secrets384: TlsSecretPool The secrets under SHA-384, for TLS_AES_256_GCM_SHA384.
serverName: string The client's host_name, or empty.
state: i32 Where the handshake stands: one of the TLS_STATE_* constants, TLS_STATE_CONNECTED once it is done and TLS_STATE_FAILED after an alert.
suite: i32 The negotiated cipher suite, or 0 before the first ClientHello is read.
tickets: boolean Whether the carrier turned resumption on with enableTickets; kept across restart.
enableTickets(): void Turns resumption on: from the next ClientHello, a hello offering a ticket in psk_dhe_ke waits in TLS_STATE_WAIT_TICKET for resume, and a connection whose client lists psk_dhe_ke may be issued a ticket by issue. Kept across restart. A QUIC server never resumes, so on one this does nothing.
issue(key: Secret<u8[]>, info: TlsTicketKeyInfo, now: i64): boolean Once the handshake is done, at most once a connection: seals a ticket for it under key, which info describes, and writes the NewSessionTicket carrying it at the Application level, for the carrier to send under the server's application keys. Answers whether one was written: none is when tickets are off, the client did not list psk_dhe_ke, or the key does not seal. On a connected connection's first call the resumption master secret is wiped before it returns, written or not, so a carrier that issues no ticket still calls this, or wipeResumption.

Before the handshake is done, or on a second call, it answers false and touches nothing: a secret wiped then would leave no ticket to issue, and one wiped already has nothing left to wipe.
known(index: i32): boolean Whether the handshake has derived secret index (TLS_SECRET_*) for this connection.
readKnown(level: i32): boolean Whether the secret the server reads level under — the client's traffic secret, clientHandshake or clientApplication of secrets() — is known yet. The Initial level has none: it is cleartext in TLS, and QUIC derives its own from the connection id.
receive(level: i32, data: u8[], off: i32, len: i32): i32 Takes the handshake bytes data[off .. off + len) the client sent at level, a whole message, part of one or several, and handles every message they complete. Answers 0, or the alert the server fails with.

A level other than the one the state expects is unexpected_message, as is a byte left over once a message ends the client's flight: each of the three messages a client sends here (two ClientHellos and a Finished) is the last of its flight, and RFC 8446 §5.1 forbids a message to straddle a key change. A window outside data is internal_error, the caller's fault and not the peer's. Once the handshake is done, any further bytes are unexpected_message too: the post-handshake messages a client may send (KeyUpdate) belong to the record layer, which handles them itself.
restart(serverRandom: u8[], ephemeralPrivate: u8[]): void Starts the next connection in this server's buffers, with its own 32-byte random and ephemeral private key, as a fresh TlsServer would: every secret the last connection left is wiped (wipe) and none is held. The random is kept, as the constructor keeps it; the key is copied into ephemeral and the caller's array zeroed with secureZero, so the only copy left is the one the server wipes. A random or key of another length, or a configuration tlsConfigFits refused, leaves the server failed with internal_error.
resume(current: Secret<u8[]>, currentInfo: TlsTicketKeyInfo, previous: Secret<u8[]>, previousInfo: TlsTicketKeyInfo, strikes: TlsTicketStrikes, now: i64): i32 In TLS_STATE_WAIT_TICKET: reads the hello's tickets under the keys the carrier lends, current and previous with what each info says of them (a program with one key passes it as both), records the one it resumes in strikes, and answers the hello, resumed or in full, as the table of "Resumption" in docs/security/tls.md says. A selected ticket whose binder fails is decrypt_error, with nothing recorded (row 9). Answers 0, or the alert the server fails with.
secrets(): TlsSecretPool The pool of the negotiated hash: SHA-384's for a SHA-384 suite, SHA-256's otherwise.
sign(signature: u8[]): i32 Takes the signature over signatureInput(), as it goes on the wire (DER for ECDSA), and writes CertificateVerify and the server's Finished, after which the application secrets are known. Answers 0, or internal_error when called in another state or with an empty or over-long signature. The signature is not checked here: a wrong one is the caller's bug, and the client's verification is what catches it.
signatureInput(): u8[] | null What CertificateVerify signs (RFC 8446 §4.4.3), while the state is TLS_STATE_WAIT_SIGNATURE; null at any other time.
takeOutput(level: i32): u8[] The handshake bytes written at level since the last call, in a fresh array, and forgets them. Bytes are only ever written at a level whose secrets are already known, so a carrier that installs keys as they appear can always protect what this answers. A carrier that reads the output buffers in place (the record server and QUIC, inside the standard library) forgets them with clearOutput instead, and allocates nothing.
wipe(): void Wipes every secret the server holds: the ephemeral key and both pools. restart calls it, and the carriers when a connection ends.
wipeEphemeral(): void Zeroes the ephemeral key, which the record layer does once the ServerHello is written: not while a hello that offers a ticket waits for resume, whose exchange still needs it.
wipeResumption(): void Wipes the resumption master secret, which sign derives ahead of the client's Finished. issue calls it once the ticket is sealed, and the carrier when a connection ends, closed or failed, without one (TLS-1).
wipeSecret(index: i32): void Zeroes secret index of secrets() once a carrier has taken what it needs from it; it stays known.
writeKnown(level: i32): boolean Whether the secret the server writes level under — serverHandshake or serverApplication — is known yet.

Interfaces

TlsServerConfig

What a server is configured with, the same for every connection. An interface, so a caller writes it as an object literal.

interface TlsServerConfig
Member
alpn: string[] The ALPN protocols the server speaks, most preferred first. Empty means the server does not negotiate ALPN over TCP, and refuses every client over QUIC, where ALPN is mandatory (RFC 9001 §8.1).
certificateChain: u8[][] DER certificates, leaf first. At least one.
extraExtensions: u8[] Extensions this module does not interpret, already encoded (each a type, a length and a body), written first in EncryptedExtensions. Empty for none. Not for ALPN, server_name or quic_transport_parameters, which the server writes itself: a client refuses a repeated extension. A record_size_limit here replaces the one the server would write.
quic: boolean Whether the carrier is QUIC, which turns quic_transport_parameters on both ways.
quicTransportParameters: u8[] The server's transport parameters, opaque, sent in EncryptedExtensions only when quic.
signatureScheme: i32 The signature scheme the caller's key signs with, sent in CertificateVerify: TLS_SIGNATURE_ECDSA_SECP256R1_SHA256 for a P-256 key. A client that does not list it is refused with handshake_failure.

Limits

65,536

TLS_MAX_HANDSHAKE_MESSAGE: i32

The longest handshake message accepted, in bytes. A ClientHello carrying a post-quantum share is a few kilobytes; nothing a client sends a TLS 1.3 server comes near this, and the cap is what bounds the buffer a peer can make the server hold.

Constants

2

TLS_LEVEL_APPLICATION: i32

Under the application traffic secrets: the one NewSessionTicket issue writes.

1

TLS_LEVEL_HANDSHAKE: i32

Under the handshake traffic secrets: EncryptedExtensions through both Finished messages.

0

TLS_LEVEL_INITIAL: i32

Cleartext: ClientHello, HelloRetryRequest and ServerHello (QUIC's Initial packets).

11

TLS_SECRET_BINDER_KEY: i32

The binder key (§4.2.11.2), held until the binder is compared.

3

TLS_SECRET_CLIENT_APPLICATION: i32

client_application_traffic_secret_0 (RFC 8446 §7.1): the client's first application keys.

6

TLS_SECRET_CLIENT_FINISHED: i32

The client Finished's expected verify_data (RFC 8446 §4.4.4), plain, since the wire carries it.

1

TLS_SECRET_CLIENT_HANDSHAKE: i32

client_handshake_traffic_secret (RFC 8446 §7.1): the client's Handshake-level keys.

10

TLS_SECRET_EARLY: i32

The PSK early secret (RFC 8446 §7.1), held until the handshake secret's salt is derived from it.

5

TLS_SECRET_EXPORTER: i32

exporter_master_secret (RFC 8446 §7.5), for a caller's own exporters.

0

TLS_SECRET_HANDSHAKE: i32

Which secret of a TlsSecretPool an index names: what TlsServer.known, wipeSecret and the pool's zero take, and the bit of TlsServer.held that says the secret is derived (1 << index).

9

TLS_SECRET_PSK: i32

The PSK a ticket opened to, held from the binder's check to the early secret's extract.

8

TLS_SECRET_RESUMPTION: i32

resumption_master_secret (RFC 8446 §7.1), what a NewSessionTicket's PSK is derived from.

4

TLS_SECRET_SERVER_APPLICATION: i32

server_application_traffic_secret_0 (RFC 8446 §7.1): the server's first application keys.

2

TLS_SECRET_SERVER_HANDSHAKE: i32

server_handshake_traffic_secret (RFC 8446 §7.1): the server's Handshake-level keys.

7

TLS_SECRET_TO_BE_SIGNED: i32

The CertificateVerify input sits beside them: 98 bytes and the transcript hash.

3

TLS_STATE_CONNECTED: i32

The client's Finished verified. Application data may flow both ways.

4

TLS_STATE_FAILED: i32

An alert was answered; alert holds it, and every later call answers it again.

0

TLS_STATE_WAIT_CLIENT_HELLO: i32

Waiting for a ClientHello at the Initial level, the first or the one after a HelloRetryRequest.

2

TLS_STATE_WAIT_FINISHED: i32

The server's flight is written; waiting for the client's Finished at the Handshake level.

1

TLS_STATE_WAIT_SIGNATURE: i32

The Certificate is written; signatureInput() is ready and sign is due.

5

TLS_STATE_WAIT_TICKET: i32

A ClientHello offered a ticket to a server with tickets on; resume is due, with the keys and the strike register.