summaryrefslogtreecommitdiff
path: root/lang/python/python3/patches/026-openssl-feature-flags.patch
diff options
context:
space:
mode:
authorAndre Heider <a.heider@gmail.com>2022-07-19 14:14:16 +0200
committerRosen Penev <rosenp@gmail.com>2022-07-23 12:28:55 -0700
commitbd6e20542199b4805346059cc8e26f67fff8affd (patch)
treeab0a206f8311215d12c95abbbadfd027190e42c7 /lang/python/python3/patches/026-openssl-feature-flags.patch
parentad0ac5198decbc15c57801509a3005c1608ecbce (diff)
python3: update patches for libressl v3.5
Based upon patches from OpenBSD[0] and Gentoo[1]. Switched to the LibreSSL provided LIBRESSL_VERSION_NUMBER macro, which makes OPENWRT_HOST_BUILD redundant. [0] https://github.com/openbsd/ports/tree/master/lang/python/3.10/patches [1] https://github.com/gentoo/libressl/tree/master/dev-lang/python/files Signed-off-by: Andre Heider <a.heider@gmail.com>
Diffstat (limited to 'lang/python/python3/patches/026-openssl-feature-flags.patch')
-rw-r--r--lang/python/python3/patches/026-openssl-feature-flags.patch39
1 files changed, 37 insertions, 2 deletions
diff --git a/lang/python/python3/patches/026-openssl-feature-flags.patch b/lang/python/python3/patches/026-openssl-feature-flags.patch
index 9272f36a4..b4c15ab80 100644
--- a/lang/python/python3/patches/026-openssl-feature-flags.patch
+++ b/lang/python/python3/patches/026-openssl-feature-flags.patch
@@ -1,12 +1,47 @@
--- a/Modules/_hashopenssl.c
+++ b/Modules/_hashopenssl.c
-@@ -48,7 +48,9 @@
+@@ -45,10 +45,12 @@
+
+ #define MUNCH_SIZE INT_MAX
+
++#if !defined(LIBRESSL_VERSION_NUMBER)
#define PY_OPENSSL_HAS_SCRYPT 1
#define PY_OPENSSL_HAS_SHA3 1
#define PY_OPENSSL_HAS_SHAKE 1
-+#ifndef OPENSSL_NO_BLAKE2
#define PY_OPENSSL_HAS_BLAKE2 1
+#endif
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
#define PY_EVP_MD EVP_MD
+@@ -119,6 +121,7 @@ static const py_hashentry_t py_hashes[]
+ PY_HASH_ENTRY(Py_hash_sha256, "SHA256", SN_sha256, NID_sha256),
+ PY_HASH_ENTRY(Py_hash_sha384, "SHA384", SN_sha384, NID_sha384),
+ PY_HASH_ENTRY(Py_hash_sha512, "SHA512", SN_sha512, NID_sha512),
++#if !defined(LIBRESSL_VERSION_NUMBER)
+ /* truncated sha2 */
+ PY_HASH_ENTRY(Py_hash_sha512_224, "SHA512_224", SN_sha512_224, NID_sha512_224),
+ PY_HASH_ENTRY(Py_hash_sha512_256, "SHA512_256", SN_sha512_256, NID_sha512_256),
+@@ -133,6 +136,7 @@ static const py_hashentry_t py_hashes[]
+ /* blake2 digest */
+ PY_HASH_ENTRY(Py_hash_blake2s, "blake2s256", SN_blake2s256, NID_blake2s256),
+ PY_HASH_ENTRY(Py_hash_blake2b, "blake2b512", SN_blake2b512, NID_blake2b512),
++#endif
+ PY_HASH_ENTRY(NULL, NULL, NULL, 0),
+ };
+
+@@ -873,11 +877,15 @@ py_evp_fromname(PyObject *module, const
+ goto exit;
+ }
+
++#if defined(LIBRESSL_VERSION_NUMBER)
++ type = get_hashlib_state(module)->EVPtype;
++#else
+ if ((EVP_MD_flags(digest) & EVP_MD_FLAG_XOF) == EVP_MD_FLAG_XOF) {
+ type = get_hashlib_state(module)->EVPXOFtype;
+ } else {
+ type = get_hashlib_state(module)->EVPtype;
+ }
++#endif
+
+ self = newEVPobject(type);
+ if (self == NULL) {