Go to the documentation of this file.
35 #ifndef TLS13_DHE_KE_SUPPORT
36 #define TLS13_DHE_KE_SUPPORT ENABLED
37 #elif (TLS13_DHE_KE_SUPPORT != ENABLED && TLS13_DHE_KE_SUPPORT != DISABLED)
38 #error TLS13_DHE_KE_SUPPORT parameter is not valid
42 #ifndef TLS13_ECDHE_KE_SUPPORT
43 #define TLS13_ECDHE_KE_SUPPORT ENABLED
44 #elif (TLS13_ECDHE_KE_SUPPORT != ENABLED && TLS13_ECDHE_KE_SUPPORT != DISABLED)
45 #error TLS13_ECDHE_KE_SUPPORT parameter is not valid
49 #ifndef TLS13_MLKEM_KE_SUPPORT
50 #define TLS13_MLKEM_KE_SUPPORT DISABLED
51 #elif (TLS13_MLKEM_KE_SUPPORT != ENABLED && TLS13_MLKEM_KE_SUPPORT != DISABLED)
52 #error TLS13_MLKEM_KE_SUPPORT parameter is not valid
56 #ifndef TLS13_HYBRID_KE_SUPPORT
57 #define TLS13_HYBRID_KE_SUPPORT DISABLED
58 #elif (TLS13_HYBRID_KE_SUPPORT != ENABLED && TLS13_HYBRID_KE_SUPPORT != DISABLED)
59 #error TLS13_HYBRID_KE_SUPPORT parameter is not valid
63 #ifndef TLS13_PSK_KE_SUPPORT
64 #define TLS13_PSK_KE_SUPPORT DISABLED
65 #elif (TLS13_PSK_KE_SUPPORT != ENABLED && TLS13_PSK_KE_SUPPORT != DISABLED)
66 #error TLS13_PSK_KE_SUPPORT parameter is not valid
70 #ifndef TLS13_PSK_DHE_KE_SUPPORT
71 #define TLS13_PSK_DHE_KE_SUPPORT ENABLED
72 #elif (TLS13_PSK_DHE_KE_SUPPORT != ENABLED && TLS13_PSK_DHE_KE_SUPPORT != DISABLED)
73 #error TLS13_PSK_DHE_KE_SUPPORT parameter is not valid
77 #ifndef TLS13_PSK_ECDHE_KE_SUPPORT
78 #define TLS13_PSK_ECDHE_KE_SUPPORT ENABLED
79 #elif (TLS13_PSK_ECDHE_KE_SUPPORT != ENABLED && TLS13_PSK_ECDHE_KE_SUPPORT != DISABLED)
80 #error TLS13_PSK_ECDHE_KE_SUPPORT parameter is not valid
84 #ifndef TLS13_PSK_MLKEM_KE_SUPPORT
85 #define TLS13_PSK_MLKEM_KE_SUPPORT DISABLED
86 #elif (TLS13_PSK_MLKEM_KE_SUPPORT != ENABLED && TLS13_PSK_MLKEM_KE_SUPPORT != DISABLED)
87 #error TLS13_PSK_MLKEM_KE_SUPPORT parameter is not valid
91 #ifndef TLS13_PSK_HYBRID_KE_SUPPORT
92 #define TLS13_PSK_HYBRID_KE_SUPPORT DISABLED
93 #elif (TLS13_PSK_HYBRID_KE_SUPPORT != ENABLED && TLS13_PSK_HYBRID_KE_SUPPORT != DISABLED)
94 #error TLS13_PSK_HYBRID_KE_SUPPORT parameter is not valid
98 #ifndef TLS13_EARLY_DATA_SUPPORT
99 #define TLS13_EARLY_DATA_SUPPORT DISABLED
100 #elif (TLS13_EARLY_DATA_SUPPORT != ENABLED && TLS13_EARLY_DATA_SUPPORT != DISABLED)
101 #error TLS13_EARLY_DATA_SUPPORT parameter is not valid
105 #ifndef TLS13_MIDDLEBOX_COMPAT_SUPPORT
106 #define TLS13_MIDDLEBOX_COMPAT_SUPPORT ENABLED
107 #elif (TLS13_MIDDLEBOX_COMPAT_SUPPORT != ENABLED && TLS13_MIDDLEBOX_COMPAT_SUPPORT != DISABLED)
108 #error TLS13_MIDDLEBOX_COMPAT_SUPPORT parameter is not valid
112 #ifndef TLS13_MAX_COOKIE_SIZE
113 #define TLS13_MAX_COOKIE_SIZE 256
114 #elif (TLS13_MAX_COOKIE_SIZE < 32)
115 #error TLS13_MAX_COOKIE_SIZE parameter is not valid
119 #ifndef TLS13_MAX_TICKET_SIZE
120 #define TLS13_MAX_TICKET_SIZE 1024
121 #elif (TLS13_MAX_TICKET_SIZE < 32)
122 #error TLS13_MAX_TICKET_SIZE parameter is not valid
126 #ifndef TLS13_MAX_TICKET_LIFETIME
127 #define TLS13_MAX_TICKET_LIFETIME 604800
128 #elif (TLS13_MAX_TICKET_LIFETIME < 0)
129 #error TLS13_MAX_TICKET_LIFETIME parameter is not valid
133 #ifndef TLS13_TICKET_AGE_TOLERANCE
134 #define TLS13_TICKET_AGE_TOLERANCE 5000
135 #elif (TLS13_TICKET_AGE_TOLERANCE < 0)
136 #error TLS13_TICKET_AGE_TOLERANCE parameter is not valid
140 #ifndef TLS13_NEW_SESSION_TICKET_COUNT
141 #define TLS13_NEW_SESSION_TICKET_COUNT 2
142 #elif (TLS13_NEW_SESSION_TICKET_COUNT < 0)
143 #error TLS13_NEW_SESSION_TICKET_COUNT parameter is not valid
147 #if (TLS_SHA384_SUPPORT == ENABLED)
148 #define TLS13_MAX_HKDF_DIGEST_SIZE 48
150 #define TLS13_MAX_HKDF_DIGEST_SIZE 32
182 #if defined(__CCRX__)
184 #elif defined(__CWCC__) || defined(_WIN32)
185 #pragma pack(push, 1)
307 uint16_t serverVersion;
327 uint16_t extensionsLen;
351 uint8_t requestUpdate;
384 #if defined(__CCRX__)
386 #elif defined(__CWCC__) || defined(_WIN32)
397 size_t clientHelloLen,
size_t truncatedClientHelloLen,
406 const uint8_t *keyShare,
size_t length);
412 void *record,
const uint8_t *
data,
size_t dataLen, uint8_t *mac);
427 uint16_t namedGroup);
uint32_t ticketLifetime
Lifetime of the ticket.
#define TLS13_MAX_HKDF_DIGEST_SIZE
error_t tls13ComputeMac(TlsContext *context, TlsEncryptionEngine *encryptionEngine, void *record, const uint8_t *data, size_t dataLen, uint8_t *mac)
Compute message authentication code.
error_t tls13GenerateKeyShare(TlsContext *context, uint16_t namedGroup)
Key share generation.
uint8_t ticketNonce[]
A per-ticket value that is unique across all tickets issued.
error_t tls13DigestClientHello1(TlsContext *context)
Hash ClientHello1 in the transcript when HelloRetryRequest is used.
typedef __packed_struct
Cookie.
error_t tls13ParseCertExtensions(const uint8_t *p, size_t length, size_t *consumed)
Parse certificate extensions.
size_t ticketPskLen
Length of the PSK associated with the ticket.
error_t tls13Encapsulate(TlsContext *context, uint16_t namedGroup, const uint8_t *keyShare, size_t length)
Encapsulation algorithm.
Tls13KeyUpdateRequest
Key update requests.
bool_t tls13IsHybridGroupSupported(TlsContext *context, uint16_t namedGroup)
Check whether a given hybrid key exchange method is supported.
uint8_t ticketPsk[TLS13_MAX_HKDF_DIGEST_SIZE]
PSK associated with the ticket.
@ TLS_PSK_KEY_EXCH_MODE_PSK_KE
@ TLS_PSK_KEY_EXCH_MODE_PSK_DHE_KE
bool_t tls13IsGroupSupported(TlsContext *context, uint16_t namedGroup)
Check whether a given named group is supported.
Tls13PskKeyExchMode
PSK key exchange modes.
const KemAlgo * tls13GetMlkemAlgo(TlsContext *context, uint16_t namedGroup)
Get the ML-KEM algorithm that matches the specified named group.
Tls13PlaintextSessionState
systime_t ticketTimestamp
Timestamp to manage ticket lifetime.
const KemAlgo * tls13GetNextGenAlgo(TlsContext *context, uint16_t namedGroup)
Get the next-gen algorithm used by the hybrid key exchange method.
error_t tls13Decapsulate(TlsContext *context, const uint8_t *keyShare, size_t length)
Decapsulation algorithm.
uint32_t systime_t
System time.
error_t tls13GenerateSharedSecret(TlsContext *context, const uint8_t *keyShare, size_t length)
(EC)DHE shared secret generation
error_t tls13ComputePskBinder(TlsContext *context, const void *clientHello, size_t clientHelloLen, size_t truncatedClientHelloLen, const Tls13PskIdentity *identity, uint8_t *binder, size_t binderLen)
Compute PSK binder value.
bool_t tls13IsEcdheGroupSupported(TlsContext *context, uint16_t namedGroup)
Check whether a given ECDHE group is supported.
uint16_t cipherSuite
Cipher suite identifier.
bool_t tls13IsPskValid(TlsContext *context)
Check whether an externally established PSK is valid.
bool_t tls13IsFfdheGroupSupported(TlsContext *context, uint16_t namedGroup)
Check whether a given FFDHE group is supported.
@ TLS_KEY_UPDATE_REQUESTED
Common interface for key encapsulation mechanisms (KEM)
bool_t tls13IsMlkemGroupSupported(TlsContext *context, uint16_t namedGroup)
Check whether a given ML-KEM exchange method is supported.
const uint8_t tls11DowngradeRandom[8]
const uint8_t tls12DowngradeRandom[8]
void * Tls13EndOfEarlyData
EndOfEarlyData message.
@ TLS_KEY_UPDATE_NOT_REQUESTED
uint32_t ticketAgeAdd
Random value used to obscure the age of the ticket.
#define TlsEncryptionEngine
error_t tls13CheckDuplicateKeyShare(uint16_t namedGroup, const uint8_t *p, size_t length)
Check whether the specified key share group is a duplicate.
error_t tls13FormatCertExtensions(uint8_t *p, size_t *written)
Format certificate extensions.
const uint8_t tls13HelloRetryRequestRandom[32]
const EcCurve * tls13GetTraditionalAlgo(TlsContext *context, uint16_t namedGroup)
Get the traditional algorithm used by the hybrid key exchange method.