diff options
author | Benjamin Peterson <benjamin@python.org> | 2015-03-04 22:11:12 -0500 |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2015-03-04 22:11:12 -0500 |
commit | fdb19715879babc580f63bc129f5b0ff46482d1c (patch) | |
tree | 50e088b1c0aa68d951b84184b1a5ae0d77552c2e | |
parent | 20f4bd4a043bded930c1c21befe28d9c79ea044b (diff) | |
download | cpython-git-fdb19715879babc580f63bc129f5b0ff46482d1c.tar.gz |
enable X509_V_FLAG_TRUSTED_FIRST when possible (closes #23476)
-rw-r--r-- | Misc/NEWS | 3 | ||||
-rw-r--r-- | Modules/_ssl.c | 9 |
2 files changed, 12 insertions, 0 deletions
@@ -13,6 +13,9 @@ Core and Builtins Library ------- +- Issue #23476: In the ssl module, enable OpenSSL's X509_V_FLAG_TRUSTED_FIRST + flag on certificate stores when it is available. + - Issue #23576: Avoid stalling in SSL reads when EOF has been reached in the SSL layer but the underlying connection hasn't been closed. diff --git a/Modules/_ssl.c b/Modules/_ssl.c index e7ba583949..a5b94eb4b0 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -2063,6 +2063,15 @@ context_new(PyTypeObject *type, PyObject *args, PyObject *kwds) sizeof(SID_CTX)); #undef SID_CTX +#ifdef X509_V_FLAG_TRUSTED_FIRST + { + /* Improve trust chain building when cross-signed intermediate + certificates are present. See https://bugs.python.org/issue23476. */ + X509_STORE *store = SSL_CTX_get_cert_store(self->ctx); + X509_STORE_set_flags(store, X509_V_FLAG_TRUSTED_FIRST); + } +#endif + return (PyObject *)self; } |