File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -41,6 +41,9 @@ Core and Builtins
4141Library
4242-------
4343
44+ - Issue #25672: In the ssl module, enable the SSL_MODE_RELEASE_BUFFERS mode
45+ option if it is safe to do so.
46+
4447- Issue #22570: Add 'path' attribute to pathlib.Path objects,
4548 returning the same as str(), to make it more similar to DirEntry.
4649 Library code can now write getattr(p, 'path', p) to get the path as
Original file line number Diff line number Diff line change @@ -2219,6 +2219,7 @@ _ssl__SSLContext_impl(PyTypeObject *type, int proto_version)
22192219 PySSLContext * self ;
22202220 long options ;
22212221 SSL_CTX * ctx = NULL ;
2222+ unsigned long libver ;
22222223
22232224 PySSL_BEGIN_ALLOW_THREADS
22242225 if (proto_version == PY_SSL_VERSION_TLS1 )
@@ -2281,6 +2282,22 @@ _ssl__SSLContext_impl(PyTypeObject *type, int proto_version)
22812282 options |= SSL_OP_NO_SSLv3 ;
22822283 SSL_CTX_set_options (self -> ctx , options );
22832284
2285+ #if defined(SSL_MODE_RELEASE_BUFFERS )
2286+ /* Set SSL_MODE_RELEASE_BUFFERS. This potentially greatly reduces memory
2287+ usage for no cost at all. However, don't do this for OpenSSL versions
2288+ between 1.0.1 and 1.0.1h or 1.0.0 and 1.0.0m, which are affected by CVE
2289+ 2014-0198. I can't find exactly which beta fixed this CVE, so be
2290+ conservative and assume it wasn't fixed until release. We do this check
2291+ at runtime to avoid problems from the dynamic linker.
2292+ See #25672 for more on this. */
2293+ libver = SSLeay ();
2294+ if (!(libver >= 0x10001000UL && libver < 0x1000108fUL ) &&
2295+ !(libver >= 0x10000000UL && libver < 0x100000dfUL )) {
2296+ SSL_CTX_set_mode (self -> ctx , SSL_MODE_RELEASE_BUFFERS );
2297+ }
2298+ #endif
2299+
2300+
22842301#ifndef OPENSSL_NO_ECDH
22852302 /* Allow automatic ECDH curve selection (on OpenSSL 1.0.2+), or use
22862303 prime256v1 by default. This is Apache mod_ssl's initialization
You can’t perform that action at this time.
0 commit comments