summaryrefslogtreecommitdiff
path: root/lib/crypto/test
diff options
context:
space:
mode:
authorHans Nilsson <hans@erlang.org>2021-12-02 10:46:30 +0100
committerHans Nilsson <hans@erlang.org>2022-01-24 13:37:52 +0100
commitb941a647219c435291d6d2cf97cd605fae2b3d30 (patch)
tree0c6e0a7138c27ac1852ce5c9669e224de6c30304 /lib/crypto/test
parented79ba15aa0b92dee3f0c8161d16f1d35d654547 (diff)
downloaderlang-b941a647219c435291d6d2cf97cd605fae2b3d30.tar.gz
crypto: Include cryptolib error msgs in crypto errors
Diffstat (limited to 'lib/crypto/test')
-rw-r--r--lib/crypto/test/crypto_SUITE.erl15
-rw-r--r--lib/crypto/test/property_test/crypto_ng_api.erl14
2 files changed, 21 insertions, 8 deletions
diff --git a/lib/crypto/test/crypto_SUITE.erl b/lib/crypto/test/crypto_SUITE.erl
index a3ea7fd0a7..99a22d3d5a 100644
--- a/lib/crypto/test/crypto_SUITE.erl
+++ b/lib/crypto/test/crypto_SUITE.erl
@@ -553,7 +553,16 @@ init_per_testcase(generate, Config) ->
init_per_testcase(hmac, Config) ->
configure_mac(hmac, proplists:get_value(type,Config), Config);
init_per_testcase(_Name,Config) ->
- Config.
+ Skip =
+ lists:member(_Name, [%%i_ng_tls
+%% , node_supports_cache
+ ]) andalso
+ asan == maps:get(compile_type, crypto:info(), undefined) andalso
+ lists:prefix("OpenSSL 3.0.0 ", maps:get(cryptolib_version_linked, crypto:info(), "")),
+ case Skip of
+ true -> {skip, "Coredumps 3.0.0 asan"};
+ false -> Config
+ end.
end_per_testcase(info, Config) ->
Config;
@@ -4314,11 +4323,11 @@ bad_combo(_Config) ->
bad_key_length(_Config) ->
?chk_api_name(crypto:crypto_dyn_iv_init(des_ede3_cbc, <<1>>, true),
- error:{error,{"api_ng.c",_},"Can't initialize context, key_length"}).
+ error:{error,{"api_ng.c",_},"Can't initialize context, key_length"++_}).
bad_cipher_name(_Config) ->
?chk_api_name(crypto:crypto_init(foobar, <<1:128>>, true),
- error:{badarg,{"api_ng.c",_Line},"Unknown cipher"}).
+ error:{badarg,{"api_ng.c",_Line},"Unknown cipher"++_}).
bad_generate_key_name(_Config) ->
?chk_api_name(crypto:generate_key(foobar, [1024]),
diff --git a/lib/crypto/test/property_test/crypto_ng_api.erl b/lib/crypto/test/property_test/crypto_ng_api.erl
index b3decf1cbe..d7a716e4f8 100644
--- a/lib/crypto/test/property_test/crypto_ng_api.erl
+++ b/lib/crypto/test/property_test/crypto_ng_api.erl
@@ -105,11 +105,15 @@ decrypt_encrypt_one_time(Cipher, Key, IV, TextPlain, Padding) ->
element(1, split_binary(TextDecryptPadded, size(TextDecryptPadded) - PadSize))
catch
error:{error,{"api_ng.c",Line},Msg} when ExcessBytesLastBlock>0,
- Padding == none,
- Msg == "Padding 'none' but unfilled last block" ->
- io:format("~p:~p Correct exception: ~p",
- [?MODULE,?LINE, {error,{"api_ng.c",Line},Msg}]),
- correct_exception
+ Padding == none ->
+ case Msg of
+ "Padding 'none' but unfilled last block"++_ ->
+ io:format("~p:~p Correct exception: ~p",
+ [?MODULE,?LINE, {error,{"api_ng.c",Line},Msg}]),
+ correct_exception;
+ _ ->
+ error({error,{"api_ng.c",Line},Msg})
+ end
end.