@@ -2782,6 +2782,14 @@ def try_protocol_combo(server_protocol, client_protocol, expect_success,
2782
2782
% (expect_success , stats ['version' ]))
2783
2783
2784
2784
2785
+ def supports_kx_alias (ctx , aliases ):
2786
+ for cipher in ctx .get_ciphers ():
2787
+ for alias in aliases :
2788
+ if f"Kx={ alias } " in cipher ['description' ]:
2789
+ return True
2790
+ return False
2791
+
2792
+
2785
2793
class ThreadedTests (unittest .TestCase ):
2786
2794
2787
2795
@support .requires_resource ('walltime' )
@@ -4042,17 +4050,12 @@ def test_no_legacy_server_connect(self):
4042
4050
sni_name = hostname )
4043
4051
4044
4052
def test_dh_params (self ):
4045
- # Check we can get a connection with ephemeral finite-field Diffie-
4046
- # Hellman (if supported).
4053
+ # Check we can get a connection with ephemeral finite-field
4054
+ # Diffie- Hellman (if supported).
4047
4055
client_context , server_context , hostname = testing_context ()
4048
4056
dhe_aliases = {"ADH" , "EDH" , "DHE" }
4049
- def supports_dhe (ctx ) -> bool :
4050
- for cipher in ctx .get_ciphers ():
4051
- for alias in dhe_aliases :
4052
- if f"Kx={ alias } " in cipher ['description' ]:
4053
- return True
4054
- return False
4055
- if not (supports_dhe (client_context ) and supports_dhe (server_context )):
4057
+ if not (supports_kx_alias (client_context , dhe_aliases ) and
4058
+ supports_kx_alias (server_context , dhe_aliases )):
4056
4059
self .skipTest ("libssl doesn't support ephemeral DH" )
4057
4060
# test scenario needs TLS <= 1.2
4058
4061
client_context .maximum_version = ssl .TLSVersion .TLSv1_2
0 commit comments