Skip to content

Commit 6146f0d

Browse files
committed
Merge branch 'maint'
2 parents a49f78c + 1be3263 commit 6146f0d

3 files changed

Lines changed: 21 additions & 1 deletion

File tree

lib/ssl/src/ssl.erl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2128,6 +2128,7 @@ Key value list convening some information about the established connection.
21282128
-type connection_info() :: [{protocol, protocol_version()} |
21292129
{session_resumption, boolean()} |
21302130
{selected_cipher_suite, erl_cipher_suite()} |
2131+
{selected_group, group()} |
21312132
{sni_hostname, term()} |
21322133
{ciphers, [erl_cipher_suite()]}] |
21332134
connection_info_pre_tls13() |
@@ -2163,6 +2164,7 @@ TLS connection keys for which information can be retrieved.
21632164
""".
21642165
-type connection_info_keys() :: [ protocol
21652166
| selected_cipher_suite
2167+
| selected_group
21662168
| sni_hostname
21672169
| session_resumption
21682170
| ciphers

lib/ssl/src/ssl_gen_statem.erl

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1931,13 +1931,22 @@ connection_info(#state{handshake_env = #handshake_env{sni_hostname = SNIHostname
19311931
_ ->
19321932
[]
19331933
end,
1934+
GroupInfo = case Version of
1935+
?TLS_1_3 when is_atom(ECCCurve), ECCCurve =/= undefined ->
1936+
%% For TLS-1.3 the named group of the key exchange is
1937+
%% negotiated via the supported_groups and key_share
1938+
%% extensions and is kept in session.ecc
1939+
[{selected_group, ECCCurve}];
1940+
_ ->
1941+
[]
1942+
end,
19341943
[{protocol, RecordCB:protocol_version(Version)},
19351944
{session_id, SessionId},
19361945
{session_data, term_to_binary(Session)},
19371946
{session_resumption, Resumption},
19381947
{selected_cipher_suite, CipherSuiteDef},
19391948
{sni_hostname, SNIHostname},
1940-
{srp_username, SrpUsername} | CurveInfo] ++ MFLInfo ++ ssl_options_list(Opts).
1949+
{srp_username, SrpUsername} | CurveInfo] ++ GroupInfo ++ MFLInfo ++ ssl_options_list(Opts).
19411950

19421951
security_info(#state{connection_states = #{current_read := Read,
19431952
current_write := Write},

lib/ssl/test/ssl_api_SUITE.erl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4098,6 +4098,15 @@ secs_since_1970() ->
40984098

40994099
connection_information_result(Socket) ->
41004100
{ok, Info = [_ | _]} = ssl:connection_information(Socket),
4101+
case proplists:get_value(protocol, Info) of
4102+
'tlsv1.3' ->
4103+
%% For TLS-1.3 the negotiated key exchange group is exposed
4104+
{ok, [{selected_group, Group}]} =
4105+
ssl:connection_information(Socket, [selected_group]),
4106+
true = lists:member(Group, ssl:groups());
4107+
_ ->
4108+
false = proplists:is_defined(selected_group, Info)
4109+
end,
41014110
case length(Info) > 3 of
41024111
true ->
41034112
%% At least one ssl_option() is set

0 commit comments

Comments
 (0)