Skip to content

Commit 72064b2

Browse files
Merge pull request #9507 from ronald-cron-arm/disable-new-session-tickets
3.6: Disable new session tickets at runtime
2 parents 7defa41 + c46edd4 commit 72064b2

File tree

9 files changed

+219
-27
lines changed

9 files changed

+219
-27
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Bugfix
2+
* Fix TLS connection failure in applications using an Mbed TLS client in
3+
the default configuration connecting to a TLS 1.3 server sending tickets.
4+
See the documentation of
5+
mbedtls_ssl_conf_tls13_enable_signal_new_session_tickets() for more
6+
information.
7+
Fixes #8749.
8+
9+
Changes
10+
* By default, the handling of TLS 1.3 tickets by the Mbed TLS client is now
11+
disabled at runtime. Applications that were using TLS 1.3 tickets
12+
signalled by MBEDTLS_ERR_SSL_RECEIVED_NEW_SESSION_TICKET return values now
13+
need to enable the handling of TLS 1.3 tickets through the new
14+
mbedtls_ssl_conf_tls13_enable_signal_new_session_tickets() API.

include/mbedtls/ssl.h

+70-12
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,7 @@
8383
/** Processing of the Certificate handshake message failed. */
8484
#define MBEDTLS_ERR_SSL_BAD_CERTIFICATE -0x7A00
8585
/* 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. */
9087
#define MBEDTLS_ERR_SSL_RECEIVED_NEW_SESSION_TICKET -0x7B00
9188
/** Not possible to read early data */
9289
#define MBEDTLS_ERR_SSL_CANNOT_READ_EARLY_DATA -0x7B80
@@ -324,6 +321,9 @@
324321
#define MBEDTLS_SSL_SESSION_TICKETS_DISABLED 0
325322
#define MBEDTLS_SSL_SESSION_TICKETS_ENABLED 1
326323

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+
327327
#define MBEDTLS_SSL_PRESET_DEFAULT 0
328328
#define MBEDTLS_SSL_PRESET_SUITEB 2
329329

