TLS 1.3 session resumption ticket handling. More...
Go to the source code of this file.
Data Structures | |
| struct | qsc_tls_session_ticket |
Typedefs | |
| typedef struct qsc_tls_session_ticket | qsc_tls_session_ticket |
Functions | |
| QSC_EXPORT_API qsc_tls_status | qsc_tls_session_ticket_encode (const qsc_tls_session_ticket *ticket, uint8_t *output, size_t outlen, size_t *written) |
| Encode a TLS session ticket structure. | |
| QSC_EXPORT_API qsc_tls_status | qsc_tls_session_ticket_decode (const uint8_t *input, size_t inplen, qsc_tls_session_ticket *ticket) |
| Decode a TLS session ticket structure. | |
| QSC_EXPORT_API void | qsc_tls_session_ticket_dispose (qsc_tls_session_ticket *ticket) |
| Dispose of a TLS session ticket structure. | |
TLS 1.3 session resumption ticket handling.
MVP stub. Encoders and decoders return qsc_tls_status_not_supported until full resumption support is scheduled in a later milestone.
NewSessionTicket body layout per RFC 8446 4.6.1: uint32 ticket_lifetime; uint32 ticket_age_add; opaque ticket_nonce<0..255>; opaque ticket<1..2^16-1>; Extension extensions<0..2^16-2>;
This module encodes and decodes the body only (not the 4-byte handshake header). Extensions are written as an empty vector; a full implementation would add early_data (max_early_data_size) for 0-RTT-capable tickets.
The qsc_tls_session_ticket struct also carries the resumption PSK bytes derived by the peer after receiving the ticket. Those bytes are never encoded on the wire, they're computed locally from resumption_master_secret and the nonce via qsc_tls_keyschedule_derive_resumption_psk.
| QSC_EXPORT_API qsc_tls_status qsc_tls_session_ticket_decode | ( | const uint8_t * | input, |
| size_t | inplen, | ||
| qsc_tls_session_ticket * | ticket ) |
Decode a TLS session ticket structure.
Parses a binary-encoded session ticket and reconstructs the corresponding qsc_tls_session_ticket structure. The function validates field lengths, ensures internal consistency, and copies all ticket components into the supplied structure.
The input buffer must contain a complete and correctly formatted encoded ticket. Partial or malformed input will result in a failure status.
| input | [const uint8_t*] Pointer to the encoded session ticket buffer. |
| inplen | [size_t] Length, in bytes, of the encoded ticket buffer. |
| ticket | [qsc_tls_session_ticket*] Pointer to the structure that will receive the decoded ticket contents. |
| QSC_EXPORT_API void qsc_tls_session_ticket_dispose | ( | qsc_tls_session_ticket * | ticket | ) |
Dispose of a TLS session ticket structure.
Clears and zeroizes all sensitive fields within a qsc_tls_session_ticket structure, including the resumption secret, ticket identity, nonce, and any associated metadata. This function should be called when the ticket is no longer required to prevent retention of sensitive material in memory.
The structure remains valid for reuse after disposal but must be reinitialized before use.
| ticket | [qsc_tls_session_ticket*] Pointer to the session ticket structure to dispose. |
| QSC_EXPORT_API qsc_tls_status qsc_tls_session_ticket_encode | ( | const qsc_tls_session_ticket * | ticket, |
| uint8_t * | output, | ||
| size_t | outlen, | ||
| size_t * | written ) |
Encode a TLS session ticket structure.
Serializes a qsc_tls_session_ticket structure into a compact binary form suitable for storage or transport. The encoded form contains the ticket identity, nonce, lifetime, age-add value, associated cipher suite, and the derived resumption secret. All multi-byte fields are encoded in network byte order.
The caller is responsible for providing a buffer of sufficient size. The function does not perform dynamic allocation and will fail if the output buffer is too small to contain the serialized ticket.
| ticket | [const qsc_tls_session_ticket*] Pointer to the session ticket structure to encode. |
| output | [uint8_t*] Pointer to the destination buffer that will receive the encoded ticket. |
| outlen | [size_t] Size, in bytes, of the destination buffer. |
| written | [size_t*] Pointer receiving the number of bytes written to output. |