From nobody Wed Mar 29 02:50:01 2023 X-Original-To: dev-commits-ports-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PmWHY737bz41pN4; Wed, 29 Mar 2023 02:50:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PmWHY62fPz40yh; Wed, 29 Mar 2023 02:50:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1680058201; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=s7pUF2xabu18SDHBaIRJi8NJAqRxivSQ0q+wc88738c=; b=Ja+M9vsSKxXtIK6jSHkxPK4RmRVx5FFn02Z01qlB1atN1qBXip5oa6udc/b7lN/Giq2Htf 50+QZXVDMJgXhyGFCPj9BFW5qdKn4/b5LPS+oVGNNZ2PPYmps5r0HWPdOn7js34WP/FiMJ xH9guHQnZpoje7NIG6uUAJyjBvdGnwrGYOejZalH6CrWrdf4Onrdr5RBm4d81LCFChi0yT XDHAHI76ClJlB0qDcYLf4CrO6gajUZlvtdE6SSvN+7xgSk50Bhnv8TSuE3Ifq1NsmBJhRN CTiotqj6vI8uVD7R5cr5aTyx1koBf2sdmJ5ZpRylrovMX4eVNUNDbSlP1q2MlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1680058201; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=s7pUF2xabu18SDHBaIRJi8NJAqRxivSQ0q+wc88738c=; b=nOv/GMAO3nqLzQlZG93no6rYJ4h9dBmCxwtS4rsWx6yQUOqoXC+D8U3eQTbBVPVx8GT+kk 48m1C2ySyY1aVaIgPJv8R21uUJsM+UITry1GLKmB/QjZYq1u88qZ8F89HZt9Qhi3qcdg/s PwjYfU1D0ORA1Ose3EaiYUStURILAiJc5aNtyoEafPVLJ6akG+LflMC7JBsXirnBbsIQx8 6+k1ft2flhlANe9UqGgC2K6UC8Vmo8PuKVIF4JmQgnA/MPzneF4B538ijJ555+IPlgUuSM Ka7KYeiUOtHitS01zPApFys0h44OzpzJn6ITbavrMZvMSxOw9GGHRDivVwvQzA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1680058201; a=rsa-sha256; cv=none; b=UplDasLNU3PlB3hkUacCrpMzE94eFS9Beac2+uY8c4mxagdF/RbkksYxISqAVNA2E9lJxL xzFUUJb7o8YyRGG4aMwvFTOyRQYWynVUdCnSACpJk8ErB69v4RdAfRseCyUAFC+ZkXueOb a3GS/BZWjgnh/ZYZPofKSRSnBgJwcWvQlro815EtgokDA7bjpdbdr0v+laYMD1rHDzXnp+ 8eF5ygoDI0D7pO1ik4cuz7w3jyixyPFbwOX1x3KrsKRqTsHbyeaxifOoZYsZJKCPLRs0RM 9Kw0NXOUkAFumfv9N1AqPeuLbfIzyCZ2wYvp8x+GHpnp9/cbGvXvQg6UWoFy1w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PmWHY56cvz1SRn; Wed, 29 Mar 2023 02:50:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 32T2o1H3044243; Wed, 29 Mar 2023 02:50:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32T2o1bR044240; Wed, 29 Mar 2023 02:50:01 GMT (envelope-from git) Date: Wed, 29 Mar 2023 02:50:01 GMT Message-Id: <202303290250.32T2o1bR044240@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Charlie Li Subject: git: 53de41c33da1 - main - lang/python311: add LibreSSL support List-Id: Commits to the main branch of the FreeBSD ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-main@freebsd.org X-BeenThere: dev-commits-ports-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vishwin X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 53de41c33da1675ab9c232b1fb99272b2a74b4fd Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by vishwin: URL: https://cgit.FreeBSD.org/ports/commit/?id=53de41c33da1675ab9c232b1fb99272b2a74b4fd commit 53de41c33da1675ab9c232b1fb99272b2a74b4fd Author: Charlie Li AuthorDate: 2023-03-29 02:45:09 +0000 Commit: Charlie Li CommitDate: 2023-03-29 02:49:51 +0000 lang/python311: add LibreSSL support LibreSSL 3.6 and later are fully compatible with PEP-644 for the ssl and hmac modules, but not hashlib due to missing SHA-3/SHAKE, BLAKE2 and scrypt. Partially reverts https://github.com/python/cpython/commit/39258d3595300bc7b952854c915f63ae2d4b9c3e for _hashopenssl.c only and void the configure check so that hashlib builds on LibreSSL. --- lang/python311/Makefile | 7 +-- .../files/libressl/patch-Modules___hashopenssl.c | 66 ++++++++++++++++++++++ lang/python311/pkg-plist | 4 +- 3 files changed, 70 insertions(+), 7 deletions(-) diff --git a/lang/python311/Makefile b/lang/python311/Makefile index b3eecab8010f..294fd5ecc414 100644 --- a/lang/python311/Makefile +++ b/lang/python311/Makefile @@ -109,12 +109,9 @@ DISABLED_EXTENSIONS+= nis PLIST_SUB+= NO_NIS="" .endif -# Python 3.10 requires OpenSSL >= 1.1.1 (PEP 644), so with -# libressl, some modules are not built .if ${SSL_DEFAULT:Mlibressl*} -PLIST_SUB+= SUPPORTED_OPENSSL="@comment " -.else -PLIST_SUB+= SUPPORTED_OPENSSL="" +EXTRA_PATCHES+= ${PATCHDIR}/libressl +CONFIGURE_ENV+= ac_cv_working_openssl_hashlib=yes .endif post-patch: diff --git a/lang/python311/files/libressl/patch-Modules___hashopenssl.c b/lang/python311/files/libressl/patch-Modules___hashopenssl.c new file mode 100644 index 000000000000..299694b4c1f3 --- /dev/null +++ b/lang/python311/files/libressl/patch-Modules___hashopenssl.c @@ -0,0 +1,66 @@ +--- Modules/_hashopenssl.c.orig 2023-02-07 13:37:51 UTC ++++ Modules/_hashopenssl.c +@@ -45,10 +45,21 @@ + + #define MUNCH_SIZE INT_MAX + ++#ifndef LIBRESSL_VERSION_NUMBER + #define PY_OPENSSL_HAS_SCRYPT 1 ++#endif ++ ++#ifdef NID_sha3_224 + #define PY_OPENSSL_HAS_SHA3 1 ++#endif ++ ++#if defined(EVP_MD_FLAG_XOF) && defined(NID_shake128) + #define PY_OPENSSL_HAS_SHAKE 1 ++#endif ++ ++#if defined(NID_blake2b512) && !defined(OPENSSL_NO_BLAKE2) + #define PY_OPENSSL_HAS_BLAKE2 1 ++#endif + + #if OPENSSL_VERSION_NUMBER >= 0x30000000L + #define PY_EVP_MD EVP_MD +@@ -120,19 +131,27 @@ static const py_hashentry_t py_hashes[] = { + PY_HASH_ENTRY(Py_hash_sha384, "SHA384", SN_sha384, NID_sha384), + PY_HASH_ENTRY(Py_hash_sha512, "SHA512", SN_sha512, NID_sha512), + /* truncated sha2 */ ++#ifdef NID_sha512_224 + 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), ++#endif + /* sha3 */ ++#ifdef PY_OPENSSL_HAS_SHA3 + PY_HASH_ENTRY(Py_hash_sha3_224, NULL, SN_sha3_224, NID_sha3_224), + PY_HASH_ENTRY(Py_hash_sha3_256, NULL, SN_sha3_256, NID_sha3_256), + PY_HASH_ENTRY(Py_hash_sha3_384, NULL, SN_sha3_384, NID_sha3_384), + PY_HASH_ENTRY(Py_hash_sha3_512, NULL, SN_sha3_512, NID_sha3_512), ++#endif + /* sha3 shake */ ++#ifdef PY_OPENSSL_HAS_SHAKE + PY_HASH_ENTRY(Py_hash_shake_128, NULL, SN_shake128, NID_shake128), + PY_HASH_ENTRY(Py_hash_shake_256, NULL, SN_shake256, NID_shake256), ++#endif + /* blake2 digest */ ++#ifdef PY_OPENSSL_HAS_BLAKE2 + 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,9 +892,12 @@ py_evp_fromname(PyObject *module, const char *digestna + goto exit; + } + ++#ifdef PY_OPENSSL_HAS_SHAKE + if ((EVP_MD_flags(digest) & EVP_MD_FLAG_XOF) == EVP_MD_FLAG_XOF) { + type = get_hashlib_state(module)->EVPXOFtype; +- } else { ++ } else ++#endif ++ { + type = get_hashlib_state(module)->EVPtype; + } + diff --git a/lang/python311/pkg-plist b/lang/python311/pkg-plist index cfc4cc425757..8ecb2414e788 100644 --- a/lang/python311/pkg-plist +++ b/lang/python311/pkg-plist @@ -2934,7 +2934,7 @@ lib/python%%XYDOT%%/lib-dynload/_datetime.cpython-%%XY%%%%ABI%%.so lib/python%%XYDOT%%/lib-dynload/_dbm.cpython-%%XY%%%%ABI%%.so lib/python%%XYDOT%%/lib-dynload/_decimal.cpython-%%XY%%%%ABI%%.so lib/python%%XYDOT%%/lib-dynload/_elementtree.cpython-%%XY%%%%ABI%%.so -%%SUPPORTED_OPENSSL%%lib/python%%XYDOT%%/lib-dynload/_hashlib.cpython-%%XY%%%%ABI%%.so +lib/python%%XYDOT%%/lib-dynload/_hashlib.cpython-%%XY%%%%ABI%%.so lib/python%%XYDOT%%/lib-dynload/_heapq.cpython-%%XY%%%%ABI%%.so lib/python%%XYDOT%%/lib-dynload/_json.cpython-%%XY%%%%ABI%%.so lib/python%%XYDOT%%/lib-dynload/_lsprof.cpython-%%XY%%%%ABI%%.so @@ -2953,7 +2953,7 @@ lib/python%%XYDOT%%/lib-dynload/_sha256.cpython-%%XY%%%%ABI%%.so lib/python%%XYDOT%%/lib-dynload/_sha3.cpython-%%XY%%%%ABI%%.so lib/python%%XYDOT%%/lib-dynload/_sha512.cpython-%%XY%%%%ABI%%.so lib/python%%XYDOT%%/lib-dynload/_socket.cpython-%%XY%%%%ABI%%.so -%%SUPPORTED_OPENSSL%%lib/python%%XYDOT%%/lib-dynload/_ssl.cpython-%%XY%%%%ABI%%.so +lib/python%%XYDOT%%/lib-dynload/_ssl.cpython-%%XY%%%%ABI%%.so lib/python%%XYDOT%%/lib-dynload/_statistics.cpython-%%XY%%%%ABI%%.so lib/python%%XYDOT%%/lib-dynload/_struct.cpython-%%XY%%%%ABI%%.so lib/python%%XYDOT%%/lib-dynload/_testbuffer.cpython-%%XY%%%%ABI%%.so