From e3084e7316055e13cd0fa6ccee498e2570c1a22e Mon Sep 17 00:00:00 2001 From: EdouardMalot Date: Fri, 26 Jun 2026 15:30:42 +0200 Subject: [PATCH] Fix TLS 1.3 server: don't send NewSessionTicket (resumption is unsupported) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit _nx_secure_tls_1_3_server_handshake.c sent a NewSessionTicket after every Client Finished, advertising session resumption to the client. But _nx_secure_tls_process_clienthello_psk_extension explicitly rejects any PSK with age != 0 (i.e. every real resumption attempt) with NX_SECURE_TLS_BAD_CLIENTHELLO_PSK_EXTENSION — the existing implementation only supports external PSKs. Net effect on clients that act on the advertised ticket (Java JSSE in particular): every other handshake fails. Conn N succeeds + caches the ticket; conn N+1 replays the ticket → server sends Alert(internal_error) → JSSE invalidates the cache; conn N+2 succeeds; loop. Fix: skip the NewSessionTicket send. The PSK consumer code stays as-is so any future external-PSK use case is unaffected. --- .../src/nx_secure_tls_1_3_server_handshake.c | 23 ++++++++----------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/nx_secure/src/nx_secure_tls_1_3_server_handshake.c b/nx_secure/src/nx_secure_tls_1_3_server_handshake.c index 2ae1cd1cf..c581349e5 100644 --- a/nx_secure/src/nx_secure_tls_1_3_server_handshake.c +++ b/nx_secure/src/nx_secure_tls_1_3_server_handshake.c @@ -559,20 +559,15 @@ NX_SECURE_TLS_SERVER_STATE old_server_state; /* Post-Auth server messages (if any) are sent here. */ - /* For session resumption, send a NewSessionTicket message to allow for resumption PSK to be generated. */ - status = _nx_secure_tls_allocate_handshake_packet(tls_session, packet_pool, &send_packet, wait_option); - if (status != NX_SUCCESS) - { - break; - } - - /* Populate the packet with our NewSessionTicket Message. */ - status = _nx_secure_tls_send_newsessionticket(tls_session, send_packet); - status = _nx_secure_tls_send_handshake_record(tls_session, send_packet, NX_SECURE_TLS_NEW_SESSION_TICKET, wait_option); - if(status != NX_SUCCESS) - { - break; - } + /* Do NOT send a NewSessionTicket. The PSK extension handler in + * _nx_secure_tls_process_clienthello_psk_extension explicitly + * rejects any age != 0 (i.e. every real resumption attempt) with + * NX_SECURE_TLS_BAD_CLIENTHELLO_PSK_EXTENSION — the server only + * supports external PSKs, not resumption. Sending a ticket + * anyway tells the client we DO resume; clients that act on + * that (e.g. Java JSSE) replay the ticket on the next handshake + * and the server then aborts with an Alert(internal_error), + * breaking every other connection from those clients. */ /* If we get here, the Client Finished was processed without errors and the handshake is complete. */ tls_session -> nx_secure_tls_server_state = NX_SECURE_TLS_SERVER_STATE_HANDSHAKE_FINISHED;