Skip to content

Commit 1ea2ea9

Browse files
committed
ssl: pre_shared_key shall be last client hello extension
1 parent defa508 commit 1ea2ea9

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
@@ -2687,9 +2687,13 @@ encode_psk_binders(Binders) ->
26872687
Len = byte_size(Result),
26882688
<<?UINT16(Len), Result/binary>>.
26892689

2690-
26912690
hello_extensions_list(HelloExtensions) ->
2692-
[Ext || {_, Ext} <- maps:to_list(HelloExtensions), Ext =/= undefined].
2691+
case maps:take(pre_shared_key, HelloExtensions) of
2692+
{#pre_shared_key_client_hello{} = PSK, Rest} ->
2693+
[Ext || {_, Ext} <- maps:to_list(Rest), Ext =/= undefined] ++ [PSK];
2694+
_ ->
2695+
[Ext || {_, Ext} <- maps:to_list(HelloExtensions), Ext =/= undefined]
2696+
end.
26932697

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

0 commit comments

Comments
 (0)