File 4130-Skip-test-group-for-lacking-support-in-Crypto.patch of Package erlang
From 26e7d480675b79a8f6a068cb14923faa3771ad93 Mon Sep 17 00:00:00 2001
From: Raimo Niskanen <raimo@erlang.org>
Date: Thu, 13 Oct 2022 08:45:26 +0200
Subject: [PATCH 10/27] Skip test group for lacking support in Crypto
---
lib/ssl/test/inet_crypto_dist.erl | 37 ++++++++++++++++++++++++---
lib/ssl/test/ssl_dist_bench_SUITE.erl | 17 +++++++++---
2 files changed, 46 insertions(+), 8 deletions(-)
diff --git a/lib/ssl/test/inet_crypto_dist.erl b/lib/ssl/test/inet_crypto_dist.erl
index 0c272f75ec..32b07047db 100644
--- a/lib/ssl/test/inet_crypto_dist.erl
+++ b/lib/ssl/test/inet_crypto_dist.erl
@@ -29,7 +29,7 @@
-define(DRIVER, inet_tcp).
-define(FAMILY, inet).
--export([listen/1, accept/1, accept_connection/5,
+-export([supported/0, listen/1, accept/1, accept_connection/5,
setup/5, close/1, select/1, is_node_name/1]).
%% Generalized dist API, for sibling IPv6 module inet6_crypto_dist
@@ -51,11 +51,23 @@
%% -------------------------------------------------------------------------
+%% The curve choice greatly affects setup time,
+%% we really want an Edwards curve but that would
+%% require a very new openssl version.
+%% Twisted brainpool curves (*t1) are faster than
+%% non-twisted (*r1), 256 is much faster than 384,
+%% and so on...
+%%% -define(CURVE, brainpoolP384t1).
+%%% -define(CURVE, brainpoolP256t1).
+-define(CURVE, secp256r1).
+-define(CIPHER, aes_gcm).
+-define(HMAC, sha256).
+
-record(params,
{socket,
dist_handle,
- hmac_algorithm = sha256,
- aead_cipher = aes_gcm,
+ hmac_algorithm = ?HMAC,
+ aead_cipher = ?CIPHER,
rekey_key,
iv = 12,
key = 16,
@@ -78,13 +90,30 @@ params(Socket) ->
%% non-twisted (*r1), 256 is much faster than 384,
%% and so on...
%%% params = brainpoolP384t1,
- params = brainpoolP256t1,
+%%% params = brainpoolP256t1,
+ params = ?CURVE,
public,
private,
life_time = 3600000, % 1 hour
life_count = 256 % Number of connection setups
}).
+supported() ->
+ Curve = lists:member(?CURVE, crypto:supports(curves)),
+ Cipher = lists:member(?CIPHER, crypto:supports(ciphers)),
+ Hmac =
+ lists:member(hmac, crypto:supports(macs)) andalso
+ lists:member(?HMAC, crypto:supports(hashs)),
+ if
+ not Curve ->
+ "curve " ++ atom_to_list(?CURVE);
+ not Cipher ->
+ "cipher " ++ atom_to_list(?CIPHER);
+ not Hmac ->
+ "HMAC " ++ atom_to_list(?HMAC);
+ true ->
+ ok
+ end.
%% -------------------------------------------------------------------------
%% Keep the node's public/private key pair in the process state
diff --git a/lib/ssl/test/ssl_dist_bench_SUITE.erl b/lib/ssl/test/ssl_dist_bench_SUITE.erl
index 7b5318e08f..68c85c9ea5 100644
--- a/lib/ssl/test/ssl_dist_bench_SUITE.erl
+++ b/lib/ssl/test/ssl_dist_bench_SUITE.erl
@@ -185,10 +185,19 @@ end_per_suite(Config) ->
init_per_group(ssl, Config) ->
[{ssl_dist, true}, {ssl_dist_prefix, "SSL"}|Config];
init_per_group(crypto, Config) ->
- [{ssl_dist, false}, {ssl_dist_prefix, "Crypto"},
- {ssl_dist_args,
- "-proto_dist inet_crypto"}
- |Config];
+ try inet_crypto_dist:supported() of
+ ok ->
+ [{ssl_dist, false}, {ssl_dist_prefix, "Crypto"},
+ {ssl_dist_args,
+ "-proto_dist inet_crypto"}
+ |Config];
+ Problem ->
+ {skipped,
+ "Crypto does not support " ++ Problem}
+ catch
+ Class : Reason : Stacktrace ->
+ {failed, {Class, Reason, Stacktrace}}
+ end;
init_per_group(plain, Config) ->
[{ssl_dist, false}, {ssl_dist_prefix, "Plain"}|Config];
init_per_group(benchmark, Config) ->
--
2.35.3