summaryrefslogtreecommitdiffstats
path: root/lang/python/python3/patches/028-host-python-support-ssl-with-libressl.patch
blob: 7b47c111f943d96714e291ff392559a4dc57d1b2 (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
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -67,6 +67,12 @@
 #  error "OPENSSL_THREADS is not defined, Python requires thread-safe OpenSSL"
 #endif
 
+#ifdef LIBRESSL_VERSION_NUMBER
+static int SSL_CTX_get_security_level(const SSL_CTX *ctx)
+{
+    return 1;
+}
+#endif
 
 
 struct py_ssl_error_code {
@@ -169,7 +175,11 @@ extern const SSL_METHOD *TLSv1_2_method(
  * Based on Hynek's excellent blog post (update 2021-02-11)
  * https://hynek.me/articles/hardening-your-web-servers-ssl-ciphers/
  */
+#ifndef LIBRESSL_VERSION_NUMBER
   #define PY_SSL_DEFAULT_CIPHER_STRING "@SECLEVEL=2:ECDH+AESGCM:ECDH+CHACHA20:ECDH+AES:DHE+AES:!aNULL:!eNULL:!aDSS:!SHA1:!AESCCM"
+#else
+  #define PY_SSL_DEFAULT_CIPHER_STRING "ECDH+AESGCM:ECDH+CHACHA20:ECDH+AES:DHE+AES:!aNULL:!eNULL:!aDSS:!SHA1:!AESCCM"
+#endif
   #ifndef PY_SSL_MIN_PROTOCOL
     #define PY_SSL_MIN_PROTOCOL TLS1_2_VERSION
   #endif