diff options
author | Michael Klishin <mklishin@pivotal.io> | 2019-04-29 00:47:05 +0300 |
---|---|---|
committer | Michael Klishin <mklishin@pivotal.io> | 2019-04-29 00:47:05 +0300 |
commit | ba831a6a747b3bbe51f7b380ef22bcf33be19a8f (patch) | |
tree | 80397bde930e1412f5dd0916ca792327f47a2c97 | |
parent | cf5dee0127b6aa7aeee633bf81cd2945178df2d6 (diff) | |
download | rabbitmq-server-git-ba831a6a747b3bbe51f7b380ef22bcf33be19a8f.tar.gz |
rabbit_ssl: support Erlang 21 and 22 suite formatting API
-rw-r--r-- | src/rabbit_ssl.erl | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/src/rabbit_ssl.erl b/src/rabbit_ssl.erl index e20a8f2f72..c07d255268 100644 --- a/src/rabbit_ssl.erl +++ b/src/rabbit_ssl.erl @@ -30,9 +30,12 @@ % Due to API differences between OTP releases. -dialyzer(no_missing_calls). --ignore_xref([{ssl_cipher_format, erl_suite_definition, 1}, +-ignore_xref([{ssl_cipher_format, suite_legacy, 1}, {ssl_cipher_format, suite, 1}, - {ssl_cipher_format, openssl_suite_name, 1}]). + {ssl_cipher_format, suite_to_str, 1}, + {ssl_cipher_format, erl_suite_definition, 1}, + {ssl_cipher_format, suite_map_to_openssl_str, 1}, + {ssl_cipher_format, suite_map_to_bin, 1}]). -type certificate() :: rabbit_cert_info:certificate(). @@ -77,10 +80,33 @@ cipher_suites_openssl(Mode, Version) -> format_cipher_erlang(Cipher) -> - ssl_cipher_format:erl_suite_definition(ssl_cipher_format:suite(Cipher)). + case erlang:function_exported(ssl_cipher_format, suite_map_to_bin, 1) of + true -> + format_cipher_erlang22(Cipher); + false -> + format_cipher_erlang21(Cipher) + end. + +format_cipher_erlang22(Cipher) -> + ssl_cipher_format:suite_legacy(ssl_cipher_format:suite_map_to_bin(Cipher)). + +format_cipher_erlang21(Cipher) -> + ssl_cipher_format:erl_suite_definition(ssl_cipher_format:suite(Cipher)). + format_cipher_openssl(Cipher) -> - ssl_cipher_format:openssl_suite_name(ssl_cipher_format:suite(Cipher)). + case erlang:function_exported(ssl_cipher_format, suite_map_to_bin, 1) of + true -> + format_cipher_openssl22(Cipher); + false -> + format_cipher_openssl21(Cipher) + end. + +format_cipher_openssl22(Cipher) -> + ssl_cipher_format:suite_map_to_openssl_str(Cipher). + +format_cipher_openssl21(Cipher) -> + ssl_cipher_format:suite_to_str(Cipher). -spec get_highest_protocol_version() -> tls_record:tls_version(). get_highest_protocol_version() -> |