Skip to content

Commit ba831a6

Browse files
rabbit_ssl: support Erlang 21 and 22 suite formatting API
1 parent cf5dee0 commit ba831a6

File tree

1 file changed

+30
-4
lines changed

1 file changed

+30
-4
lines changed

src/rabbit_ssl.erl

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,12 @@
3030

3131
% Due to API differences between OTP releases.
3232
-dialyzer(no_missing_calls).
33-
-ignore_xref([{ssl_cipher_format, erl_suite_definition, 1},
33+
-ignore_xref([{ssl_cipher_format, suite_legacy, 1},
3434
{ssl_cipher_format, suite, 1},
35-
{ssl_cipher_format, openssl_suite_name, 1}]).
35+
{ssl_cipher_format, suite_to_str, 1},
36+
{ssl_cipher_format, erl_suite_definition, 1},
37+
{ssl_cipher_format, suite_map_to_openssl_str, 1},
38+
{ssl_cipher_format, suite_map_to_bin, 1}]).
3639

3740
-type certificate() :: rabbit_cert_info:certificate().
3841

@@ -77,10 +80,33 @@ cipher_suites_openssl(Mode, Version) ->
7780

7881

7982
format_cipher_erlang(Cipher) ->
80-
ssl_cipher_format:erl_suite_definition(ssl_cipher_format:suite(Cipher)).
83+
case erlang:function_exported(ssl_cipher_format, suite_map_to_bin, 1) of
84+
true ->
85+
format_cipher_erlang22(Cipher);
86+
false ->
87+
format_cipher_erlang21(Cipher)
88+
end.
89+
90+
format_cipher_erlang22(Cipher) ->
91+
ssl_cipher_format:suite_legacy(ssl_cipher_format:suite_map_to_bin(Cipher)).
92+
93+
format_cipher_erlang21(Cipher) ->
94+
ssl_cipher_format:erl_suite_definition(ssl_cipher_format:suite(Cipher)).
95+
8196

8297
format_cipher_openssl(Cipher) ->
83-
ssl_cipher_format:openssl_suite_name(ssl_cipher_format:suite(Cipher)).
98+
case erlang:function_exported(ssl_cipher_format, suite_map_to_bin, 1) of
99+
true ->
100+
format_cipher_openssl22(Cipher);
101+
false ->
102+
format_cipher_openssl21(Cipher)
103+
end.
104+
105+
format_cipher_openssl22(Cipher) ->
106+
ssl_cipher_format:suite_map_to_openssl_str(Cipher).
107+
108+
format_cipher_openssl21(Cipher) ->
109+
ssl_cipher_format:suite_to_str(Cipher).
84110

85111
-spec get_highest_protocol_version() -> tls_record:tls_version().
86112
get_highest_protocol_version() ->

0 commit comments

Comments
 (0)