File 1633-ssl-Reduce-code-length.patch of Package erlang
From fb612b6cb958d8a944064537dd55a4accc85ea6f Mon Sep 17 00:00:00 2001
From: Ingela Anderton Andin <ingela@erlang.org>
Date: Thu, 16 Oct 2025 10:16:31 +0200
Subject: [PATCH 3/4] ssl: Reduce code length
---
lib/ssl/test/property_test/ssl_eqc_chain.erl | 10 +++----
.../property_test/ssl_eqc_cipher_format.erl | 26 ++++++-------------
.../test/property_test/ssl_eqc_handshake.erl | 7 +----
3 files changed, 14 insertions(+), 29 deletions(-)
diff --git a/lib/ssl/test/property_test/ssl_eqc_chain.erl b/lib/ssl/test/property_test/ssl_eqc_chain.erl
index 5eba2dcb64..e1221d55c3 100644
--- a/lib/ssl/test/property_test/ssl_eqc_chain.erl
+++ b/lib/ssl/test/property_test/ssl_eqc_chain.erl
@@ -141,11 +141,11 @@ pem_unordered_options(Version, PrivDir) ->
unordered_der_cert_chain_opts(Version, Alg) ->
#{server_config := ServerConf,
client_config := ClientConf} = public_key:pkix_test_data(#{server_chain => #{root => root_key(Alg),
- intermediates => intermediates(Alg, 4),
- peer => peer_key(Alg)},
- client_chain => #{root => root_key(Alg),
- intermediates => intermediates(Alg, 4),
- peer => peer_key(Alg)}}),
+ intermediates => intermediates(Alg, 4),
+ peer => peer_key(Alg)},
+ client_chain => #{root => root_key(Alg),
+ intermediates => intermediates(Alg, 4),
+ peer => peer_key(Alg)}}),
{client_options(Version) ++ [protocol(Version), {versions, [Version]} | unordered_der_conf(ClientConf)],
server_options(Version) ++ [protocol(Version), {versions, [Version]} | unordered_der_conf(ServerConf)]}.
diff --git a/lib/ssl/test/property_test/ssl_eqc_cipher_format.erl b/lib/ssl/test/property_test/ssl_eqc_cipher_format.erl
index 2cd47743bf..a0e0bdf29e 100644
--- a/lib/ssl/test/property_test/ssl_eqc_cipher_format.erl
+++ b/lib/ssl/test/property_test/ssl_eqc_cipher_format.erl
@@ -67,13 +67,7 @@
prop_tls_cipher_suite_rfc_name() ->
?FORALL({CipherSuite, _TLSVersion}, ?LET(Version, tls_version(), {cipher_suite(Version), Version}),
- case ssl:str_to_suite(ssl:suite_to_str(CipherSuite)) of
- CipherSuite ->
- true;
- _ ->
- false
- end
- ).
+ ssl:str_to_suite(ssl:suite_to_str(CipherSuite)) == CipherSuite).
prop_tls_cipher_suite_openssl_name() ->
?FORALL({CipherSuite, _TLSVersion}, ?LET(Version, tls_version(), {cipher_suite(Version), Version}),
@@ -91,17 +85,14 @@ prop_tls_cipher_suite_openssl_name() ->
).
prop_tls_anon_cipher_suite_rfc_name() ->
- ?FORALL({CipherSuite, _TLSVersion}, ?LET(Version, pre_tls_1_3_version(), {anon_cipher_suite(Version), Version}),
- case ssl:str_to_suite(ssl:suite_to_str(CipherSuite)) of
- CipherSuite ->
- true;
- _ ->
- false
- end
- ).
+ ?FORALL({CipherSuite, _TLSVersion},
+ ?LET(Version, pre_tls_1_3_version(), {anon_cipher_suite(Version), Version}),
+ ssl:str_to_suite(ssl:suite_to_str(CipherSuite)) == CipherSuite
+ ).
prop_tls_anon_cipher_suite_openssl_name() ->
- ?FORALL({CipherSuite, _TLSVersion}, ?LET(Version, pre_tls_1_3_version(), {anon_cipher_suite(Version), Version}),
+ ?FORALL({CipherSuite, _TLSVersion},
+ ?LET(Version, pre_tls_1_3_version(), {anon_cipher_suite(Version), Version}),
case ssl:str_to_suite(ssl:suite_to_openssl_str(CipherSuite)) of
CipherSuite ->
lists:member(ssl:suite_to_openssl_str(CipherSuite), openssl_legacy_names());
@@ -112,8 +103,7 @@ prop_tls_anon_cipher_suite_openssl_name() ->
prop_tls_signature_algs() ->
?FORALL(SigAlg, ?LET(SigAlg, sig_alg(), SigAlg),
- true = lists:member(ssl_cipher:signature_algorithm_to_scheme(SigAlg), sig_schemes())
- ).
+ lists:member(ssl_cipher:signature_algorithm_to_scheme(SigAlg), sig_schemes())).
%%--------------------------------------------------------------------
%% Generators -----------------------------------------------
diff --git a/lib/ssl/test/property_test/ssl_eqc_handshake.erl b/lib/ssl/test/property_test/ssl_eqc_handshake.erl
index 8373b25cf6..df14858a81 100644
--- a/lib/ssl/test/property_test/ssl_eqc_handshake.erl
+++ b/lib/ssl/test/property_test/ssl_eqc_handshake.erl
@@ -71,12 +71,7 @@ prop_tls_hs_encode_decode() ->
?FORALL({Handshake, TLSVersion}, ?LET(Version, tls_version(), {tls_msg(Version), Version}),
try
[Type, _Length, Data] = tls_handshake:encode_handshake(Handshake, TLSVersion),
- case tls_handshake:decode_handshake(TLSVersion, Type, Data) of
- Handshake ->
- true;
- _ ->
- false
- end
+ tls_handshake:decode_handshake(TLSVersion, Type, Data) == Handshake
catch
throw:#alert{} ->
true
--
2.51.0