-
Notifications
You must be signed in to change notification settings - Fork 279
Open
Description
OS: Gentoo
libressl: 4.1.1
python: 3.14.0
Building python 3.14 with libressl fails because libressl doesn't have X509_VERIFY_PARAM_get_hostflags().
Should this be added in a future LibreSSL version or is there a better method? I got it to build with this patch, but I am not sure its correct.
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -911,7 +911,11 @@ newPySSLSocket(PySSLContext *sslctx, PySocketSockObject *sock,
X509_VERIFY_PARAM *ssl_verification_params = SSL_get0_param(self->ssl);
X509_VERIFY_PARAM *ssl_ctx_verification_params = SSL_CTX_get0_param(ctx);
+#ifdef LIBRESSL_VERSION_NUMBER
+ unsigned int ssl_ctx_host_flags = 0;
+#else
unsigned int ssl_ctx_host_flags = X509_VERIFY_PARAM_get_hostflags(ssl_ctx_verification_params);
+#endif
X509_VERIFY_PARAM_set_hostflags(ssl_verification_params, ssl_ctx_host_flags);
#endif
SSL_set_app_data(self->ssl, self);
@@ -3859,7 +3863,11 @@ _ssl__SSLContext__host_flags_get_impl(PySSLContext *self)
unsigned int host_flags;
ssl_verification_params = SSL_CTX_get0_param(self->ctx);
+#ifdef LIBRESSL_VERSION_NUMBER
+ host_flags = 0;
+#else
host_flags = X509_VERIFY_PARAM_get_hostflags(ssl_verification_params);
+#endif
return PyLong_FromUnsignedLong(host_flags);
}
For reference this patch is also still needed from python 3.13.
--- a/Modules/_hashopenssl.c
+++ b/Modules/_hashopenssl.c
@@ -44,7 +44,9 @@
#define MUNCH_SIZE INT_MAX
+#ifdef NID_id_scrypt
#define PY_OPENSSL_HAS_SCRYPT 1
+#endif
#if defined(NID_sha3_224) && defined(NID_sha3_256) && defined(NID_sha3_384) && defined(NID_sha3_512)
#define PY_OPENSSL_HAS_SHA3 1
#endif
@@ -963,11 +965,15 @@ _hashlib_HASH(PyObject *module, const char *digestname, PyObject *data_obj,
goto exit;
}
+#ifndef EVP_MD_FLAG_XOF
+ 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) {
Metadata
Metadata
Assignees
Labels
No labels