Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove conditionals for TLS 1.3 #1340

Merged
merged 1 commit into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions src/OpenSSL/SSL.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
"OP_NO_TLSv1",
"OP_NO_TLSv1_1",
"OP_NO_TLSv1_2",
"OP_NO_TLSv1_3",
"MODE_RELEASE_BUFFERS",
"OP_SINGLE_DH_USE",
"OP_SINGLE_ECDH_USE",
Expand Down Expand Up @@ -188,11 +189,7 @@
OP_NO_TLSv1: int = _lib.SSL_OP_NO_TLSv1
OP_NO_TLSv1_1: int = _lib.SSL_OP_NO_TLSv1_1
OP_NO_TLSv1_2: int = _lib.SSL_OP_NO_TLSv1_2
try:
OP_NO_TLSv1_3: int = _lib.SSL_OP_NO_TLSv1_3
__all__.append("OP_NO_TLSv1_3")
except AttributeError:
pass
OP_NO_TLSv1_3: int = _lib.SSL_OP_NO_TLSv1_3

MODE_RELEASE_BUFFERS: int = _lib.SSL_MODE_RELEASE_BUFFERS

Expand Down
14 changes: 2 additions & 12 deletions tests/test_ssl.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@
SSLEAY_DIR,
SSLEAY_PLATFORM,
SSLEAY_VERSION,
TLS1_1_VERSION,
TLS1_2_VERSION,
TLS1_3_VERSION,
TLS_METHOD,
Expand Down Expand Up @@ -137,11 +136,6 @@
except ImportError:
SSL_ST_INIT = SSL_ST_BEFORE = SSL_ST_OK = SSL_ST_RENEGOTIATE = None

try:
from OpenSSL.SSL import OP_NO_TLSv1_3
except ImportError:
OP_NO_TLSv1_3 = None

from .test_crypto import (
client_cert_pem,
client_key_pem,
Expand Down Expand Up @@ -1016,12 +1010,8 @@ def keylog(conn, line):
assert all(b"CLIENT_RANDOM" in line for conn, line in called)

def test_set_proto_version(self):
if OP_NO_TLSv1_3 is None:
high_version = TLS1_2_VERSION
low_version = TLS1_1_VERSION
else:
high_version = TLS1_3_VERSION
low_version = TLS1_2_VERSION
high_version = TLS1_3_VERSION
low_version = TLS1_2_VERSION

server_context = Context(TLS_METHOD)
server_context.use_certificate(
Expand Down