Skip to content

Commit 0fe4583

Browse files
authored
Expose SSL_OP_IGNORE_UNEXPECTED_EOF (#7321)
* Expose SSL_OP_IGNORE_UNEXPECTED_EOF Expose SSL_OP_IGNORE_UNEXPECTED_EOF. https://www.openssl.org/docs/manmaster/man3/SSL_CTX_set_options.html#:~:text=this%20by%20default.-,SSL_OP_IGNORE_UNEXPECTED_EOF,-Some%20TLS%20implementations * Make this conditional. * Add to _conditionals.py
1 parent a0f3817 commit 0fe4583

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

src/_cffi_src/openssl/ssl.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
static const long Cryptography_HAS_SSL_OP_MSIE_SSLV2_RSA_PADDING;
4242
static const long Cryptography_HAS_SSL_SET_SSL_CTX;
4343
static const long Cryptography_HAS_SSL_OP_NO_TICKET;
44+
static const long Cryptography_HAS_SSL_OP_IGNORE_UNEXPECTED_EOF;
4445
static const long Cryptography_HAS_ALPN;
4546
static const long Cryptography_HAS_NEXTPROTONEG;
4647
static const long Cryptography_HAS_SET_CERT_CB;
@@ -95,6 +96,7 @@
9596
static const long SSL_OP_SINGLE_ECDH_USE;
9697
static const long SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION;
9798
static const long SSL_OP_LEGACY_SERVER_CONNECT;
99+
static const long SSL_OP_IGNORE_UNEXPECTED_EOF;
98100
static const long SSL_VERIFY_PEER;
99101
static const long SSL_VERIFY_FAIL_IF_NO_PEER_CERT;
100102
static const long SSL_VERIFY_CLIENT_ONCE;
@@ -603,6 +605,13 @@
603605
static const long SSL_OP_NO_RENEGOTIATION = 0;
604606
#endif
605607
608+
#ifdef SSL_OP_IGNORE_UNEXPECTED_EOF
609+
static const long Cryptography_HAS_SSL_OP_IGNORE_UNEXPECTED_EOF = 1;
610+
#else
611+
static const long Cryptography_HAS_SSL_OP_IGNORE_UNEXPECTED_EOF = 0;
612+
static const long SSL_OP_IGNORE_UNEXPECTED_EOF = 1;
613+
#endif
614+
606615
#if CRYPTOGRAPHY_IS_LIBRESSL
607616
void (*SSL_CTX_set_cert_cb)(SSL_CTX *, int (*)(SSL *, void *), void *) = NULL;
608617
void (*SSL_set_cert_cb)(SSL *, int (*)(SSL *, void *), void *) = NULL;

src/cryptography/hazmat/bindings/openssl/_conditional.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,12 @@ def cryptography_has_pkcs12_set_mac() -> typing.List[str]:
309309
return ["PKCS12_set_mac"]
310310

311311

312+
def cryptography_has_ssl_op_ignore_unexpected_eof() -> typing.List[str]:
313+
return [
314+
"SSL_OP_IGNORE_UNEXPECTED_EOF",
315+
]
316+
317+
312318
# This is a mapping of
313319
# {condition: function-returning-names-dependent-on-that-condition} so we can
314320
# loop over them and delete unsupported names at runtime. It will be removed
@@ -369,4 +375,7 @@ def cryptography_has_pkcs12_set_mac() -> typing.List[str]:
369375
cryptography_has_unexpected_eof_while_reading
370376
),
371377
"Cryptography_HAS_PKCS12_SET_MAC": cryptography_has_pkcs12_set_mac,
378+
"Cryptography_HAS_SSL_OP_IGNORE_UNEXPECTED_EOF": (
379+
cryptography_has_ssl_op_ignore_unexpected_eof
380+
),
372381
}

0 commit comments

Comments
 (0)