summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIngela Anderton Andin <ingela@erlang.org>2023-04-06 15:53:36 +0200
committerIngela Anderton Andin <ingela@erlang.org>2023-04-06 20:56:44 +0200
commitf52cace8078d59447d30e38b7a48fa793d1af60a (patch)
treed31576df513719d24a473a841dbf0f136a3fa8f7
parent5400ccf243a31d664153a4b9ceb9de3edfce1e0e (diff)
downloaderlang-f52cace8078d59447d30e38b7a48fa793d1af60a.tar.gz
ssl: Honor signatur alogithm input order
List was accidently reversed
-rw-r--r--lib/ssl/src/ssl_cipher.erl4
-rw-r--r--lib/ssl/test/ssl_cipher_SUITE.erl9
2 files changed, 9 insertions, 4 deletions
diff --git a/lib/ssl/src/ssl_cipher.erl b/lib/ssl/src/ssl_cipher.erl
index 87dd624306..6e952a4584 100644
--- a/lib/ssl/src/ssl_cipher.erl
+++ b/lib/ssl/src/ssl_cipher.erl
@@ -647,7 +647,7 @@ signature_scheme(SignAlgo) when is_integer(SignAlgo) ->
signature_scheme(_) -> unassigned.
signature_schemes_1_2(SigAlgs) ->
- lists:foldl(fun(Alg, Acc) when is_atom(Alg) ->
+ lists:reverse(lists:foldl(fun(Alg, Acc) when is_atom(Alg) ->
case scheme_to_components(Alg) of
{Hash, Sign = rsa_pss_pss,_} ->
[{Hash, Sign} | Acc];
@@ -658,7 +658,7 @@ signature_schemes_1_2(SigAlgs) ->
end;
(Alg, Acc) ->
[Alg| Acc]
- end, [], SigAlgs).
+ end, [], SigAlgs)).
%% TODO: reserved code points?
diff --git a/lib/ssl/test/ssl_cipher_SUITE.erl b/lib/ssl/test/ssl_cipher_SUITE.erl
index def13d0860..70c0b50d4a 100644
--- a/lib/ssl/test/ssl_cipher_SUITE.erl
+++ b/lib/ssl/test/ssl_cipher_SUITE.erl
@@ -41,7 +41,8 @@
aes_decipher_good/1,
aes_decipher_fail/0,
aes_decipher_fail/1,
- padding_test/1
+ padding_test/1,
+ sign_algorithms/1
]).
@@ -49,7 +50,7 @@
%% Common Test interface functions -----------------------------------
%%--------------------------------------------------------------------
all() ->
- [aes_decipher_good, aes_decipher_fail, padding_test].
+ [aes_decipher_good, aes_decipher_fail, padding_test, sign_algorithms].
groups() ->
[].
@@ -122,6 +123,10 @@ padding_test(Config) when is_list(Config) ->
pad_test(HashSz, CipherState, {3,2}),
pad_test(HashSz, CipherState, {3,3}).
+%%--------------------------------------------------------------------
+sign_algorithms(Config) when is_list(Config) ->
+ [{sha256,rsa_pss_pss},{rsa,sha256}] = ssl_cipher:signature_schemes_1_2([rsa_pss_pss_sha256, {rsa, sha256}]).
+
%%--------------------------------------------------------------------
% Internal functions --------------------------------------------------------
%%--------------------------------------------------------------------