Skip to content

Commit 5732517

Browse files
committed
ssl: pre_shared_key shall be last client hello extension
1 parent d6bbb44 commit 5732517

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/ssl/src/ssl_handshake.erl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2701,9 +2701,13 @@ encode_psk_binders(Binders) ->
27012701
Len = byte_size(Result),
27022702
<<?UINT16(Len), Result/binary>>.
27032703

2704-
27052704
hello_extensions_list(HelloExtensions) ->
2706-
[Ext || {_, Ext} <- maps:to_list(HelloExtensions), Ext =/= undefined].
2705+
case maps:take(pre_shared_key, HelloExtensions) of
2706+
{#pre_shared_key_client_hello{} = PSK, Rest} ->
2707+
[Ext || {_, Ext} <- maps:to_list(Rest), Ext =/= undefined] ++ [PSK];
2708+
_ ->
2709+
[Ext || {_, Ext} <- maps:to_list(HelloExtensions), Ext =/= undefined]
2710+
end.
27072711

27082712
%%-------------Decode handshakes---------------------------------
27092713
dec_server_key(<<?UINT16(PLen), P:PLen/binary,

0 commit comments

Comments
 (0)