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 21:35:09 +0200
commitbd0f01edc297de15754635b3b2e6a3ec964c97a1 (patch)
treeff8cb8c657cd695de3a9a68c33032443dff9b27a
parent68522e556c020de5fe7e20c4c082927a5d04d8e7 (diff)
downloaderlang-bd0f01edc297de15754635b3b2e6a3ec964c97a1.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 f567bd6c53..b0abdbdf19 100644
--- a/lib/ssl/src/ssl_cipher.erl
+++ b/lib/ssl/src/ssl_cipher.erl
@@ -645,7 +645,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];
@@ -656,7 +656,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 40592870a1..668702dc85 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() ->
[].
@@ -114,6 +115,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 --------------------------------------------------------
%%--------------------------------------------------------------------