83
83
/** Processing of the Certificate handshake message failed. */
84
84
#define MBEDTLS_ERR_SSL_BAD_CERTIFICATE -0x7A00
85
85
/* Error space gap */
86
- /**
87
- * Received NewSessionTicket Post Handshake Message.
88
- * This error code is experimental and may be changed or removed without notice.
89
- */
86
+ /** A TLS 1.3 NewSessionTicket message has been received. */
90
87
#define MBEDTLS_ERR_SSL_RECEIVED_NEW_SESSION_TICKET -0x7B00
91
88
/** Not possible to read early data */
92
89
#define MBEDTLS_ERR_SSL_CANNOT_READ_EARLY_DATA -0x7B80
324
321
#define MBEDTLS_SSL_SESSION_TICKETS_DISABLED 0
325
322
#define MBEDTLS_SSL_SESSION_TICKETS_ENABLED 1
326
323
324
+ #define MBEDTLS_SSL_TLS1_3_SIGNAL_NEW_SESSION_TICKETS_DISABLED 0
325
+ #define MBEDTLS_SSL_TLS1_3_SIGNAL_NEW_SESSION_TICKETS_ENABLED 1
326
+
327
327
#define MBEDTLS_SSL_PRESET_DEFAULT 0
328
328
#define MBEDTLS_SSL_PRESET_SUITEB 2
329
329
@@ -1446,6 +1446,12 @@ struct mbedtls_ssl_config {
1446
1446
#endif
1447
1447
#if defined(MBEDTLS_SSL_SESSION_TICKETS ) && \
1448
1448
defined(MBEDTLS_SSL_CLI_C )
1449
+ /** Encodes two booleans, one stating whether TLS 1.2 session tickets are
1450
+ * enabled or not, the other one whether the handling of TLS 1.3
1451
+ * NewSessionTicket messages is enabled or not. They are respectively set
1452
+ * by mbedtls_ssl_conf_session_tickets() and
1453
+ * mbedtls_ssl_conf_tls13_enable_signal_new_session_tickets().
1454
+ */
1449
1455
uint8_t MBEDTLS_PRIVATE (session_tickets ); /*!< use session tickets? */
1450
1456
#endif
1451
1457
@@ -4465,21 +4471,50 @@ int mbedtls_ssl_conf_max_frag_len(mbedtls_ssl_config *conf, unsigned char mfl_co
4465
4471
void mbedtls_ssl_conf_preference_order (mbedtls_ssl_config * conf , int order );
4466
4472
#endif /* MBEDTLS_SSL_SRV_C */
4467
4473
4468
- #if defined(MBEDTLS_SSL_SESSION_TICKETS ) && \
4469
- defined(MBEDTLS_SSL_CLI_C )
4474
+ #if defined(MBEDTLS_SSL_SESSION_TICKETS ) && defined(MBEDTLS_SSL_CLI_C )
4470
4475
/**
4471
- * \brief Enable / Disable session tickets (client only).
4472
- * (Default: MBEDTLS_SSL_SESSION_TICKETS_ENABLED.)
4476
+ * \brief Enable / Disable TLS 1.2 session tickets (client only,
4477
+ * TLS 1.2 only). Enabled by default.
4473
4478
*
4474
4479
* \note On server, use \c mbedtls_ssl_conf_session_tickets_cb().
4475
4480
*
4476
4481
* \param conf SSL configuration
4477
- * \param use_tickets Enable or disable (MBEDTLS_SSL_SESSION_TICKETS_ENABLED or
4478
- * MBEDTLS_SSL_SESSION_TICKETS_DISABLED)
4482
+ * \param use_tickets Enable or disable (# MBEDTLS_SSL_SESSION_TICKETS_ENABLED or
4483
+ * # MBEDTLS_SSL_SESSION_TICKETS_DISABLED)
4479
4484
*/
4480
4485
void mbedtls_ssl_conf_session_tickets (mbedtls_ssl_config * conf , int use_tickets );
4481
- #endif /* MBEDTLS_SSL_SESSION_TICKETS &&
4482
- MBEDTLS_SSL_CLI_C */
4486
+
4487
+ #if defined(MBEDTLS_SSL_PROTO_TLS1_3 )
4488
+ /**
4489
+ * \brief Enable / Disable handling of TLS 1.3 NewSessionTicket messages
4490
+ * (client only, TLS 1.3 only).
4491
+ *
4492
+ * The handling of TLS 1.3 NewSessionTicket messages is disabled by
4493
+ * default.
4494
+ *
4495
+ * In TLS 1.3, servers may send a NewSessionTicket message at any time,
4496
+ * and may send multiple NewSessionTicket messages. By default, TLS 1.3
4497
+ * clients ignore NewSessionTicket messages.
4498
+ *
4499
+ * To support session tickets in TLS 1.3 clients, call this function
4500
+ * with #MBEDTLS_SSL_TLS1_3_SIGNAL_NEW_SESSION_TICKETS_ENABLED. When
4501
+ * this is enabled, when a client receives a NewSessionTicket message,
4502
+ * the next call to a message processing functions (notably
4503
+ * mbedtls_ssl_handshake() and mbedtls_ssl_read()) will return
4504
+ * #MBEDTLS_ERR_SSL_RECEIVED_NEW_SESSION_TICKET. The client should then
4505
+ * call mbedtls_ssl_get_session() to retrieve the session ticket before
4506
+ * calling the same message processing function again.
4507
+ *
4508
+ * \param conf SSL configuration
4509
+ * \param signal_new_session_tickets Enable or disable
4510
+ * (#MBEDTLS_SSL_TLS1_3_SIGNAL_NEW_SESSION_TICKETS_ENABLED or
4511
+ * #MBEDTLS_SSL_TLS1_3_SIGNAL_NEW_SESSION_TICKETS_DISABLED)
4512
+ */
4513
+ void mbedtls_ssl_conf_tls13_enable_signal_new_session_tickets (
4514
+ mbedtls_ssl_config * conf , int signal_new_session_tickets );
4515
+
4516
+ #endif /* MBEDTLS_SSL_PROTO_TLS1_3 */
4517
+ #endif /* MBEDTLS_SSL_SESSION_TICKETS && MBEDTLS_SSL_CLI_C */
4483
4518
4484
4519
#if defined(MBEDTLS_SSL_SESSION_TICKETS ) && \
4485
4520
defined(MBEDTLS_SSL_SRV_C ) && \
@@ -4887,6 +4922,10 @@ int mbedtls_ssl_get_session(const mbedtls_ssl_context *ssl,
4887
4922
* \return #MBEDTLS_ERR_SSL_HELLO_VERIFY_REQUIRED if DTLS is in use
4888
4923
* and the client did not demonstrate reachability yet - in
4889
4924
* this case you must stop using the context (see below).
4925
+ * \return #MBEDTLS_ERR_SSL_RECEIVED_NEW_SESSION_TICKET if a TLS 1.3
4926
+ * NewSessionTicket message has been received. See the
4927
+ * documentation of mbedtls_ssl_read() for more information
4928
+ * about this error code.
4890
4929
* \return #MBEDTLS_ERR_SSL_RECEIVED_EARLY_DATA if early data, as
4891
4930
* defined in RFC 8446 (TLS 1.3 specification), has been
4892
4931
* received as part of the handshake. This is server specific
@@ -4903,6 +4942,7 @@ int mbedtls_ssl_get_session(const mbedtls_ssl_context *ssl,
4903
4942
* #MBEDTLS_ERR_SSL_WANT_WRITE,
4904
4943
* #MBEDTLS_ERR_SSL_ASYNC_IN_PROGRESS or
4905
4944
* #MBEDTLS_ERR_SSL_CRYPTO_IN_PROGRESS or
4945
+ * #MBEDTLS_ERR_SSL_RECEIVED_NEW_SESSION_TICKET or
4906
4946
* #MBEDTLS_ERR_SSL_RECEIVED_EARLY_DATA,
4907
4947
* you must stop using the SSL context for reading or writing,
4908
4948
* and either free it or call \c mbedtls_ssl_session_reset()
@@ -4977,6 +5017,7 @@ static inline int mbedtls_ssl_is_handshake_over(mbedtls_ssl_context *ssl)
4977
5017
* #MBEDTLS_ERR_SSL_WANT_READ, #MBEDTLS_ERR_SSL_WANT_WRITE,
4978
5018
* #MBEDTLS_ERR_SSL_ASYNC_IN_PROGRESS,
4979
5019
* #MBEDTLS_ERR_SSL_CRYPTO_IN_PROGRESS or
5020
+ * #MBEDTLS_ERR_SSL_RECEIVED_NEW_SESSION_TICKET or
4980
5021
* #MBEDTLS_ERR_SSL_RECEIVED_EARLY_DATA, you must stop using
4981
5022
* the SSL context for reading or writing, and either free it
4982
5023
* or call \c mbedtls_ssl_session_reset() on it before
@@ -5045,6 +5086,17 @@ int mbedtls_ssl_renegotiate(mbedtls_ssl_context *ssl);
5045
5086
* \return #MBEDTLS_ERR_SSL_CLIENT_RECONNECT if we're at the server
5046
5087
* side of a DTLS connection and the client is initiating a
5047
5088
* new connection using the same source port. See below.
5089
+ * \return #MBEDTLS_ERR_SSL_RECEIVED_NEW_SESSION_TICKET if a TLS 1.3
5090
+ * NewSessionTicket message has been received.
5091
+ * This error code is only returned on the client side. It is
5092
+ * only returned if handling of TLS 1.3 NewSessionTicket
5093
+ * messages has been enabled through
5094
+ * mbedtls_ssl_conf_tls13_enable_signal_new_session_tickets().
5095
+ * This error code indicates that a TLS 1.3 NewSessionTicket
5096
+ * message has been received and parsed successfully by the
5097
+ * client. The ticket data can be retrieved from the SSL
5098
+ * context by calling mbedtls_ssl_get_session(). It remains
5099
+ * available until the next call to mbedtls_ssl_read().
5048
5100
* \return #MBEDTLS_ERR_SSL_RECEIVED_EARLY_DATA if early data, as
5049
5101
* defined in RFC 8446 (TLS 1.3 specification), has been
5050
5102
* received as part of the handshake. This is server specific
@@ -5062,6 +5114,7 @@ int mbedtls_ssl_renegotiate(mbedtls_ssl_context *ssl);
5062
5114
* #MBEDTLS_ERR_SSL_ASYNC_IN_PROGRESS,
5063
5115
* #MBEDTLS_ERR_SSL_CRYPTO_IN_PROGRESS,
5064
5116
* #MBEDTLS_ERR_SSL_CLIENT_RECONNECT or
5117
+ * #MBEDTLS_ERR_SSL_RECEIVED_NEW_SESSION_TICKET or
5065
5118
* #MBEDTLS_ERR_SSL_RECEIVED_EARLY_DATA,
5066
5119
* you must stop using the SSL context for reading or writing,
5067
5120
* and either free it or call \c mbedtls_ssl_session_reset()
@@ -5127,6 +5180,10 @@ int mbedtls_ssl_read(mbedtls_ssl_context *ssl, unsigned char *buf, size_t len);
5127
5180
* operation is in progress (see mbedtls_ecp_set_max_ops()) -
5128
5181
* in this case you must call this function again to complete
5129
5182
* the handshake when you're done attending other tasks.
5183
+ * \return #MBEDTLS_ERR_SSL_RECEIVED_NEW_SESSION_TICKET if a TLS 1.3
5184
+ * NewSessionTicket message has been received. See the
5185
+ * documentation of mbedtls_ssl_read() for more information
5186
+ * about this error code.
5130
5187
* \return #MBEDTLS_ERR_SSL_RECEIVED_EARLY_DATA if early data, as
5131
5188
* defined in RFC 8446 (TLS 1.3 specification), has been
5132
5189
* received as part of the handshake. This is server specific
@@ -5143,6 +5200,7 @@ int mbedtls_ssl_read(mbedtls_ssl_context *ssl, unsigned char *buf, size_t len);
5143
5200
* #MBEDTLS_ERR_SSL_WANT_WRITE,
5144
5201
* #MBEDTLS_ERR_SSL_ASYNC_IN_PROGRESS,
5145
5202
* #MBEDTLS_ERR_SSL_CRYPTO_IN_PROGRESS or
5203
+ * #MBEDTLS_ERR_SSL_RECEIVED_NEW_SESSION_TICKET or
5146
5204
* #MBEDTLS_ERR_SSL_RECEIVED_EARLY_DATA,
5147
5205
* you must stop using the SSL context for reading or writing,
5148
5206
* and either free it or call \c mbedtls_ssl_session_reset()
0 commit comments