summaryrefslogtreecommitdiffstats
path: root/lang/python/python3/patches/027-fix-host-build-libressl.patch
blob: 736c8fb4d693d32a34cbb6daec31581dd47fb48d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
From 49e3c330d4b5e17a740bc51b7ebbb9a42c67e505 Mon Sep 17 00:00:00 2001
From: Sean Khan <datapronix@protonmail.com>
Date: Thu, 27 Jun 2024 22:06:30 -0400
Subject: [PATCH] Fix host build with LibreSSL

--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -75,7 +75,10 @@
 #  error "OPENSSL_THREADS is not defined, Python requires thread-safe OpenSSL"
 #endif
 
-
+#ifdef LIBRESSL_VERSION_NUMBER
+/* LibreSSL does not define this for some reason, but it does implement it */
+unsigned int X509_VERIFY_PARAM_get_hostflags(X509_VERIFY_PARAM *param);
+#endif
 
 struct py_ssl_error_code {
     const char *mnemonic;
@@ -4905,7 +4908,11 @@ _ssl__SSLContext_cert_store_stats_impl(P
     int x509 = 0, crl = 0, ca = 0, i;
 
     store = SSL_CTX_get_cert_store(self->ctx);
+#if !defined(LIBRESSL_VERSION_NUMBER)
     objs = X509_STORE_get1_objects(store);
+#else
+    objs = X509_STORE_get0_objects(store);
+#endif
     if (objs == NULL) {
         PyErr_SetString(PyExc_MemoryError, "failed to query cert store");
         return NULL;
@@ -4961,7 +4968,11 @@ _ssl__SSLContext_get_ca_certs_impl(PySSL
     }
 
     store = SSL_CTX_get_cert_store(self->ctx);
+#if !defined(LIBRESSL_VERSION_NUMBER)
     objs = X509_STORE_get1_objects(store);
+#else
+    objs = X509_STORE_get0_objects(store);
+#endif
     if (objs == NULL) {
         PyErr_SetString(PyExc_MemoryError, "failed to query cert store");
         goto error;