File 0713-ssl-Move-main-logic-to-to-top-function.patch of Package erlang
From 6a6fd90ec353d09def8110add2ba57c674524bf4 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 3/5] 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 1ec2bac1a5..75babb99b4 100644
--- a/lib/ssl/src/tls_server_connection_1_3.erl
+++ b/lib/ssl/src/tls_server_connection_1_3.erl
@@ -257,7 +257,10 @@ negotiated(internal, {start_handshake, _} = Message, State0) ->
case send_hello_flight(Message, State0) of
#alert{} = Alert ->
ssl_gen_statem:handle_own_alert(Alert, 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) ->
@@ -583,11 +586,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