summaryrefslogtreecommitdiff
path: root/lang/python/python3/patches/028-host-python-support-ssl-with-libressl.patch
diff options
context:
space:
mode:
authorAlexandru Ardelean <ardeleanalex@gmail.com>2021-10-27 12:10:02 +0300
committerAlexandru Ardelean <ardeleanalex@gmail.com>2021-11-19 13:30:14 +0200
commit4e05541782edeb06b51d691dadf52648df24c940 (patch)
tree4ddf18426d8772f09c6ec6e940be79ba2d669e6a /lang/python/python3/patches/028-host-python-support-ssl-with-libressl.patch
parentb3237baf63b2b38c257ba9f6488d54fc89d5ed69 (diff)
python3: bump to version 3.10.0
Manually re-applied: 008-distutils-use-python-sysroot.patch 016-adjust-config-paths.patch Drop patch: 003-do-not-run-distutils-tests.patch There is now a configure option '--disable-test-modules' And seems we left the '_ctypes_test' around for quite some time. Dropped now. Refs: https://bugs.python.org/issue27640 https://bugs.python.org/issue43282 Drop patch: 013-getbuildinfo-date-time-source-date-epoch.patch Python build honors SOURCE_DATE_EPOCH pretty well now. Drop setuptools patches. Setuptools should be reproducible with Python 3.6+ according to a mention here: https://github.com/pypa/setuptools/pull/1690#issuecomment-536517456 It's time to let upstream fix Setuptools reproduce-ability. Drop patch: 010-do-not-add-rt-lib-dirs-when-cross-compiling.patch I can't seem to fully remember why it's there. And it seem to build fine without it. Drop patch: 015-abort-on-failed-modules.patch Python build supports a similar PYTHONSTRICTEXTENSIONBUILD=1 env-var option. Add patch: 026-openssl-feature-flags.patch We need to keep this in our tree for a while. See: https://bugs.python.org/issue45627 Backport patch: 027-bpo-43158-Use-configure-values-for-building-_uuid-ex.patch Link: https://github.com/python/cpython/pull/29353 Fixes the build for uuid C module. Add patch: 028-host-python-support-ssl-with-libressl.patch We need the _ssl module working on the host-side with LibreSSL for pip to work to download from https://pypi.org Refs: https://github.com/openwrt/openwrt/pull/4749 Add patch: 029-disable-deprecation-warning.patch Fixes apparmor build. The warning causes a configure error. Refreshed the rest of patches. Some old build-flags were removed. They don't seem to be necessary anymore. Split python3-uuid from python3-light. To better manage the libuuid library (if needed). Also, fixing the uuid C module build. Seems this was failing, and was falling back to using hashlib. Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
Diffstat (limited to 'lang/python/python3/patches/028-host-python-support-ssl-with-libressl.patch')
-rw-r--r--lang/python/python3/patches/028-host-python-support-ssl-with-libressl.patch117
1 files changed, 117 insertions, 0 deletions
diff --git a/lang/python/python3/patches/028-host-python-support-ssl-with-libressl.patch b/lang/python/python3/patches/028-host-python-support-ssl-with-libressl.patch
new file mode 100644
index 000000000..759b66292
--- /dev/null
+++ b/lang/python/python3/patches/028-host-python-support-ssl-with-libressl.patch
@@ -0,0 +1,117 @@
+--- a/Modules/_ssl.c
++++ b/Modules/_ssl.c
+@@ -67,7 +67,18 @@
+ # error "OPENSSL_THREADS is not defined, Python requires thread-safe OpenSSL"
+ #endif
+
++#ifdef OPENWRT_HOST_BUILD
++#undef TLS1_3_VERSION
++static STACK_OF(X509) *SSL_get0_verified_chain(const SSL *s)
++{
++ return NULL;
++}
+
++static int SSL_CTX_get_security_level(const SSL_CTX *ctx)
++{
++ return 0;
++}
++#endif
+
+ struct py_ssl_error_code {
+ const char *mnemonic;
+@@ -291,8 +302,10 @@ typedef struct {
+ int post_handshake_auth;
+ #endif
+ PyObject *msg_cb;
++#ifndef OPENWRT_HOST_BUILD
+ PyObject *keylog_filename;
+ BIO *keylog_bio;
++#endif
+ /* Cached module state, also used in SSLSocket and SSLSession code. */
+ _sslmodulestate *state;
+ } PySSLContext;
+@@ -2346,8 +2359,14 @@ _ssl__SSLSocket_write_impl(PySSLSocket *
+
+ do {
+ PySSL_BEGIN_ALLOW_THREADS
++#ifdef OPENWRT_HOST_BUILD
++ retval = SSL_write(self->ssl, b->buf, (int)b->len);
++ if (retval > 0) count = retval;
++ err = _PySSL_errno(retval <= 0, self->ssl, retval);
++#else
+ retval = SSL_write_ex(self->ssl, b->buf, (size_t)b->len, &count);
+ err = _PySSL_errno(retval == 0, self->ssl, retval);
++#endif
+ PySSL_END_ALLOW_THREADS
+ self->err = err;
+
+@@ -2498,8 +2517,14 @@ _ssl__SSLSocket_read_impl(PySSLSocket *s
+
+ do {
+ PySSL_BEGIN_ALLOW_THREADS
++#ifdef OPENWRT_HOST_BUILD
++ retval = SSL_read(self->ssl, mem, len);
++ if (retval > 0) count = retval;
++ err = _PySSL_errno(retval <= 0, self->ssl, retval);
++#else
+ retval = SSL_read_ex(self->ssl, mem, (size_t)len, &count);
+ err = _PySSL_errno(retval == 0, self->ssl, retval);
++#endif
+ PySSL_END_ALLOW_THREADS
+ self->err = err;
+
+@@ -3062,8 +3087,10 @@ _ssl__SSLContext_impl(PyTypeObject *type
+ self->hostflags = X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS;
+ self->protocol = proto_version;
+ self->msg_cb = NULL;
++#ifndef OPENWRT_HOST_BUILD
+ self->keylog_filename = NULL;
+ self->keylog_bio = NULL;
++#endif
+ self->alpn_protocols = NULL;
+ self->set_sni_cb = NULL;
+ self->state = get_ssl_state(module);
+@@ -3187,6 +3214,7 @@ context_clear(PySSLContext *self)
+ {
+ Py_CLEAR(self->set_sni_cb);
+ Py_CLEAR(self->msg_cb);
++#ifndef OPENWRT_HOST_BUILD
+ Py_CLEAR(self->keylog_filename);
+ if (self->keylog_bio != NULL) {
+ PySSL_BEGIN_ALLOW_THREADS
+@@ -3194,6 +3222,7 @@ context_clear(PySSLContext *self)
+ PySSL_END_ALLOW_THREADS
+ self->keylog_bio = NULL;
+ }
++#endif
+ return 0;
+ }
+
+@@ -4603,8 +4632,10 @@ static PyGetSetDef context_getsetlist[]
+ (setter) set_minimum_version, NULL},
+ {"maximum_version", (getter) get_maximum_version,
+ (setter) set_maximum_version, NULL},
++#ifndef OPENWRT_HOST_BUILD
+ {"keylog_filename", (getter) _PySSLContext_get_keylog_filename,
+ (setter) _PySSLContext_set_keylog_filename, NULL},
++#endif
+ {"_msg_callback", (getter) _PySSLContext_get_msg_callback,
+ (setter) _PySSLContext_set_msg_callback, NULL},
+ {"sni_callback", (getter) get_sni_callback,
+--- a/Modules/_ssl/debughelpers.c
++++ b/Modules/_ssl/debughelpers.c
+@@ -114,6 +114,8 @@ _PySSLContext_set_msg_callback(PySSLCont
+ return 0;
+ }
+
++#ifndef OPENWRT_HOST_BUILD
++
+ static void
+ _PySSL_keylog_callback(const SSL *ssl, const char *line)
+ {
+@@ -217,3 +219,5 @@ _PySSLContext_set_keylog_filename(PySSLC
+ SSL_CTX_set_keylog_callback(self->ctx, _PySSL_keylog_callback);
+ return 0;
+ }
++
++#endif