Skip to content
Snippets Groups Projects
Verified Commit 5388354b authored by Karel Koci's avatar Karel Koci :metal:
Browse files

patches: packages: drop upstream test patch

parent 53dfc8c0
Branches
Tags
1 merge request!123Turris OS 5.0 (HBK)
From b303da66f00b88b9dd43ac508f3a83915ac24ffc Mon Sep 17 00:00:00 2001
From: Rosen Penev <rosenp@gmail.com>
Date: Fri, 15 Mar 2019 00:37:48 -0700
Subject: [PATCH] python3: Rebase deprecated API patch against current version
Looks like it was changed from when I last applied. Fixes breakage with
several packages.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
lang/python/python3/Makefile | 2 +-
.../020-ssl-module-emulate-tls-methods.patch | 46 +++++++++++++++----
.../patches/021-openssl-deprecated.patch | 20 +-------
3 files changed, 40 insertions(+), 28 deletions(-)
diff --git a/lang/python/python3/Makefile b/lang/python/python3/Makefile
index feee27270..0c3c82ca9 100644
--- a/lang/python/python3/Makefile
+++ b/lang/python/python3/Makefile
@@ -14,7 +14,7 @@ PYTHON_VERSION:=$(PYTHON3_VERSION)
PYTHON_VERSION_MICRO:=$(PYTHON3_VERSION_MICRO)
PKG_NAME:=python3
-PKG_RELEASE:=6
+PKG_RELEASE:=7
PKG_VERSION:=$(PYTHON_VERSION).$(PYTHON_VERSION_MICRO)
PKG_SOURCE:=Python-$(PKG_VERSION).tar.xz
diff --git a/lang/python/python3/patches/020-ssl-module-emulate-tls-methods.patch b/lang/python/python3/patches/020-ssl-module-emulate-tls-methods.patch
index cf334886c..430d1b796 100644
--- a/lang/python/python3/patches/020-ssl-module-emulate-tls-methods.patch
+++ b/lang/python/python3/patches/020-ssl-module-emulate-tls-methods.patch
@@ -6,11 +6,14 @@ Subject: [PATCH] bpo-30008: SSL module: emulate tls methods
OpenSSL 1.1 compatility: emulate version specific TLS methods with
SSL_CTX_set_min/max_proto_version().
---
- .../2018-02-25-20-05-51.bpo-30008.6Bmyhr.rst | 4 +
- Modules/_ssl.c | 134 ++++++++++++++++-----
+ .../2018-02-25-20-05-51.bpo-30008.6Bmyhr.rst | 4 +
+ Modules/_ssl.c | 134 ++++++++++++++----
2 files changed, 108 insertions(+), 30 deletions(-)
create mode 100644 Misc/NEWS.d/next/Library/2018-02-25-20-05-51.bpo-30008.6Bmyhr.rst
+diff --git a/Misc/NEWS.d/next/Library/2018-02-25-20-05-51.bpo-30008.6Bmyhr.rst b/Misc/NEWS.d/next/Library/2018-02-25-20-05-51.bpo-30008.6Bmyhr.rst
+new file mode 100644
+index 000000000000..e0a08464a1e1
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2018-02-25-20-05-51.bpo-30008.6Bmyhr.rst
@@ -0,0 +1,4 @@
@@ -18,6 +21,8 @@ SSL_CTX_set_min/max_proto_version().
+1.1.0. The version specific TLS methods are emulated with TLS_method() plus
+SSL_CTX_set_min/max_proto_version(). Pseudo random numbers are generated
+with RAND_bytes().
+diff --git a/Modules/_ssl.c b/Modules/_ssl.c
+index f50823e6947a..827026e3bf5c 100644
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -45,14 +45,6 @@ static PySocketModule_APIObject PySocketModule;
@@ -43,6 +48,15 @@ SSL_CTX_set_min/max_proto_version().
#define TLS_method SSLv23_method
#define TLS_client_method SSLv23_client_method
#define TLS_server_method SSLv23_server_method
+@@ -866,7 +859,7 @@ _ssl_configure_hostname(PySSLSocket *self, const char* server_hostname)
+ goto error;
+ }
+ } else {
+- if (!X509_VERIFY_PARAM_set1_ip(param, ASN1_STRING_data(ip),
++ if (!X509_VERIFY_PARAM_set1_ip(param, ASN1_STRING_get0_data(ip),
+ ASN1_STRING_length(ip))) {
+ _setSSLError(NULL, 0, __FILE__, __LINE__);
+ goto error;
@@ -1319,8 +1312,9 @@ _get_peer_alt_names (X509 *certificate) {
goto fail;
}
@@ -55,7 +69,14 @@ SSL_CTX_set_min/max_proto_version().
if (v == NULL) {
Py_DECREF(t);
goto fail;
-@@ -2959,38 +2953,118 @@ _ssl__SSLContext_impl(PyTypeObject *type, int proto_version)
+@@ -2953,44 +2947,124 @@ _ssl__SSLContext_impl(PyTypeObject *type, int proto_version)
+ long options;
+ SSL_CTX *ctx = NULL;
+ X509_VERIFY_PARAM *params;
+- int result;
++ int result = 0;
+ #if defined(SSL_MODE_RELEASE_BUFFERS)
+ unsigned long libver;
#endif
PySSL_BEGIN_ALLOW_THREADS
@@ -63,8 +84,8 @@ SSL_CTX_set_min/max_proto_version().
+ switch (proto_version) {
+#if OPENSSL_VERSION_NUMBER <= 0x10100000L
+ /* OpenSSL < 1.1.0 or not LibreSSL
-+ * Use old-style methods for OpenSSL 1.0.2
-+ */
++ * Use old-style methods for OpenSSL 1.0.2
++ */
+#if defined(SSL2_VERSION) && !defined(OPENSSL_NO_SSL2)
+ case PY_SSL_VERSION_SSL2:
+ ctx = SSL_CTX_new(SSLv2_method());
@@ -98,9 +119,9 @@ SSL_CTX_set_min/max_proto_version().
- ctx = SSL_CTX_new(SSLv3_method());
+#else
+ /* OpenSSL >= 1.1 or LibreSSL
-+ * create context with TLS_method for all protocols
-+ * no SSLv2_method in OpenSSL 1.1.
-+ */
++ * create context with TLS_method for all protocols
++ * no SSLv2_method in OpenSSL 1.1.
++ */
+#if defined(SSL3_VERSION) && !defined(OPENSSL_NO_SSL3)
+ case PY_SSL_VERSION_SSL3:
+ ctx = SSL_CTX_new(TLS_method());
@@ -191,3 +212,12 @@ SSL_CTX_set_min/max_proto_version().
_setSSLError(NULL, 0, __FILE__, __LINE__);
return NULL;
}
+@@ -5095,7 +5169,7 @@ PySSL_RAND(int len, int pseudo)
+ if (bytes == NULL)
+ return NULL;
+ if (pseudo) {
+- ok = RAND_pseudo_bytes((unsigned char*)PyBytes_AS_STRING(bytes), len);
++ ok = RAND_bytes((unsigned char*)PyBytes_AS_STRING(bytes), len);
+ if (ok == 0 || ok == 1)
+ return Py_BuildValue("NO", bytes, ok == 1 ? Py_True : Py_False);
+ }
diff --git a/lang/python/python3/patches/021-openssl-deprecated.patch b/lang/python/python3/patches/021-openssl-deprecated.patch
index c3650ff0c..d051ae555 100644
--- a/lang/python/python3/patches/021-openssl-deprecated.patch
+++ b/lang/python/python3/patches/021-openssl-deprecated.patch
@@ -48,15 +48,6 @@
static int X509_NAME_ENTRY_set(const X509_NAME_ENTRY *ne)
{
-@@ -859,7 +865,7 @@ _ssl_configure_hostname(PySSLSocket *self, const char* server_hostname)
- goto error;
- }
- } else {
-- if (!X509_VERIFY_PARAM_set1_ip(param, ASN1_STRING_data(ip),
-+ if (!X509_VERIFY_PARAM_set1_ip(param, ASN1_STRING_get0_data(ip),
- ASN1_STRING_length(ip))) {
- _setSSLError(NULL, 0, __FILE__, __LINE__);
- goto error;
@@ -1624,7 +1630,7 @@ _decode_certificate(X509 *certificate) {
Py_DECREF(sn_obj);
@@ -84,16 +75,7 @@
if (!(libver >= 0x10001000UL && libver < 0x1000108fUL) &&
!(libver >= 0x10000000UL && libver < 0x100000dfUL)) {
SSL_CTX_set_mode(self->ctx, SSL_MODE_RELEASE_BUFFERS);
-@@ -5159,7 +5175,7 @@ PySSL_RAND(int len, int pseudo)
- if (bytes == NULL)
- return NULL;
- if (pseudo) {
-- ok = RAND_pseudo_bytes((unsigned char*)PyBytes_AS_STRING(bytes), len);
-+ ok = RAND_bytes((unsigned char*)PyBytes_AS_STRING(bytes), len);
- if (ok == 0 || ok == 1)
- return Py_BuildValue("NO", bytes, ok == 1 ? Py_True : Py_False);
- }
-@@ -6176,10 +6192,10 @@ PyInit__ssl(void)
+@@ -6186,10 +6192,10 @@ PyInit__ssl(void)
return NULL;
/* OpenSSL version */
--
2.21.0
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment