Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/ssl/src/ssl.erl
Original file line number Diff line number Diff line change
Expand Up @@ -2128,6 +2128,7 @@ Key value list convening some information about the established connection.
-type connection_info() :: [{protocol, protocol_version()} |
{session_resumption, boolean()} |
{selected_cipher_suite, erl_cipher_suite()} |
{selected_group, group()} |
{sni_hostname, term()} |
{ciphers, [erl_cipher_suite()]}] |
connection_info_pre_tls13() |
Expand Down Expand Up @@ -2163,6 +2164,7 @@ TLS connection keys for which information can be retrieved.
""".
-type connection_info_keys() :: [ protocol
| selected_cipher_suite
| selected_group
| sni_hostname
| session_resumption
| ciphers
Expand Down
11 changes: 10 additions & 1 deletion lib/ssl/src/ssl_gen_statem.erl
Original file line number Diff line number Diff line change
Expand Up @@ -1931,13 +1931,22 @@ connection_info(#state{handshake_env = #handshake_env{sni_hostname = SNIHostname
_ ->
[]
end,
GroupInfo = case Version of
?TLS_1_3 when is_atom(ECCCurve), ECCCurve =/= undefined ->
%% For TLS-1.3 the named group of the key exchange is
%% negotiated via the supported_groups and key_share
%% extensions and is kept in session.ecc
[{selected_group, ECCCurve}];
_ ->
[]
end,
[{protocol, RecordCB:protocol_version(Version)},
{session_id, SessionId},
{session_data, term_to_binary(Session)},
{session_resumption, Resumption},
{selected_cipher_suite, CipherSuiteDef},
{sni_hostname, SNIHostname},
{srp_username, SrpUsername} | CurveInfo] ++ MFLInfo ++ ssl_options_list(Opts).
{srp_username, SrpUsername} | CurveInfo] ++ GroupInfo ++ MFLInfo ++ ssl_options_list(Opts).

security_info(#state{connection_states = #{current_read := Read,
current_write := Write},
Expand Down
9 changes: 9 additions & 0 deletions lib/ssl/test/ssl_api_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -4098,6 +4098,15 @@ secs_since_1970() ->

connection_information_result(Socket) ->
{ok, Info = [_ | _]} = ssl:connection_information(Socket),
case proplists:get_value(protocol, Info) of
'tlsv1.3' ->
%% For TLS-1.3 the negotiated key exchange group is exposed
{ok, [{selected_group, Group}]} =
ssl:connection_information(Socket, [selected_group]),
true = lists:member(Group, ssl:groups());
_ ->
false = proplists:is_defined(selected_group, Info)
end,
case length(Info) > 3 of
true ->
%% At least one ssl_option() is set
Expand Down