File 1662-ssl-Move-main-logic-to-to-top-function.patch of Package erlang
From 267368c11974414385ff800618b6608c913adb2d Mon Sep 17 00:00:00 2001
From: Ingela Anderton Andin <ingela@erlang.org>
Date: Thu, 4 Dec 2025 12:48:39 +0100
Subject: [PATCH 2/4] ssl: Move main logic to to top function
---
lib/ssl/src/tls_server_connection_1_3.erl | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/lib/ssl/src/tls_server_connection_1_3.erl b/lib/ssl/src/tls_server_connection_1_3.erl
index 79f0999263..e907258084 100644
--- a/lib/ssl/src/tls_server_connection_1_3.erl
+++ b/lib/ssl/src/tls_server_connection_1_3.erl
@@ -255,7 +255,10 @@ negotiated(internal, {start_handshake, _} = Message, State0) ->
case send_hello_flight(Message, State0) of
#alert{} = Alert ->
ssl_gen_statem:handle_own_alert(Alert, ?STATE(negotiated), State0);
- {State, NextState} ->
+ {State1, NextState} ->
+ State2 = tls_handshake_1_3:calculate_write_traffic_secrets(State1),
+ State = ssl_record:step_encryption_state_write(State2),
+ maybe_keylog(State),
{next_state, NextState, State, []}
end;
negotiated(info, Msg, State) ->
@@ -581,11 +584,7 @@ send_hello_flight({start_handshake, PSK0},
State9 = Connection:queue_handshake(Finished, State8),
%% Send first flight
- {State10, _} = Connection:send_handshake_flight(State9),
-
- State11 = tls_handshake_1_3:calculate_write_traffic_secrets(State10),
- State = ssl_record:step_encryption_state_write(State11),
- maybe_keylog(State),
+ {State, _} = Connection:send_handshake_flight(State9),
{State, NextState}
catch
--
2.51.0