Skip to content

Commit 3b5244f

Browse files
authored
Remove conditionals for TLS 1.3 (#1340)
It is always available now
1 parent 3ada747 commit 3b5244f

File tree

2 files changed

+4
-17
lines changed

2 files changed

+4
-17
lines changed

src/OpenSSL/SSL.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@
8282
"OP_NO_TLSv1",
8383
"OP_NO_TLSv1_1",
8484
"OP_NO_TLSv1_2",
85+
"OP_NO_TLSv1_3",
8586
"MODE_RELEASE_BUFFERS",
8687
"OP_SINGLE_DH_USE",
8788
"OP_SINGLE_ECDH_USE",
@@ -188,11 +189,7 @@
188189
OP_NO_TLSv1: int = _lib.SSL_OP_NO_TLSv1
189190
OP_NO_TLSv1_1: int = _lib.SSL_OP_NO_TLSv1_1
190191
OP_NO_TLSv1_2: int = _lib.SSL_OP_NO_TLSv1_2
191-
try:
192-
OP_NO_TLSv1_3: int = _lib.SSL_OP_NO_TLSv1_3
193-
__all__.append("OP_NO_TLSv1_3")
194-
except AttributeError:
195-
pass
192+
OP_NO_TLSv1_3: int = _lib.SSL_OP_NO_TLSv1_3
196193

197194
MODE_RELEASE_BUFFERS: int = _lib.SSL_MODE_RELEASE_BUFFERS
198195

tests/test_ssl.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@
101101
SSLEAY_DIR,
102102
SSLEAY_PLATFORM,
103103
SSLEAY_VERSION,
104-
TLS1_1_VERSION,
105104
TLS1_2_VERSION,
106105
TLS1_3_VERSION,
107106
TLS_METHOD,
@@ -137,11 +136,6 @@
137136
except ImportError:
138137
SSL_ST_INIT = SSL_ST_BEFORE = SSL_ST_OK = SSL_ST_RENEGOTIATE = None
139138

140-
try:
141-
from OpenSSL.SSL import OP_NO_TLSv1_3
142-
except ImportError:
143-
OP_NO_TLSv1_3 = None
144-
145139
from .test_crypto import (
146140
client_cert_pem,
147141
client_key_pem,
@@ -1007,12 +1001,8 @@ def keylog(conn, line):
10071001
assert all(b"CLIENT_RANDOM" in line for conn, line in called)
10081002

10091003
def test_set_proto_version(self):
1010-
if OP_NO_TLSv1_3 is None:
1011-
high_version = TLS1_2_VERSION
1012-
low_version = TLS1_1_VERSION
1013-
else:
1014-
high_version = TLS1_3_VERSION
1015-
low_version = TLS1_2_VERSION
1004+
high_version = TLS1_3_VERSION
1005+
low_version = TLS1_2_VERSION
10161006

10171007
server_context = Context(TLS_METHOD)
10181008
server_context.use_certificate(

0 commit comments

Comments
 (0)