aboutsummaryrefslogtreecommitdiffstats
path: root/lib/crypto/test
diff options
context:
space:
mode:
authorHans Nilsson <[email protected]>2019-01-15 17:53:04 +0100
committerHans Nilsson <[email protected]>2019-01-25 18:01:07 +0100
commit7d0cd370e4ae22f3d23511e15db6dfc56789298e (patch)
treed8d720784c63c69768d60d08a2fd4e0bd1a732c4 /lib/crypto/test
parent2f63360dc84bca1f6c98fb3479fc41420f5926e7 (diff)
downloadotp-7d0cd370e4ae22f3d23511e15db6dfc56789298e.tar.gz
otp-7d0cd370e4ae22f3d23511e15db6dfc56789298e.tar.bz2
otp-7d0cd370e4ae22f3d23511e15db6dfc56789298e.zip
crypto: Reorg
Diffstat (limited to 'lib/crypto/test')
-rw-r--r--lib/crypto/test/crypto_bench_SUITE.erl49
1 files changed, 31 insertions, 18 deletions
diff --git a/lib/crypto/test/crypto_bench_SUITE.erl b/lib/crypto/test/crypto_bench_SUITE.erl
index 79340a17d6..c66a27f0c8 100644
--- a/lib/crypto/test/crypto_bench_SUITE.erl
+++ b/lib/crypto/test/crypto_bench_SUITE.erl
@@ -33,29 +33,39 @@ suite() -> [%%{ct_hooks,[{ts_install_cth,[{nodenames,2}]}]},
all() ->
[
- {group, ciphers_128}
+ {group, textblock_256}
].
groups() ->
[
- {ciphers_128, [{repeat, 3}], [{group,textblock_256}
+ {textblock_256, [], [
+ {group, ciphers_128},
+ {group, ciphers_256}
+ ]},
+
+ {ciphers_128, [{repeat, 5}], [
+ block,
+ stream
]},
- {textblock_256, [{repeat,2}], [
- block,
- stream
- ]}
+ {ciphers_256, [{repeat, 5}], [
+ block,
+ stream,
+ chacha
+ ]}
].
%%%----------------------------------------------------------------
%%%
-init_per_suite(Config) ->
+init_per_suite(Config0) ->
try crypto:start() of
_ ->
[{_,_,Info}] = crypto:info_lib(),
ct:comment("~s",[Info]),
ct:pal("Crypto version: ~p~n~n~p",[Info,crypto:supports()]),
- calibrate([{sec_goal,10} | Config])
+ Config1 = measure_openssl_aes_cbc([128,256], Config0),
+ calibrate([{sec_goal,10} | Config1])
+
catch _:_ ->
{fail, "Crypto did not start"}
end.
@@ -66,12 +76,10 @@ end_per_suite(_Config) ->
%%%----------------------------------------------------------------
%%%
init_per_group(Group, Config) ->
- ct:pal("~p(~p,..)",[?FUNCTION_NAME,Group]),
case atom_to_list(Group) of
"ciphers_"++KeySizeStr ->
KeySize = list_to_integer(KeySizeStr),
- [{key_size,KeySize}
- | measure_openssl_aes_cbc(KeySize, Config)];
+ [{key_size,KeySize} | Config];
"textblock_"++BlockSizeStr ->
BlockSize = list_to_integer(BlockSizeStr),
@@ -85,10 +93,10 @@ end_per_group(_Group, Config) ->
Config.
-measure_openssl_aes_cbc(KeySize, Config) ->
- BLno_acc = [baseline(aes_cbc, KeySize, false)],
+measure_openssl_aes_cbc(KeySizes, Config) ->
+ BLno_acc = [baseline(aes_cbc, KeySize, false) || KeySize <- KeySizes],
ct:pal("Non-accelerated baseline encryption time [µs/block]:~n~p", [BLno_acc]),
- BLacc = [baseline(aes_cbc, KeySize, true)],
+ BLacc = [baseline(aes_cbc, KeySize, true) || KeySize <- KeySizes],
ct:pal("Possibly accelerated baseline encryption time [µs/block]:~n~p", [BLacc]),
[{acc,BLacc},
{no_acc,BLno_acc} | Config].
@@ -104,13 +112,18 @@ calibrate(Config) ->
%%%
%%%
block(Config) ->
- run_cryptos([aes_cbc, aes_gcm, aes_ccm, chacha20_poly1305],
+ run_cryptos([aes_cbc, aes_gcm, aes_ccm],
Config).
stream(Config) ->
- run_cryptos([aes_ctr, chacha20],
+ run_cryptos([aes_ctr],
+ Config).
+
+chacha(Config) ->
+ run_cryptos([chacha20, chacha20_poly1305],
Config).
+
%%%================================================================
%%%
%%%
@@ -122,8 +135,8 @@ run_cryptos(Cryptos, Config) ->
OverHead = proplists:get_value(overhead, Config, 0),
[try
TimePerOpBrutto = run(Crypto,KeySize,BlockSize,MilliSecGoal),
- ct:pal("Brutto: ~p Overhead: ~p (~.2f %) Netto: ~p",
- [TimePerOpBrutto, OverHead, 100*OverHead/TimePerOpBrutto,TimePerOpBrutto - OverHead]),
+ %% ct:pal("Brutto: ~p Overhead: ~p (~.2f %) Netto: ~p",
+ %% [TimePerOpBrutto, OverHead, 100*OverHead/TimePerOpBrutto,TimePerOpBrutto - OverHead]),
TimePerOpBrutto - OverHead
of
TimePerOp -> % µs