@@ -1446,6 +1446,12 @@ struct mbedtls_ssl_config {
14461446
#endif
14471447
#if defined(MBEDTLS_SSL_SESSION_TICKETS) && \
14481448
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+
*/
14491455
uint8_t MBEDTLS_PRIVATE(session_tickets); /*!< use session tickets? */
14501456
#endif
14511457

@@ -4465,21 +4471,50 @@ int mbedtls_ssl_conf_max_frag_len(mbedtls_ssl_config *conf, unsigned char mfl_co
44654471
void mbedtls_ssl_conf_preference_order(mbedtls_ssl_config *conf, int order);
44664472
#endif /* MBEDTLS_SSL_SRV_C */
44674473

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)
44704475
/**
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.
44734478
*
44744479
* \note On server, use \c mbedtls_ssl_conf_session_tickets_cb().
44754480
*
44764481
* \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)
44794484
*/
44804485
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 */
44834518

44844519
#if defined(MBEDTLS_SSL_SESSION_TICKETS) && \
44854520
defined(MBEDTLS_SSL_SRV_C) && \
@@ -4887,6 +4922,10 @@ int mbedtls_ssl_get_session(const mbedtls_ssl_context *ssl,
48874922
* \return #MBEDTLS_ERR_SSL_HELLO_VERIFY_REQUIRED if DTLS is in use
48884923
* and the client did not demonstrate reachability yet - in
48894924
* 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.
48904929
* \return #MBEDTLS_ERR_SSL_RECEIVED_EARLY_DATA if early data, as
48914930
* defined in RFC 8446 (TLS 1.3 specification), has been
48924931
* received as part of the handshake. This is server specific
@@ -4903,6 +4942,7 @@ int mbedtls_ssl_get_session(const mbedtls_ssl_context *ssl,
49034942
* #MBEDTLS_ERR_SSL_WANT_WRITE,
49044943
* #MBEDTLS_ERR_SSL_ASYNC_IN_PROGRESS or
49054944
* #MBEDTLS_ERR_SSL_CRYPTO_IN_PROGRESS or
4945+
* #MBEDTLS_ERR_SSL_RECEIVED_NEW_SESSION_TICKET or
49064946
* #MBEDTLS_ERR_SSL_RECEIVED_EARLY_DATA,
49074947
* you must stop using the SSL context for reading or writing,
49084948
* 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)
49775017
* #MBEDTLS_ERR_SSL_WANT_READ, #MBEDTLS_ERR_SSL_WANT_WRITE,
49785018
* #MBEDTLS_ERR_SSL_ASYNC_IN_PROGRESS,
49795019
* #MBEDTLS_ERR_SSL_CRYPTO_IN_PROGRESS or
5020+
* #MBEDTLS_ERR_SSL_RECEIVED_NEW_SESSION_TICKET or
49805021
* #MBEDTLS_ERR_SSL_RECEIVED_EARLY_DATA, you must stop using
49815022
* the SSL context for reading or writing, and either free it
49825023
* or call \c mbedtls_ssl_session_reset() on it before
@@ -5045,6 +5086,17 @@ int mbedtls_ssl_renegotiate(mbedtls_ssl_context *ssl);
50455086
* \return #MBEDTLS_ERR_SSL_CLIENT_RECONNECT if we're at the server
50465087
* side of a DTLS connection and the client is initiating a
50475088
* 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().
50485100
* \return #MBEDTLS_ERR_SSL_RECEIVED_EARLY_DATA if early data, as
50495101
* defined in RFC 8446 (TLS 1.3 specification), has been
50505102
* received as part of the handshake. This is server specific
@@ -5062,6 +5114,7 @@ int mbedtls_ssl_renegotiate(mbedtls_ssl_context *ssl);
50625114
* #MBEDTLS_ERR_SSL_ASYNC_IN_PROGRESS,
50635115
* #MBEDTLS_ERR_SSL_CRYPTO_IN_PROGRESS,
50645116
* #MBEDTLS_ERR_SSL_CLIENT_RECONNECT or
5117+
* #MBEDTLS_ERR_SSL_RECEIVED_NEW_SESSION_TICKET or
50655118
* #MBEDTLS_ERR_SSL_RECEIVED_EARLY_DATA,
50665119
* you must stop using the SSL context for reading or writing,
50675120
* 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);
51275180
* operation is in progress (see mbedtls_ecp_set_max_ops()) -
51285181
* in this case you must call this function again to complete
51295182
* 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.
51305187
* \return #MBEDTLS_ERR_SSL_RECEIVED_EARLY_DATA if early data, as
51315188
* defined in RFC 8446 (TLS 1.3 specification), has been
51325189
* 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);
51435200
* #MBEDTLS_ERR_SSL_WANT_WRITE,
51445201
* #MBEDTLS_ERR_SSL_ASYNC_IN_PROGRESS,
51455202
* #MBEDTLS_ERR_SSL_CRYPTO_IN_PROGRESS or
5203+
* #MBEDTLS_ERR_SSL_RECEIVED_NEW_SESSION_TICKET or
51465204
* #MBEDTLS_ERR_SSL_RECEIVED_EARLY_DATA,
51475205
* you must stop using the SSL context for reading or writing,
51485206
* and either free it or call \c mbedtls_ssl_session_reset()

library/ssl_misc.h

