19
19
import weakref
20
20
import platform
21
21
import sysconfig
22
+ import functools
22
23
try :
23
24
import ctypes
24
25
except ImportError :
@@ -143,6 +144,87 @@ def data_file(*name):
143
144
OP_ENABLE_MIDDLEBOX_COMPAT = getattr (ssl , "OP_ENABLE_MIDDLEBOX_COMPAT" , 0 )
144
145
145
146
147
+ def has_tls_protocol (protocol ):
148
+ """Check if a TLS protocol is available and enabled
149
+
150
+ :param protocol: enum ssl._SSLMethod member or name
151
+ :return: bool
152
+ """
153
+ if isinstance (protocol , str ):
154
+ assert protocol .startswith ('PROTOCOL_' )
155
+ protocol = getattr (ssl , protocol , None )
156
+ if protocol is None :
157
+ return False
158
+ if protocol in {
159
+ ssl .PROTOCOL_TLS , ssl .PROTOCOL_TLS_SERVER ,
160
+ ssl .PROTOCOL_TLS_CLIENT
161
+ }:
162
+ # auto-negotiate protocols are always available
163
+ return True
164
+ name = protocol .name
165
+ return has_tls_version (name [len ('PROTOCOL_' ):])
166
+
167
+
168
+ @functools .lru_cache
169
+ def has_tls_version (version ):
170
+ """Check if a TLS/SSL version is enabled
171
+
172
+ :param version: TLS version name or ssl.TLSVersion member
173
+ :return: bool
174
+ """
175
+ if version == "SSLv2" :
176
+ # never supported and not even in TLSVersion enum
177
+ return False
178
+
179
+ if isinstance (version , str ):
180
+ version = ssl .TLSVersion .__members__ [version ]
181
+
182
+ # check compile time flags like ssl.HAS_TLSv1_2
183
+ if not getattr (ssl , f'HAS_{ version .name } ' ):
184
+ return False
185
+
186
+ # check runtime and dynamic crypto policy settings. A TLS version may
187
+ # be compiled in but disabled by a policy or config option.
188
+ ctx = ssl .SSLContext ()
189
+ if (
190
+ hasattr (ctx , 'minimum_version' ) and
191
+ ctx .minimum_version != ssl .TLSVersion .MINIMUM_SUPPORTED and
192
+ version < ctx .minimum_version
193
+ ):
194
+ return False
195
+ if (
196
+ hasattr (ctx , 'maximum_version' ) and
197
+ ctx .maximum_version != ssl .TLSVersion .MAXIMUM_SUPPORTED and
198
+ version > ctx .maximum_version
199
+ ):
200
+ return False
201
+
202
+ return True
203
+
204
+
205
+ def requires_tls_version (version ):
206
+ """Decorator to skip tests when a required TLS version is not available
207
+
208
+ :param version: TLS version name or ssl.TLSVersion member
209
+ :return:
210
+ """
211
+ def decorator (func ):
212
+ @functools .wraps (func )
213
+ def wrapper (* args , ** kw ):
214
+ if not has_tls_version (version ):
215
+ raise unittest .SkipTest (f"{ version } is not available." )
216
+ else :
217
+ return func (* args , ** kw )
218
+ return wrapper
219
+ return decorator
220
+
221
+
222
+ requires_minimum_version = unittest .skipUnless (
223
+ hasattr (ssl .SSLContext , 'minimum_version' ),
224
+ "required OpenSSL >= 1.1.0g"
225
+ )
226
+
227
+
146
228
def handle_error (prefix ):
147
229
exc_format = ' ' .join (traceback .format_exception (* sys .exc_info ()))
148
230
if support .verbose :
@@ -1104,20 +1186,23 @@ def test_hostname_checks_common_name(self):
1104
1186
with self .assertRaises (AttributeError ):
1105
1187
ctx .hostname_checks_common_name = True
1106
1188
1107
- @unittest .skipUnless (hasattr (ssl .SSLContext , 'minimum_version' ),
1108
- "required OpenSSL 1.1.0g" )
1189
+ @requires_minimum_version
1109
1190
@unittest .skipIf (IS_LIBRESSL , "see bpo-34001" )
1110
1191
def test_min_max_version (self ):
1111
1192
ctx = ssl .SSLContext (ssl .PROTOCOL_TLS_SERVER )
1112
1193
# OpenSSL default is MINIMUM_SUPPORTED, however some vendors like
1113
1194
# Fedora override the setting to TLS 1.0.
1195
+ minimum_range = {
1196
+ # stock OpenSSL
1197
+ ssl .TLSVersion .MINIMUM_SUPPORTED ,
1198
+ # Fedora 29 uses TLS 1.0 by default
1199
+ ssl .TLSVersion .TLSv1 ,
1200
+ # RHEL 8 uses TLS 1.2 by default
1201
+ ssl .TLSVersion .TLSv1_2
1202
+ }
1203
+
1114
1204
self .assertIn (
1115
- ctx .minimum_version ,
1116
- {ssl .TLSVersion .MINIMUM_SUPPORTED ,
1117
- # Fedora 29 uses TLS 1.0 by default
1118
- ssl .TLSVersion .TLSv1 ,
1119
- # RHEL 8 uses TLS 1.2 by default
1120
- ssl .TLSVersion .TLSv1_2 }
1205
+ ctx .minimum_version , minimum_range
1121
1206
)
1122
1207
self .assertEqual (
1123
1208
ctx .maximum_version , ssl .TLSVersion .MAXIMUM_SUPPORTED
@@ -1163,8 +1248,8 @@ def test_min_max_version(self):
1163
1248
1164
1249
ctx = ssl .SSLContext (ssl .PROTOCOL_TLSv1_1 )
1165
1250
1166
- self .assertEqual (
1167
- ctx .minimum_version , ssl . TLSVersion . MINIMUM_SUPPORTED
1251
+ self .assertIn (
1252
+ ctx .minimum_version , minimum_range
1168
1253
)
1169
1254
self .assertEqual (
1170
1255
ctx .maximum_version , ssl .TLSVersion .MAXIMUM_SUPPORTED
@@ -2717,6 +2802,8 @@ def test_echo(self):
2717
2802
for protocol in PROTOCOLS :
2718
2803
if protocol in {ssl .PROTOCOL_TLS_CLIENT , ssl .PROTOCOL_TLS_SERVER }:
2719
2804
continue
2805
+ if not has_tls_protocol (protocol ):
2806
+ continue
2720
2807
with self .subTest (protocol = ssl ._PROTOCOL_NAMES [protocol ]):
2721
2808
context = ssl .SSLContext (protocol )
2722
2809
context .load_cert_chain (CERTFILE )
@@ -3008,7 +3095,7 @@ def test_wrong_cert_tls12(self):
3008
3095
else :
3009
3096
self .fail ("Use of invalid cert should have failed!" )
3010
3097
3011
- @unittest . skipUnless ( ssl . HAS_TLSv1_3 , "Test needs TLS 1.3" )
3098
+ @requires_tls_version ( 'TLSv1_3' )
3012
3099
def test_wrong_cert_tls13 (self ):
3013
3100
client_context , server_context , hostname = testing_context ()
3014
3101
# load client cert that is not signed by trusted CA
@@ -3103,8 +3190,7 @@ def test_ssl_cert_verify_error(self):
3103
3190
self .assertIn (msg , repr (e ))
3104
3191
self .assertIn ('certificate verify failed' , repr (e ))
3105
3192
3106
- @unittest .skipUnless (hasattr (ssl , 'PROTOCOL_SSLv2' ),
3107
- "OpenSSL is compiled without SSLv2 support" )
3193
+ @requires_tls_version ('SSLv2' )
3108
3194
def test_protocol_sslv2 (self ):
3109
3195
"""Connecting to an SSLv2 server with various client options"""
3110
3196
if support .verbose :
@@ -3113,7 +3199,7 @@ def test_protocol_sslv2(self):
3113
3199
try_protocol_combo (ssl .PROTOCOL_SSLv2 , ssl .PROTOCOL_SSLv2 , True , ssl .CERT_OPTIONAL )
3114
3200
try_protocol_combo (ssl .PROTOCOL_SSLv2 , ssl .PROTOCOL_SSLv2 , True , ssl .CERT_REQUIRED )
3115
3201
try_protocol_combo (ssl .PROTOCOL_SSLv2 , ssl .PROTOCOL_TLS , False )
3116
- if hasattr ( ssl , 'PROTOCOL_SSLv3 ' ):
3202
+ if has_tls_version ( 'SSLv3 ' ):
3117
3203
try_protocol_combo (ssl .PROTOCOL_SSLv2 , ssl .PROTOCOL_SSLv3 , False )
3118
3204
try_protocol_combo (ssl .PROTOCOL_SSLv2 , ssl .PROTOCOL_TLSv1 , False )
3119
3205
# SSLv23 client with specific SSL options
@@ -3130,7 +3216,7 @@ def test_PROTOCOL_TLS(self):
3130
3216
"""Connecting to an SSLv23 server with various client options"""
3131
3217
if support .verbose :
3132
3218
sys .stdout .write ("\n " )
3133
- if hasattr ( ssl , 'PROTOCOL_SSLv2 ' ):
3219
+ if has_tls_version ( 'SSLv2 ' ):
3134
3220
try :
3135
3221
try_protocol_combo (ssl .PROTOCOL_TLS , ssl .PROTOCOL_SSLv2 , True )
3136
3222
except OSError as x :
@@ -3139,42 +3225,44 @@ def test_PROTOCOL_TLS(self):
3139
3225
sys .stdout .write (
3140
3226
" SSL2 client to SSL23 server test unexpectedly failed:\n %s\n "
3141
3227
% str (x ))
3142
- if hasattr ( ssl , 'PROTOCOL_SSLv3 ' ):
3228
+ if has_tls_version ( 'SSLv3 ' ):
3143
3229
try_protocol_combo (ssl .PROTOCOL_TLS , ssl .PROTOCOL_SSLv3 , False )
3144
3230
try_protocol_combo (ssl .PROTOCOL_TLS , ssl .PROTOCOL_TLS , True )
3145
- try_protocol_combo (ssl .PROTOCOL_TLS , ssl .PROTOCOL_TLSv1 , 'TLSv1' )
3231
+ if has_tls_version ('TLSv1' ):
3232
+ try_protocol_combo (ssl .PROTOCOL_TLS , ssl .PROTOCOL_TLSv1 , 'TLSv1' )
3146
3233
3147
- if hasattr ( ssl , 'PROTOCOL_SSLv3 ' ):
3234
+ if has_tls_version ( 'SSLv3 ' ):
3148
3235
try_protocol_combo (ssl .PROTOCOL_TLS , ssl .PROTOCOL_SSLv3 , False , ssl .CERT_OPTIONAL )
3149
3236
try_protocol_combo (ssl .PROTOCOL_TLS , ssl .PROTOCOL_TLS , True , ssl .CERT_OPTIONAL )
3150
- try_protocol_combo (ssl .PROTOCOL_TLS , ssl .PROTOCOL_TLSv1 , 'TLSv1' , ssl .CERT_OPTIONAL )
3237
+ if has_tls_version ('TLSv1' ):
3238
+ try_protocol_combo (ssl .PROTOCOL_TLS , ssl .PROTOCOL_TLSv1 , 'TLSv1' , ssl .CERT_OPTIONAL )
3151
3239
3152
- if hasattr ( ssl , 'PROTOCOL_SSLv3 ' ):
3240
+ if has_tls_version ( 'SSLv3 ' ):
3153
3241
try_protocol_combo (ssl .PROTOCOL_TLS , ssl .PROTOCOL_SSLv3 , False , ssl .CERT_REQUIRED )
3154
3242
try_protocol_combo (ssl .PROTOCOL_TLS , ssl .PROTOCOL_TLS , True , ssl .CERT_REQUIRED )
3155
- try_protocol_combo (ssl .PROTOCOL_TLS , ssl .PROTOCOL_TLSv1 , 'TLSv1' , ssl .CERT_REQUIRED )
3243
+ if has_tls_version ('TLSv1' ):
3244
+ try_protocol_combo (ssl .PROTOCOL_TLS , ssl .PROTOCOL_TLSv1 , 'TLSv1' , ssl .CERT_REQUIRED )
3156
3245
3157
3246
# Server with specific SSL options
3158
- if hasattr ( ssl , 'PROTOCOL_SSLv3 ' ):
3247
+ if has_tls_version ( 'SSLv3 ' ):
3159
3248
try_protocol_combo (ssl .PROTOCOL_TLS , ssl .PROTOCOL_SSLv3 , False ,
3160
3249
server_options = ssl .OP_NO_SSLv3 )
3161
3250
# Will choose TLSv1
3162
3251
try_protocol_combo (ssl .PROTOCOL_TLS , ssl .PROTOCOL_TLS , True ,
3163
3252
server_options = ssl .OP_NO_SSLv2 | ssl .OP_NO_SSLv3 )
3164
- try_protocol_combo ( ssl . PROTOCOL_TLS , ssl . PROTOCOL_TLSv1 , False ,
3165
- server_options = ssl .OP_NO_TLSv1 )
3166
-
3253
+ if has_tls_version ( 'TLSv1' ):
3254
+ try_protocol_combo ( ssl . PROTOCOL_TLS , ssl .PROTOCOL_TLSv1 , False ,
3255
+ server_options = ssl . OP_NO_TLSv1 )
3167
3256
3168
- @unittest .skipUnless (hasattr (ssl , 'PROTOCOL_SSLv3' ),
3169
- "OpenSSL is compiled without SSLv3 support" )
3257
+ @requires_tls_version ('SSLv3' )
3170
3258
def test_protocol_sslv3 (self ):
3171
3259
"""Connecting to an SSLv3 server with various client options"""
3172
3260
if support .verbose :
3173
3261
sys .stdout .write ("\n " )
3174
3262
try_protocol_combo (ssl .PROTOCOL_SSLv3 , ssl .PROTOCOL_SSLv3 , 'SSLv3' )
3175
3263
try_protocol_combo (ssl .PROTOCOL_SSLv3 , ssl .PROTOCOL_SSLv3 , 'SSLv3' , ssl .CERT_OPTIONAL )
3176
3264
try_protocol_combo (ssl .PROTOCOL_SSLv3 , ssl .PROTOCOL_SSLv3 , 'SSLv3' , ssl .CERT_REQUIRED )
3177
- if hasattr ( ssl , 'PROTOCOL_SSLv2 ' ):
3265
+ if has_tls_version ( 'SSLv2 ' ):
3178
3266
try_protocol_combo (ssl .PROTOCOL_SSLv3 , ssl .PROTOCOL_SSLv2 , False )
3179
3267
try_protocol_combo (ssl .PROTOCOL_SSLv3 , ssl .PROTOCOL_TLS , False ,
3180
3268
client_options = ssl .OP_NO_SSLv3 )
@@ -3184,41 +3272,40 @@ def test_protocol_sslv3(self):
3184
3272
try_protocol_combo (ssl .PROTOCOL_SSLv3 , ssl .PROTOCOL_TLS ,
3185
3273
False , client_options = ssl .OP_NO_SSLv2 )
3186
3274
3275
+ @requires_tls_version ('TLSv1' )
3187
3276
def test_protocol_tlsv1 (self ):
3188
3277
"""Connecting to a TLSv1 server with various client options"""
3189
3278
if support .verbose :
3190
3279
sys .stdout .write ("\n " )
3191
3280
try_protocol_combo (ssl .PROTOCOL_TLSv1 , ssl .PROTOCOL_TLSv1 , 'TLSv1' )
3192
3281
try_protocol_combo (ssl .PROTOCOL_TLSv1 , ssl .PROTOCOL_TLSv1 , 'TLSv1' , ssl .CERT_OPTIONAL )
3193
3282
try_protocol_combo (ssl .PROTOCOL_TLSv1 , ssl .PROTOCOL_TLSv1 , 'TLSv1' , ssl .CERT_REQUIRED )
3194
- if hasattr ( ssl , 'PROTOCOL_SSLv2 ' ):
3283
+ if has_tls_version ( 'SSLv2 ' ):
3195
3284
try_protocol_combo (ssl .PROTOCOL_TLSv1 , ssl .PROTOCOL_SSLv2 , False )
3196
- if hasattr ( ssl , 'PROTOCOL_SSLv3 ' ):
3285
+ if has_tls_version ( 'SSLv3 ' ):
3197
3286
try_protocol_combo (ssl .PROTOCOL_TLSv1 , ssl .PROTOCOL_SSLv3 , False )
3198
3287
try_protocol_combo (ssl .PROTOCOL_TLSv1 , ssl .PROTOCOL_TLS , False ,
3199
3288
client_options = ssl .OP_NO_TLSv1 )
3200
3289
3201
- @unittest .skipUnless (hasattr (ssl , "PROTOCOL_TLSv1_1" ),
3202
- "TLS version 1.1 not supported." )
3290
+ @requires_tls_version ('TLSv1_1' )
3203
3291
def test_protocol_tlsv1_1 (self ):
3204
3292
"""Connecting to a TLSv1.1 server with various client options.
3205
3293
Testing against older TLS versions."""
3206
3294
if support .verbose :
3207
3295
sys .stdout .write ("\n " )
3208
3296
try_protocol_combo (ssl .PROTOCOL_TLSv1_1 , ssl .PROTOCOL_TLSv1_1 , 'TLSv1.1' )
3209
- if hasattr ( ssl , 'PROTOCOL_SSLv2 ' ):
3297
+ if has_tls_version ( 'SSLv2 ' ):
3210
3298
try_protocol_combo (ssl .PROTOCOL_TLSv1_1 , ssl .PROTOCOL_SSLv2 , False )
3211
- if hasattr ( ssl , 'PROTOCOL_SSLv3 ' ):
3299
+ if has_tls_version ( 'SSLv3 ' ):
3212
3300
try_protocol_combo (ssl .PROTOCOL_TLSv1_1 , ssl .PROTOCOL_SSLv3 , False )
3213
3301
try_protocol_combo (ssl .PROTOCOL_TLSv1_1 , ssl .PROTOCOL_TLS , False ,
3214
3302
client_options = ssl .OP_NO_TLSv1_1 )
3215
3303
3216
3304
try_protocol_combo (ssl .PROTOCOL_TLS , ssl .PROTOCOL_TLSv1_1 , 'TLSv1.1' )
3217
- try_protocol_combo (ssl .PROTOCOL_TLSv1_1 , ssl .PROTOCOL_TLSv1 , False )
3218
- try_protocol_combo (ssl .PROTOCOL_TLSv1 , ssl .PROTOCOL_TLSv1_1 , False )
3305
+ try_protocol_combo (ssl .PROTOCOL_TLSv1_1 , ssl .PROTOCOL_TLSv1_2 , False )
3306
+ try_protocol_combo (ssl .PROTOCOL_TLSv1_2 , ssl .PROTOCOL_TLSv1_1 , False )
3219
3307
3220
- @unittest .skipUnless (hasattr (ssl , "PROTOCOL_TLSv1_2" ),
3221
- "TLS version 1.2 not supported." )
3308
+ @requires_tls_version ('TLSv1_2' )
3222
3309
def test_protocol_tlsv1_2 (self ):
3223
3310
"""Connecting to a TLSv1.2 server with various client options.
3224
3311
Testing against older TLS versions."""
@@ -3227,9 +3314,9 @@ def test_protocol_tlsv1_2(self):
3227
3314
try_protocol_combo (ssl .PROTOCOL_TLSv1_2 , ssl .PROTOCOL_TLSv1_2 , 'TLSv1.2' ,
3228
3315
server_options = ssl .OP_NO_SSLv3 | ssl .OP_NO_SSLv2 ,
3229
3316
client_options = ssl .OP_NO_SSLv3 | ssl .OP_NO_SSLv2 ,)
3230
- if hasattr ( ssl , 'PROTOCOL_SSLv2 ' ):
3317
+ if has_tls_version ( 'SSLv2 ' ):
3231
3318
try_protocol_combo (ssl .PROTOCOL_TLSv1_2 , ssl .PROTOCOL_SSLv2 , False )
3232
- if hasattr ( ssl , 'PROTOCOL_SSLv3 ' ):
3319
+ if has_tls_version ( 'SSLv3 ' ):
3233
3320
try_protocol_combo (ssl .PROTOCOL_TLSv1_2 , ssl .PROTOCOL_SSLv3 , False )
3234
3321
try_protocol_combo (ssl .PROTOCOL_TLSv1_2 , ssl .PROTOCOL_TLS , False ,
3235
3322
client_options = ssl .OP_NO_TLSv1_2 )
@@ -3672,7 +3759,7 @@ def test_version_basic(self):
3672
3759
self .assertIs (s .version (), None )
3673
3760
self .assertIs (s ._sslobj , None )
3674
3761
s .connect ((HOST , server .port ))
3675
- if IS_OPENSSL_1_1_1 and ssl . HAS_TLSv1_3 :
3762
+ if IS_OPENSSL_1_1_1 and has_tls_version ( 'TLSv1_3' ) :
3676
3763
self .assertEqual (s .version (), 'TLSv1.3' )
3677
3764
elif ssl .OPENSSL_VERSION_INFO >= (1 , 0 , 2 ):
3678
3765
self .assertEqual (s .version (), 'TLSv1.2' )
@@ -3681,8 +3768,7 @@ def test_version_basic(self):
3681
3768
self .assertIs (s ._sslobj , None )
3682
3769
self .assertIs (s .version (), None )
3683
3770
3684
- @unittest .skipUnless (ssl .HAS_TLSv1_3 ,
3685
- "test requires TLSv1.3 enabled OpenSSL" )
3771
+ @requires_tls_version ('TLSv1_3' )
3686
3772
def test_tls1_3 (self ):
3687
3773
context = ssl .SSLContext (ssl .PROTOCOL_TLS )
3688
3774
context .load_cert_chain (CERTFILE )
@@ -3699,9 +3785,9 @@ def test_tls1_3(self):
3699
3785
})
3700
3786
self .assertEqual (s .version (), 'TLSv1.3' )
3701
3787
3702
- @unittest . skipUnless ( hasattr ( ssl . SSLContext , 'minimum_version' ),
3703
- "required OpenSSL 1.1.0g" )
3704
- def test_min_max_version (self ):
3788
+ @requires_minimum_version
3789
+ @ requires_tls_version ( 'TLSv1_2' )
3790
+ def test_min_max_version_tlsv1_2 (self ):
3705
3791
client_context , server_context , hostname = testing_context ()
3706
3792
# client TLSv1.0 to 1.2
3707
3793
client_context .minimum_version = ssl .TLSVersion .TLSv1
@@ -3716,7 +3802,13 @@ def test_min_max_version(self):
3716
3802
s .connect ((HOST , server .port ))
3717
3803
self .assertEqual (s .version (), 'TLSv1.2' )
3718
3804
3805
+ @requires_minimum_version
3806
+ @requires_tls_version ('TLSv1_1' )
3807
+ def test_min_max_version_tlsv1_1 (self ):
3808
+ client_context , server_context , hostname = testing_context ()
3719
3809
# client 1.0 to 1.2, server 1.0 to 1.1
3810
+ client_context .minimum_version = ssl .TLSVersion .TLSv1
3811
+ client_context .maximum_version = ssl .TLSVersion .TLSv1_2
3720
3812
server_context .minimum_version = ssl .TLSVersion .TLSv1
3721
3813
server_context .maximum_version = ssl .TLSVersion .TLSv1_1
3722
3814
@@ -3726,6 +3818,10 @@ def test_min_max_version(self):
3726
3818
s .connect ((HOST , server .port ))
3727
3819
self .assertEqual (s .version (), 'TLSv1.1' )
3728
3820
3821
+ @requires_minimum_version
3822
+ @requires_tls_version ('TLSv1_2' )
3823
+ def test_min_max_version_mismatch (self ):
3824
+ client_context , server_context , hostname = testing_context ()
3729
3825
# client 1.0, server 1.2 (mismatch)
3730
3826
server_context .maximum_version = ssl .TLSVersion .TLSv1_2
3731
3827
server_context .minimum_version = ssl .TLSVersion .TLSv1_2
@@ -3738,10 +3834,8 @@ def test_min_max_version(self):
3738
3834
s .connect ((HOST , server .port ))
3739
3835
self .assertIn ("alert" , str (e .exception ))
3740
3836
3741
-
3742
- @unittest .skipUnless (hasattr (ssl .SSLContext , 'minimum_version' ),
3743
- "required OpenSSL 1.1.0g" )
3744
- @unittest .skipUnless (ssl .HAS_SSLv3 , "requires SSLv3 support" )
3837
+ @requires_minimum_version
3838
+ @requires_tls_version ('SSLv3' )
3745
3839
def test_min_max_version_sslv3 (self ):
3746
3840
client_context , server_context , hostname = testing_context ()
3747
3841
server_context .minimum_version = ssl .TLSVersion .SSLv3
@@ -4264,7 +4358,7 @@ def test_session_handling(self):
4264
4358
'Session refers to a different SSLContext.' )
4265
4359
4266
4360
4267
- @unittest .skipUnless (ssl . HAS_TLSv1_3 , "Test needs TLS 1.3" )
4361
+ @unittest .skipUnless (has_tls_version ( 'TLSv1_3' ) , "Test needs TLS 1.3" )
4268
4362
class TestPostHandshakeAuth (unittest .TestCase ):
4269
4363
def test_pha_setter (self ):
4270
4364
protocols = [
0 commit comments