File 1522-ssl-pre_shared_key-shall-be-last-client-hello-extens.patch of Package erlang
From 57325171dbf0df20698e17333ddd8a745d3f8803 Mon Sep 17 00:00:00 2001
From: Ingela Anderton Andin <ingela@erlang.org>
Date: Fri, 17 Oct 2025 16:17:18 +0200
Subject: [PATCH 2/3] ssl: pre_shared_key shall be last client hello extension
---
lib/ssl/src/ssl_handshake.erl | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/lib/ssl/src/ssl_handshake.erl b/lib/ssl/src/ssl_handshake.erl
index 74af182533..84992b81b7 100644
--- a/lib/ssl/src/ssl_handshake.erl
+++ b/lib/ssl/src/ssl_handshake.erl
@@ -2701,9 +2701,13 @@ encode_psk_binders(Binders) ->
Len = byte_size(Result),
<<?UINT16(Len), Result/binary>>.
-
hello_extensions_list(HelloExtensions) ->
- [Ext || {_, Ext} <- maps:to_list(HelloExtensions), Ext =/= undefined].
+ case maps:take(pre_shared_key, HelloExtensions) of
+ {#pre_shared_key_client_hello{} = PSK, Rest} ->
+ [Ext || {_, Ext} <- maps:to_list(Rest), Ext =/= undefined] ++ [PSK];
+ _ ->
+ [Ext || {_, Ext} <- maps:to_list(HelloExtensions), Ext =/= undefined]
+ end.
%%-------------Decode handshakes---------------------------------
dec_server_key(<<?UINT16(PLen), P:PLen/binary,
--
2.51.0