+29
Original file line numberDiff line numberDiff line change
@@ -2934,8 +2934,37 @@ static inline void mbedtls_ssl_tls13_session_clear_ticket_flags(
29342934
{
29352935
session->ticket_flags &= ~(flags & MBEDTLS_SSL_TLS1_3_TICKET_FLAGS_MASK);
29362936
}
2937+
29372938
#endif /* MBEDTLS_SSL_PROTO_TLS1_3 && MBEDTLS_SSL_SESSION_TICKETS */
29382939

2940+
#if defined(MBEDTLS_SSL_SESSION_TICKETS) && defined(MBEDTLS_SSL_CLI_C)
2941+
#define MBEDTLS_SSL_SESSION_TICKETS_TLS1_2_BIT 0
2942+
#define MBEDTLS_SSL_SESSION_TICKETS_TLS1_3_BIT 1
2943+
2944+
#define MBEDTLS_SSL_SESSION_TICKETS_TLS1_2_MASK \
2945+
(1 << MBEDTLS_SSL_SESSION_TICKETS_TLS1_2_BIT)
2946+
#define MBEDTLS_SSL_SESSION_TICKETS_TLS1_3_MASK \
2947+
(1 << MBEDTLS_SSL_SESSION_TICKETS_TLS1_3_BIT)
2948+
2949+
static inline int mbedtls_ssl_conf_get_session_tickets(
2950+
const mbedtls_ssl_config *conf)
2951+
{
2952+
return conf->session_tickets & MBEDTLS_SSL_SESSION_TICKETS_TLS1_2_MASK ?
2953+
MBEDTLS_SSL_SESSION_TICKETS_ENABLED :
2954+
MBEDTLS_SSL_SESSION_TICKETS_DISABLED;
2955+
}
2956+
2957+
#if defined(MBEDTLS_SSL_PROTO_TLS1_3)
2958+
static inline int mbedtls_ssl_conf_is_signal_new_session_tickets_enabled(
2959+
const mbedtls_ssl_config *conf)
2960+
{
2961+
return conf->session_tickets & MBEDTLS_SSL_SESSION_TICKETS_TLS1_3_MASK ?
2962+
MBEDTLS_SSL_TLS1_3_SIGNAL_NEW_SESSION_TICKETS_ENABLED :
2963+
MBEDTLS_SSL_TLS1_3_SIGNAL_NEW_SESSION_TICKETS_DISABLED;
2964+
}
2965+
#endif /* MBEDTLS_SSL_PROTO_TLS1_3 */
2966+
#endif /* MBEDTLS_SSL_SESSION_TICKETS && MBEDTLS_SSL_CLI_C */
2967+
29392968
#if defined(MBEDTLS_SSL_CLI_C) && defined(MBEDTLS_SSL_PROTO_TLS1_3)
29402969
int mbedtls_ssl_tls13_finalize_client_hello(mbedtls_ssl_context *ssl);
29412970
#endif

library/ssl_msg.c

+11-5
Original file line numberDiff line numberDiff line change
@@ -5595,13 +5595,19 @@ static int ssl_tls13_handle_hs_message_post_handshake(mbedtls_ssl_context *ssl)
55955595
if (ssl_tls13_is_new_session_ticket(ssl)) {
55965596
#if defined(MBEDTLS_SSL_SESSION_TICKETS)
55975597
MBEDTLS_SSL_DEBUG_MSG(3, ("NewSessionTicket received"));
5598-
ssl->keep_current_message = 1;
5598+
if (mbedtls_ssl_conf_is_signal_new_session_tickets_enabled(ssl->conf) ==
5599+
MBEDTLS_SSL_TLS1_3_SIGNAL_NEW_SESSION_TICKETS_ENABLED) {
5600+
ssl->keep_current_message = 1;
55995601

5600-
mbedtls_ssl_handshake_set_state(ssl,
5601-
MBEDTLS_SSL_TLS1_3_NEW_SESSION_TICKET);
5602-
return MBEDTLS_ERR_SSL_WANT_READ;
5602+
mbedtls_ssl_handshake_set_state(ssl,
5603+
MBEDTLS_SSL_TLS1_3_NEW_SESSION_TICKET);
5604+
return MBEDTLS_ERR_SSL_WANT_READ;
5605+
} else {
5606+
MBEDTLS_SSL_DEBUG_MSG(3, ("Ignoring NewSessionTicket, handling disabled."));
5607+
return 0;
5608+
}
56035609
#else
5604-
MBEDTLS_SSL_DEBUG_MSG(3, ("Ignore NewSessionTicket, not supported."));
5610+
MBEDTLS_SSL_DEBUG_MSG(3, ("Ignoring NewSessionTicket, not supported."));
56055611
return 0;
56065612
#endif
56075613
}

library/ssl_tls.c

+42-3
Original file line numberDiff line numberDiff line change
@@ -3009,11 +3009,24 @@ void mbedtls_ssl_conf_renegotiation_period(mbedtls_ssl_config *conf,
30093009

30103010
#if defined(MBEDTLS_SSL_SESSION_TICKETS)
30113011
#if defined(MBEDTLS_SSL_CLI_C)
3012+
30123013
void mbedtls_ssl_conf_session_tickets(mbedtls_ssl_config *conf, int use_tickets)
30133014
{
3014-
conf->session_tickets = use_tickets;
3015+
conf->session_tickets &= ~MBEDTLS_SSL_SESSION_TICKETS_TLS1_2_MASK;
3016+
conf->session_tickets |= (use_tickets != 0) <<
3017+
MBEDTLS_SSL_SESSION_TICKETS_TLS1_2_BIT;
30153018
}
3016-
#endif
3019+
3020+
#if defined(MBEDTLS_SSL_PROTO_TLS1_3)
3021+
void mbedtls_ssl_conf_tls13_enable_signal_new_session_tickets(
3022+
mbedtls_ssl_config *conf, int signal_new_session_tickets)
3023+
{
3024+
conf->session_tickets &= ~MBEDTLS_SSL_SESSION_TICKETS_TLS1_3_MASK;
3025+
conf->session_tickets |= (signal_new_session_tickets != 0) <<
3026+
MBEDTLS_SSL_SESSION_TICKETS_TLS1_3_BIT;
3027+
}
3028+
#endif /* MBEDTLS_SSL_PROTO_TLS1_3 */
3029+
#endif /* MBEDTLS_SSL_CLI_C */
30173030

30183031
#if defined(MBEDTLS_SSL_SRV_C)
30193032

@@ -5878,7 +5891,33 @@ int mbedtls_ssl_config_defaults(mbedtls_ssl_config *conf,
58785891
if (endpoint == MBEDTLS_SSL_IS_CLIENT) {
58795892
conf->authmode = MBEDTLS_SSL_VERIFY_REQUIRED;
58805893
#if defined(MBEDTLS_SSL_SESSION_TICKETS)
5881-
conf->session_tickets = MBEDTLS_SSL_SESSION_TICKETS_ENABLED;
5894+
mbedtls_ssl_conf_session_tickets(conf, MBEDTLS_SSL_SESSION_TICKETS_ENABLED);
5895+
#if defined(MBEDTLS_SSL_PROTO_TLS1_3)
5896+
/* Contrary to TLS 1.2 tickets, TLS 1.3 NewSessionTicket message
5897+
* handling is disabled by default in Mbed TLS 3.6.x for backward
5898+
* compatibility with client applications developed using Mbed TLS 3.5
5899+
* or earlier with the default configuration.
5900+
*
5901+
* Up to Mbed TLS 3.5, in the default configuration TLS 1.3 was
5902+
* disabled, and a Mbed TLS client with the default configuration would
5903+
* establish a TLS 1.2 connection with a TLS 1.2 and TLS 1.3 capable
5904+
* server.
5905+
*
5906+
* Starting with Mbed TLS 3.6.0, TLS 1.3 is enabled by default, and thus
5907+
* an Mbed TLS client with the default configuration establishes a
5908+
* TLS 1.3 connection with a TLS 1.2 and TLS 1.3 capable server. If
5909+
* following the handshake the TLS 1.3 server sends NewSessionTicket
5910+
* messages and the Mbed TLS client processes them, this results in
5911+
* Mbed TLS high level APIs (mbedtls_ssl_read(),
5912+
* mbedtls_ssl_handshake(), ...) to eventually return an
5913+
* #MBEDTLS_ERR_SSL_RECEIVED_NEW_SESSION_TICKET non fatal error code
5914+
* (see the documentation of mbedtls_ssl_read() for more information on
5915+
* that error code). Applications unaware of that TLS 1.3 specific non
5916+
* fatal error code are then failing.
5917+
*/
5918+
mbedtls_ssl_conf_tls13_enable_signal_new_session_tickets(
5919+
conf, MBEDTLS_SSL_TLS1_3_SIGNAL_NEW_SESSION_TICKETS_DISABLED);
5920+
#endif
58825921
#endif
58835922
}
58845923
#endif

library/ssl_tls12_client.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,8 @@ static int ssl_write_session_ticket_ext(mbedtls_ssl_context *ssl,
364364

365365
*olen = 0;
366366

367-
if (ssl->conf->session_tickets == MBEDTLS_SSL_SESSION_TICKETS_DISABLED) {
367+
if (mbedtls_ssl_conf_get_session_tickets(ssl->conf) ==
368+
MBEDTLS_SSL_SESSION_TICKETS_DISABLED) {
368369
return 0;
369370
}
370371

@@ -787,7 +788,8 @@ static int ssl_parse_session_ticket_ext(mbedtls_ssl_context *ssl,
787788
const unsigned char *buf,
788789
size_t len)
789790
{
790-
if (ssl->conf->session_tickets == MBEDTLS_SSL_SESSION_TICKETS_DISABLED ||
791+
if ((mbedtls_ssl_conf_get_session_tickets(ssl->conf) ==
792+
MBEDTLS_SSL_SESSION_TICKETS_DISABLED) ||
791793
len != 0) {
792794
MBEDTLS_SSL_DEBUG_MSG(1,
793795
("non-matching session ticket extension"));

programs/ssl/ssl_client2.c

+16-3
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ int main(void)
8282
#define DFL_CID_VALUE_RENEGO NULL
8383
#define DFL_RECONNECT_HARD 0
8484
#define DFL_TICKETS MBEDTLS_SSL_SESSION_TICKETS_ENABLED
85+
#define DFL_NEW_SESSION_TICKETS MBEDTLS_SSL_TLS1_3_SIGNAL_NEW_SESSION_TICKETS_ENABLED
8586
#define DFL_ALPN_STRING NULL
8687
#define DFL_GROUPS NULL
8788
#define DFL_SIG_ALGS NULL
@@ -198,7 +199,8 @@ int main(void)
198199

199200
#if defined(MBEDTLS_SSL_SESSION_TICKETS)
200201
#define USAGE_TICKETS \
201-
" tickets=%%d default: 1 (enabled)\n"
202+
" tickets=%%d default: 1 (enabled)\n" \
203+
" new_session_tickets=%%d default: 1 (enabled)\n"
202204
#else
203205
#define USAGE_TICKETS ""
204206
#endif /* MBEDTLS_SSL_SESSION_TICKETS */
@@ -514,7 +516,8 @@ struct options {
514516
int reco_delay; /* delay in seconds before resuming session */
515517
int reco_mode; /* how to keep the session around */
516518
int reconnect_hard; /* unexpectedly reconnect from the same port */
517-
int tickets; /* enable / disable session tickets */
519+
int tickets; /* enable / disable session tickets (TLS 1.2) */
520+
int new_session_tickets; /* enable / disable new session tickets (TLS 1.3) */
518521
const char *groups; /* list of supported groups */
519522
const char *sig_algs; /* supported TLS 1.3 signature algorithms */
520523
const char *alpn_string; /* ALPN supported protocols */
@@ -969,6 +972,7 @@ int main(int argc, char *argv[])
969972
opt.reco_mode = DFL_RECO_MODE;
970973
opt.reconnect_hard = DFL_RECONNECT_HARD;
971974
opt.tickets = DFL_TICKETS;
975+
opt.new_session_tickets = DFL_NEW_SESSION_TICKETS;
972976
opt.alpn_string = DFL_ALPN_STRING;
973977
opt.groups = DFL_GROUPS;
974978
opt.sig_algs = DFL_SIG_ALGS;
@@ -1226,6 +1230,11 @@ int main(int argc, char *argv[])
12261230
if (opt.tickets < 0) {
12271231
goto usage;
12281232
}
1233+
} else if (strcmp(p, "new_session_tickets") == 0) {
1234+
opt.new_session_tickets = atoi(q);
1235+
if (opt.new_session_tickets < 0) {
1236+
goto usage;
1237+
}
12291238
} else if (strcmp(p, "alpn") == 0) {
12301239
opt.alpn_string = q;
12311240
} else if (strcmp(p, "extended_ms") == 0) {
@@ -1936,7 +1945,11 @@ int main(int argc, char *argv[])
19361945

19371946
#if defined(MBEDTLS_SSL_SESSION_TICKETS)
19381947
mbedtls_ssl_conf_session_tickets(&conf, opt.tickets);
1939-
#endif
1948+
#if defined(MBEDTLS_SSL_PROTO_TLS1_3)
1949+
mbedtls_ssl_conf_tls13_enable_signal_new_session_tickets(
1950+
&conf, opt.new_session_tickets);
1951+
#endif /* MBEDTLS_SSL_PROTO_TLS1_3 */
1952+
#endif /* MBEDTLS_SSL_SESSION_TICKETS */
19401953

19411954
if (opt.force_ciphersuite[0] != DFL_FORCE_CIPHER) {
19421955
mbedtls_ssl_conf_ciphersuites(&conf, opt.force_ciphersuite);

0 commit comments

Comments
 (0)