diff options
author | Hans Nilsson <[email protected]> | 2018-08-17 10:09:09 +0200 |
---|---|---|
committer | Hans Nilsson <[email protected]> | 2018-08-17 10:09:09 +0200 |
commit | 48a3d57d456158ac1aafb1d2495bd222004f037c (patch) | |
tree | 20bf045db968a2c74b4e6aa6bdb6343efe18756c /lib/crypto/test | |
parent | d5af8b1f34f3e7b3f17711787de4ffb0903b54ad (diff) | |
parent | 282ccae87d9629499d3f1669d72484ff27df663f (diff) | |
download | otp-48a3d57d456158ac1aafb1d2495bd222004f037c.tar.gz otp-48a3d57d456158ac1aafb1d2495bd222004f037c.tar.bz2 otp-48a3d57d456158ac1aafb1d2495bd222004f037c.zip |
Merge branch 'maint'
* maint:
ssh: Use the 'macs' tag in crypto:supports/0
ssh: Use the new crypto:supports/0 tag 'curves'
crypto: Try to generate ecdh for all crypto:curves()
crypto: Put curve list in C
Diffstat (limited to 'lib/crypto/test')
-rw-r--r-- | lib/crypto/test/crypto_SUITE.erl | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/lib/crypto/test/crypto_SUITE.erl b/lib/crypto/test/crypto_SUITE.erl index e5f86ea573..1027a8d945 100644 --- a/lib/crypto/test/crypto_SUITE.erl +++ b/lib/crypto/test/crypto_SUITE.erl @@ -134,7 +134,7 @@ groups() -> ]}, {dh, [], [generate_compute, compute_bug]}, - {ecdh, [], [compute, generate]}, + {ecdh, [], [generate_all_supported, compute, generate]}, {srp, [], [generate_compute]}, {des_cbc, [], [block]}, {des_cfb, [], [block]}, @@ -510,6 +510,33 @@ compute(Config) when is_list(Config) -> Gen = proplists:get_value(compute, Config), lists:foreach(fun do_compute/1, Gen). %%-------------------------------------------------------------------- +generate_all_supported() -> + [{doc, " Test that all curves from crypto:ec_curves/0 returns two binaries"}]. +generate_all_supported(_Config) -> + Results = + [try + crypto:generate_key(ecdh, C) + of + {B1,B2} when is_binary(B1) and is_binary(B2) -> + %% That is, seems like it works as expected. + {ok,C}; + Err -> + ct:log("ERROR: Curve ~p generated ~p", [C,Err]), + {error,{C,Err}} + catch + Cls:Err:Stack -> + ct:log("ERROR: Curve ~p exception ~p:~p~n~p", [C,Cls,Err,Stack]), + {error,{C,{Cls,Err}}} + end + || C <- crypto:ec_curves() + ], + OK = [C || {ok,C} <- Results], + ct:log("Ok (len=~p): ~p", [length(OK), OK]), + false = lists:any(fun({error,_}) -> true; + (_) -> false + end, Results). + +%%-------------------------------------------------------------------- generate() -> [{doc, " Test crypto:generate_key"}]. generate(Config) when is_list(Config) -> |