tls13_server_misc.c
Go to the documentation of this file.
1 /**
2  * @file tls13_server_misc.c
3  * @brief Helper functions for TLS 1.3 server
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2010-2025 Oryx Embedded SARL. All rights reserved.
10  *
11  * This file is part of CycloneSSL Open.
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26  *
27  * @author Oryx Embedded SARL (www.oryx-embedded.com)
28  * @version 2.5.0
29  **/
30 
31 //Switch to the appropriate trace level
32 #define TRACE_LEVEL TLS_TRACE_LEVEL
33 
34 //Dependencies
35 #include "tls.h"
36 #include "tls_server_misc.h"
37 #include "tls_transcript_hash.h"
38 #include "tls_ffdhe.h"
39 #include "tls_misc.h"
41 #include "tls13_server_misc.h"
42 #include "debug.h"
43 
44 //Check TLS library configuration
45 #if (TLS_SUPPORT == ENABLED && TLS_SERVER_SUPPORT == ENABLED && \
46  TLS_MAX_VERSION >= TLS_VERSION_1_3)
47 
48 
49 /**
50  * @brief Cipher suite and key exchange method negotiation
51  * @param[in] context Pointer to the TLS context
52  * @param[in] clientHello Pointer to the ClientHello message
53  * @param[in] clientHelloLen Length of the ClientHello message
54  * @param[in] cipherSuites List of cipher suites offered by the client
55  * @param[in] extensions ClientHello extensions offered by the client
56  * @return Error code
57  **/
58 
59 error_t tls13NegotiateCipherSuite(TlsContext *context, const void *clientHello,
60  size_t clientHelloLen, const TlsCipherSuites *cipherSuites,
62 {
63  error_t error;
64 
65  //In TLS 1.3, the cipher suite concept has been changed. The key exchange
66  //mechanism is negotiated separately from the cipher suite
67  context->keyExchMethod = TLS_KEY_EXCH_NONE;
68 
69  //The PreSharedKey extension is used to negotiate the identity of the
70  //pre-shared key to be used with a given handshake in association with
71  //PSK key establishment
72  error = tls13ParseClientPreSharedKeyExtension(context, clientHello,
73  clientHelloLen, extensions->identityList, extensions->binderList);
74  //Any error to report?
75  if(error)
76  return error;
77 
78  //Externally established PSKs should influence cipher suite selection
79  if(context->selectedIdentity >= 0)
80  {
81  //Select a cipher suite indicating a hash associated with the PSK
82  error = tlsNegotiateCipherSuite(context, context->cipherSuite.prfHashAlgo,
83  cipherSuites, extensions);
84 
85  //The server must ensure that it selects a compatible PSK and cipher suite
86  if(!error)
87  {
88  //Perform PSK handshake
89  context->keyExchMethod = TLS13_KEY_EXCH_PSK;
90  }
91  else
92  {
93  //Perform a non-PSK handshake if possible
94  context->keyExchMethod = TLS_KEY_EXCH_NONE;
95  context->selectedIdentity = -1;
96  }
97  }
98 
99  //Check key exchange method
100  if(context->keyExchMethod == TLS_KEY_EXCH_NONE)
101  {
102  //Perform cipher suite negotiation
103  error = tlsNegotiateCipherSuite(context, NULL, cipherSuites, extensions);
104  //If no acceptable choices are presented, terminate the handshake
105  if(error)
106  return ERROR_HANDSHAKE_FAILED;
107  }
108 
109  //If the handshake includes a HelloRetryRequest, the initial ClientHello
110  //and HelloRetryRequest are included in the transcript along with the new
111  //ClientHello
112  if(context->state != TLS_STATE_CLIENT_HELLO_2)
113  {
114  //Initialize handshake message hashing
115  error = tlsInitTranscriptHash(context);
116  //Any error to report?
117  if(error)
118  return error;
119  }
120 
121  //If the client opts to send 0-RTT data, it must supply an EarlyData
122  //extension in its ClientHello
123  error = tls13ParseClientEarlyDataExtension(context,
124  extensions->earlyDataIndication);
125  //Any error to report?
126  if(error)
127  return error;
128 
129  //The KeyShare extension contains the client's cryptographic parameters
130  error = tls13ParseClientKeyShareExtension(context, extensions->keyShareList,
131  extensions->supportedGroupList);
132  //Any error to report?
133  if(error)
134  return error;
135 
136  //Incorrect (EC)DHE share?
137  if(extensions->keyShareList != NULL && context->namedGroup == TLS_GROUP_NONE)
138  {
139  //Select an appropriate ECDHE or FFDHE group
140  error = tls13SelectGroup(context, extensions->supportedGroupList);
141  //Any error to report?
142  if(error)
143  return error;
144 
145  //The server corrects the mismatch with a HelloRetryRequest
147  }
148  else
149  {
150  //Check key exchange method
151  if(context->keyExchMethod == TLS13_KEY_EXCH_DHE ||
152  context->keyExchMethod == TLS13_KEY_EXCH_ECDHE ||
153  context->keyExchMethod == TLS13_KEY_EXCH_MLKEM ||
154  context->keyExchMethod == TLS13_KEY_EXCH_HYBRID)
155  {
156  //Check whether the client supports session resumption with a PSK
157  error = tls13ParsePskKeModesExtension(context,
158  extensions->pskKeModeList);
159  //Any error to report?
160  if(error)
161  return error;
162  }
163  else if(context->keyExchMethod == TLS13_KEY_EXCH_PSK ||
164  context->keyExchMethod == TLS13_KEY_EXCH_PSK_DHE ||
165  context->keyExchMethod == TLS13_KEY_EXCH_PSK_ECDHE ||
166  context->keyExchMethod == TLS13_KEY_EXCH_PSK_MLKEM ||
167  context->keyExchMethod == TLS13_KEY_EXCH_PSK_HYBRID)
168  {
169  //Servers must not select a key exchange mode that is not listed by
170  //the client in the PskKeyExchangeModes extension
171  error = tls13ParsePskKeModesExtension(context,
172  extensions->pskKeModeList);
173  //Any error to report?
174  if(error)
175  return error;
176 
177  //Prior to accepting PSK key establishment, the server must validate
178  //the corresponding binder value
179  error = tls13VerifyPskBinder(context, clientHello, clientHelloLen,
180  extensions->identityList, extensions->binderList,
181  context->selectedIdentity);
182  //If this value does not validate, the server must abort the handshake
183  if(error)
184  return error;
185  }
186  else
187  {
188  //If no common cryptographic parameters can be negotiated, the server
189  //must abort the handshake with an appropriate alert
190  return ERROR_HANDSHAKE_FAILED;
191  }
192  }
193 
194  //Successful processing
195  return NO_ERROR;
196 }
197 
198 
199 /**
200  * @brief Select the group to be used when performing (EC)DHE key exchange
201  * @param[in] context Pointer to the TLS context
202  * @param[in] groupList List of named groups supported by the client
203  * @return Error code
204  **/
205 
207  const TlsSupportedGroupList *groupList)
208 {
209  error_t error;
210 
211  //Initialize status code
212  error = ERROR_ILLEGAL_PARAMETER;
213 
214  //Reset the named group to its default value
215  context->namedGroup = TLS_GROUP_NONE;
216 
217 #if (TLS13_DHE_KE_SUPPORT == ENABLED || TLS13_PSK_DHE_KE_SUPPORT == ENABLED || \
218  TLS13_ECDHE_KE_SUPPORT == ENABLED || TLS13_PSK_ECDHE_KE_SUPPORT == ENABLED || \
219  TLS13_MLKEM_KE_SUPPORT == ENABLED || TLS13_PSK_MLKEM_KE_SUPPORT == ENABLED || \
220  TLS13_HYBRID_KE_SUPPORT == ENABLED || TLS13_PSK_HYBRID_KE_SUPPORT == ENABLED)
221  //Valid SupportedGroups extension?
222  if(groupList != NULL)
223  {
224  uint_t i;
225  uint_t n;
226  uint16_t namedGroup;
227 
228  //Any preferred ECDHE or FFDHE groups?
229  if(context->numSupportedGroups > 0)
230  {
231  //Loop through the list of allowed groups (most preferred first)
232  for(i = 0; i < context->numSupportedGroups && error; i++)
233  {
234  //Get current named group
235  namedGroup = context->supportedGroups[i];
236 
237  //The named group to be used when performing (EC)DHE key exchange
238  //must be one of those present in the SupportedGroups extension
239  if(tls13IsGroupOffered(namedGroup, groupList))
240  {
241  //Check whether the ECDHE or FFDHE group is supported
242  if(tls13IsGroupObsolete(context, namedGroup))
243  {
244  //Obsolete curves are used in previous versions of TLS and
245  //must not be negotiated by TLS 1.3 implementations
246  }
247  else if(tls13IsGroupSupported(context, namedGroup))
248  {
249  //Save the named group
250  context->namedGroup = namedGroup;
251  //The group is supported
252  error = NO_ERROR;
253  }
254  else
255  {
256  //The group is not supported
257  error = ERROR_HANDSHAKE_FAILED;
258  }
259  }
260  }
261  }
262  else
263  {
264  //Get the number of named groups present in the list
265  n = ntohs(groupList->length) / sizeof(uint16_t);
266 
267  //The named group to be used when performing (EC)DHE key exchange must
268  //be one of those present in the SupportedGroups extension
269  for(i = 0; i < n && error; i++)
270  {
271  //Convert the named group to host byte order
272  namedGroup = ntohs(groupList->value[i]);
273 
274  //Check whether the ECDHE or FFDHE group is supported
275  if(tls13IsGroupObsolete(context, namedGroup))
276  {
277  //Obsolete curves are used in previous versions of TLS and must
278  //not be negotiated by TLS 1.3 implementations
279  }
280  else if(tls13IsGroupSupported(context, namedGroup))
281  {
282  //Save the named group
283  context->namedGroup = namedGroup;
284  //The group is supported
285  error = NO_ERROR;
286  }
287  else
288  {
289  //The group is not supported
290  error = ERROR_HANDSHAKE_FAILED;
291  }
292  }
293  }
294  }
295 #endif
296 
297  //Return status code
298  return error;
299 }
300 
301 
302 /**
303  * @brief Check whether a group is offered in the SupportedGroups extension
304  * @param[in] namedGroup Named group
305  * @param[in] groupList List of named groups supported by the client
306  * @return TRUE if the group is offered in the SupportedGroups extension,
307  * else FALSE
308  **/
309 
310 bool_t tls13IsGroupOffered(uint16_t namedGroup,
311  const TlsSupportedGroupList *groupList)
312 {
313  uint_t i;
314  uint_t n;
315  bool_t found;
316 
317  //Initialize flag
318  found = FALSE;
319 
320  //Valid SupportedGroups extension?
321  if(groupList != NULL)
322  {
323  //Get the number of named groups present in the list
324  n = ntohs(groupList->length) / sizeof(uint16_t);
325 
326  //Loop through the list of named groups the client supports
327  for(i = 0; i < n && !found; i++)
328  {
329  //Matching group?
330  if(ntohs(groupList->value[i]) == namedGroup)
331  {
332  found = TRUE;
333  }
334  }
335  }
336 
337  //Return TRUE if the group is offered in the SupportedGroups extension
338  return found;
339 }
340 
341 
342 /**
343  * @brief Check whether a given group is obsolete
344  * @param[in] context Pointer to the TLS context
345  * @param[in] namedGroup Named group
346  * @return TRUE is the group is obsolete, else FALSE
347  **/
348 
349 bool_t tls13IsGroupObsolete(TlsContext *context, uint16_t namedGroup)
350 {
351  bool_t obsolete;
352 
353  //Values within obsolete ranges are used in previous versions of TLS and
354  //must not be offered or negotiated by TLS 1.3 implementations (refer to
355  //RFC 8446, appendix B.3.1.4)
356  if(namedGroup >= TLS_GROUP_SECT163K1 &&
357  namedGroup <= TLS_GROUP_SECP256K1)
358  {
359  obsolete = TRUE;
360  }
361  else if(namedGroup >= TLS_GROUP_BRAINPOOLP256R1 &&
362  namedGroup <= TLS_GROUP_BRAINPOOLP512R1)
363  {
364  obsolete = TRUE;
365  }
366  else if(namedGroup >= TLS_GROUP_EXPLICIT_PRIME_CURVE &&
367  namedGroup <= TLS_GROUP_EXPLICIT_CHAR2_CURVE)
368  {
369  obsolete = TRUE;
370  }
371  else
372  {
373  obsolete = FALSE;
374  }
375 
376  //Return TRUE is the group is obsolete
377  return obsolete;
378 }
379 
380 
381 /**
382  * @brief Verify PSK binder value
383  * @param[in] context Pointer to the TLS context
384  * @param[in] clientHello Pointer to the ClientHello message
385  * @param[in] clientHelloLen Length of the ClientHello message
386  * @param[in] identityList List of the identities that the client is willing
387  * to negotiate with the server
388  * @param[in] binderList List of HMAC values, one for each PSK offered in the
389  * PreSharedKey extension
390  * @param[in] selectedIdentity Selected PSK identity
391  * @return Error code
392  **/
393 
394 error_t tls13VerifyPskBinder(TlsContext *context, const void *clientHello,
395  size_t clientHelloLen, const Tls13PskIdentityList *identityList,
396  const Tls13PskBinderList *binderList, int_t selectedIdentity)
397 {
398 #if (TLS13_PSK_KE_SUPPORT == ENABLED || TLS13_PSK_DHE_KE_SUPPORT == ENABLED || \
399  TLS13_PSK_ECDHE_KE_SUPPORT == ENABLED || TLS13_PSK_HYBRID_KE_SUPPORT == ENABLED)
400  error_t error;
401  int_t i;
402  size_t n;
403  const uint8_t *p;
404  const Tls13PskIdentity *identity;
405  const Tls13PskBinder *binder;
406  uint8_t calculatedBinder[TLS_MAX_HKDF_DIGEST_SIZE];
407 
408  //Initialize variables
409  identity = NULL;
410  binder = NULL;
411 
412  //Make sure the PreSharedKey extension is valid
413  if(identityList == NULL || binderList == NULL)
414  return ERROR_FAILURE;
415 
416  //Make sure the selected identity is valid
417  if(selectedIdentity < 0)
418  return ERROR_FAILURE;
419 
420  //Point to the list of the identities that the client is willing to
421  //negotiate with the server
422  p = identityList->value;
423  n = ntohs(identityList->length);
424 
425  //Loop through the list of PSK identities
426  for(i = 0; i <= selectedIdentity && n > 0; i++)
427  {
428  //Point to the current PskIdentity entry
429  identity = (Tls13PskIdentity *) p;
430 
431  //Malformed PreSharedKey extension?
432  if(n < sizeof(TlsPskIdentity))
433  return ERROR_DECODING_FAILED;
434  if(n < (sizeof(TlsPskIdentity) + ntohs(identity->length)))
435  return ERROR_DECODING_FAILED;
436 
437  //Point to the obfuscated_ticket_age field
438  p += sizeof(TlsPskIdentity) + ntohs(identity->length);
439  n -= sizeof(TlsPskIdentity) + ntohs(identity->length);
440 
441  //The obfuscated_ticket_age field is a 32-bit unsigned integer
442  if(n < sizeof(uint32_t))
443  return ERROR_DECODING_FAILED;
444 
445  //Point to the next PskIdentity entry
446  p += sizeof(uint32_t);
447  n -= sizeof(uint32_t);
448  }
449 
450  //Make sure the selected identity is within the range supplied by the client
451  if(selectedIdentity >= i)
452  return ERROR_FAILURE;
453 
454  //Point to the list of HMAC values, one for each PSK offered in the
455  //PreSharedKey extension
456  p = binderList->value;
457  n = ntohs(binderList->length);
458 
459  //Loop through the list of PSK binders
460  for(i = 0; i <= selectedIdentity && n > 0; i++)
461  {
462  //Point to the PskBinderEntry
463  binder = (Tls13PskBinder *) p;
464 
465  //Malformed PreSharedKey extension?
466  if(n < sizeof(Tls13PskBinder))
467  return ERROR_DECODING_FAILED;
468  if(n < (sizeof(Tls13PskBinder) + binder->length))
469  return ERROR_DECODING_FAILED;
470 
471  //Point to the next PskBinderEntry
472  p += sizeof(Tls13PskBinder) + binder->length;
473  n -= sizeof(Tls13PskBinder) + binder->length;
474  }
475 
476  //Make sure the selected identity is within the range supplied by the client
477  if(selectedIdentity >= i)
478  return ERROR_FAILURE;
479 
480  //Check the length of the PSK binder
481  if(binder->length > TLS_MAX_HKDF_DIGEST_SIZE)
483 
484  //The PSK binder is computed as an HMAC over a transcript hash containing
485  //a partial ClientHello up to the binders list itself
486  n = (uint8_t *) binderList - (uint8_t *) clientHello;
487 
488  //Compute PSK binder value
489  error = tls13ComputePskBinder(context, clientHello, clientHelloLen,
490  n, identity, calculatedBinder, binder->length);
491  //Any error to report?
492  if(error)
494 
495  //Debug message
496  TRACE_DEBUG("PSK binder:\r\n");
497  TRACE_DEBUG_ARRAY(" ", binder->value, binder->length);
498  TRACE_DEBUG("Calculated PSK binder:\r\n");
499  TRACE_DEBUG_ARRAY(" ", calculatedBinder, binder->length);
500 
501  //Prior to accepting PSK key establishment, the server must validate the
502  //corresponding binder value
503  if(osMemcmp(calculatedBinder, binder->value, binder->length))
504  {
505  //If this value does not validate, the server must abort the handshake
507  }
508 
509  //Successful verification
510  return NO_ERROR;
511 #else
512  //Not implemented
513  return ERROR_NOT_IMPLEMENTED;
514 #endif
515 }
516 
517 
518 /**
519  * @brief Process early data
520  * @param[in] context Pointer to the TLS context
521  * @param[in] data Pointer to the early data
522  * @param[in] length Length of the early data, in bytes
523  * @return Error code
524  **/
525 
526 error_t tls13ProcessEarlyData(TlsContext *context, const uint8_t *data,
527  size_t length)
528 {
529  //Check TLS version
530  if(context->version != TLS_VERSION_1_3)
532 
533  //Check current state
534  if(context->state != TLS_STATE_CLIENT_HELLO_2)
536 
537  //If the client opts to send 0-RTT data, it must supply an EarlyData
538  //extension in its ClientHello (refer to RFC 8446, section 4.2.10)
539  if(!context->earlyDataExtReceived)
541 
542  //Amount of 0-RTT data received by the server
543  context->earlyDataLen += length;
544 
545  //Discard records which fail deprotection (up to the configured
546  //max_early_data_size)
547  if(context->earlyDataLen > context->maxEarlyDataSize)
548  return ERROR_BAD_RECORD_MAC;
549 
550  //Debug message
551  TRACE_INFO("Discarding early data (%" PRIuSIZE " bytes)...\r\n", length);
552 
553  //The server may opt to reject early data
554  return NO_ERROR;
555 }
556 
557 #endif
@ TLS13_KEY_EXCH_PSK
Definition: tls.h:1184
TLS helper functions.
uint8_t extensions[]
Definition: ntp_common.h:207
Tls13PskBinderList
Definition: tls13_misc.h:275
@ TLS_STATE_HELLO_RETRY_REQUEST
Definition: tls.h:1498
int bool_t
Definition: compiler_port.h:61
error_t tls13ParsePskKeModesExtension(TlsContext *context, const Tls13PskKeModeList *pskKeModeList)
Parse PskKeyExchangeModes extension.
@ TLS13_KEY_EXCH_MLKEM
Definition: tls.h:1182
@ TLS13_KEY_EXCH_PSK_DHE
Definition: tls.h:1185
signed int int_t
Definition: compiler_port.h:56
@ ERROR_NOT_IMPLEMENTED
Definition: error.h:66
@ ERROR_ILLEGAL_PARAMETER
Definition: error.h:244
@ ERROR_DECRYPTION_FAILED
Definition: error.h:243
@ ERROR_UNEXPECTED_MESSAGE
Definition: error.h:195
uint8_t p
Definition: ndp.h:300
@ TLS_GROUP_SECP256K1
Definition: tls.h:1426
#define TRUE
Definition: os_port.h:50
@ TLS_GROUP_EXPLICIT_CHAR2_CURVE
Definition: tls.h:1459
uint8_t data[]
Definition: ethernet.h:222
TlsPskIdentity
Definition: tls.h:1733
@ TLS13_KEY_EXCH_PSK_MLKEM
Definition: tls.h:1187
error_t tls13VerifyPskBinder(TlsContext *context, const void *clientHello, size_t clientHelloLen, const Tls13PskIdentityList *identityList, const Tls13PskBinderList *binderList, int_t selectedIdentity)
Verify PSK binder value.
error_t tls13SelectGroup(TlsContext *context, const TlsSupportedGroupList *groupList)
Select the group to be used when performing (EC)DHE key exchange.
#define osMemcmp(p1, p2, length)
Definition: os_port.h:156
@ ERROR_HANDSHAKE_FAILED
Definition: error.h:234
@ TLS13_KEY_EXCH_ECDHE
Definition: tls.h:1181
@ ERROR_BAD_RECORD_MAC
Definition: error.h:232
error_t tls13NegotiateCipherSuite(TlsContext *context, const void *clientHello, size_t clientHelloLen, const TlsCipherSuites *cipherSuites, TlsHelloExtensions *extensions)
Cipher suite and key exchange method negotiation.
@ TLS_GROUP_BRAINPOOLP256R1
Definition: tls.h:1430
@ TLS13_KEY_EXCH_PSK_HYBRID
Definition: tls.h:1188
TlsCipherSuites
Definition: tls.h:1555
#define FALSE
Definition: os_port.h:46
#define TlsContext
Definition: tls.h:36
error_t
Error codes.
Definition: error.h:43
bool_t tls13IsGroupSupported(TlsContext *context, uint16_t namedGroup)
Check whether a given named group is supported.
Definition: tls13_misc.c:971
@ TLS_GROUP_NONE
Definition: tls.h:1404
Formatting and parsing of extensions (TLS 1.3 server)
@ ERROR_FAILURE
Generic error code.
Definition: error.h:45
@ TLS_GROUP_EXPLICIT_PRIME_CURVE
Definition: tls.h:1458
@ TLS13_KEY_EXCH_DHE
Definition: tls.h:1180
@ TLS_GROUP_SECT163K1
Definition: tls.h:1405
#define TLS_VERSION_1_3
Definition: tls.h:97
error_t tlsNegotiateCipherSuite(TlsContext *context, const HashAlgo *hashAlgo, const TlsCipherSuites *cipherSuites, TlsHelloExtensions *extensions)
Cipher suite negotiation.
bool_t tls13IsGroupObsolete(TlsContext *context, uint16_t namedGroup)
Check whether a given group is obsolete.
error_t tls13ParseClientEarlyDataExtension(TlsContext *context, const TlsExtension *earlyDataIndication)
Parse EarlyData extension.
Tls13PskBinder
Definition: tls13_misc.h:264
#define TRACE_INFO(...)
Definition: debug.h:105
uint8_t length
Definition: tcp.h:375
@ TLS_GROUP_BRAINPOOLP512R1
Definition: tls.h:1432
Helper functions for TLS 1.3 server.
Hello extensions.
Definition: tls.h:2136
Transcript hash calculation.
#define ntohs(value)
Definition: cpu_endian.h:421
#define TRACE_DEBUG(...)
Definition: debug.h:119
@ TLS_KEY_EXCH_NONE
Definition: tls.h:1161
@ TLS13_KEY_EXCH_PSK_ECDHE
Definition: tls.h:1186
@ TLS_STATE_CLIENT_HELLO_2
Definition: tls.h:1495
#define TRACE_DEBUG_ARRAY(p, a, n)
Definition: debug.h:120
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.
Definition: tls13_misc.c:86
uint8_t n
error_t tls13ParseClientKeyShareExtension(TlsContext *context, const Tls13KeyShareList *keyShareList, const TlsSupportedGroupList *groupList)
Parse KeyShare extension.
@ TLS13_KEY_EXCH_HYBRID
Definition: tls.h:1183
error_t tlsInitTranscriptHash(TlsContext *context)
Initialize handshake message hashing.
#define TLS_MAX_HKDF_DIGEST_SIZE
Definition: tls.h:943
TLS (Transport Layer Security)
bool_t tls13IsGroupOffered(uint16_t namedGroup, const TlsSupportedGroupList *groupList)
Check whether a group is offered in the SupportedGroups extension.
FFDHE key exchange.
Helper functions for TLS server.
void tlsChangeState(TlsContext *context, TlsState newState)
Update TLS state.
Definition: tls_misc.c:54
Tls13PskIdentity
Definition: tls13_misc.h:242
@ ERROR_DECODING_FAILED
Definition: error.h:242
Tls13PskIdentityList
Definition: tls13_misc.h:253
#define PRIuSIZE
unsigned int uint_t
Definition: compiler_port.h:57
TlsSupportedGroupList
Definition: tls.h:1689
error_t tls13ProcessEarlyData(TlsContext *context, const uint8_t *data, size_t length)
Process early data.
@ NO_ERROR
Success.
Definition: error.h:44
error_t tls13ParseClientPreSharedKeyExtension(TlsContext *context, const TlsClientHello *clientHello, size_t clientHelloLen, const Tls13PskIdentityList *identityList, const Tls13PskBinderList *binderList)
Parse PreSharedKey extension.
Debugging facilities.