From c427a6dfc0fe93d1b2b77a781b1262aa9784cb74 Mon Sep 17 00:00:00 2001 From: Wang Mingyu Date: Mon, 2 Mar 2026 13:56:49 +0800 Subject: python3-m2crypto: upgrade 0.46.2 -> 0.47.0 0001-fix-allow-64-bit-time_t-on-32-bit-systems-in-test_is.patch 0002-fix-correct-struct-packing-on-32-bit-with-_TIME_BITS.patch removed since they're included in 0.47.0 Signed-off-by: Wang Mingyu MAIL: wangmy@fujitsu.com Signed-off-by: Khem Raj --- ...4-bit-time_t-on-32-bit-systems-in-test_is.patch | 40 ------------ ...-struct-packing-on-32-bit-with-_TIME_BITS.patch | 72 ---------------------- .../python/python3-m2crypto_0.46.2.bb | 59 ------------------ .../python/python3-m2crypto_0.47.0.bb | 55 +++++++++++++++++ 4 files changed, 55 insertions(+), 171 deletions(-) delete mode 100644 meta-python/recipes-devtools/python/python3-m2crypto/0001-fix-allow-64-bit-time_t-on-32-bit-systems-in-test_is.patch delete mode 100644 meta-python/recipes-devtools/python/python3-m2crypto/0002-fix-correct-struct-packing-on-32-bit-with-_TIME_BITS.patch delete mode 100644 meta-python/recipes-devtools/python/python3-m2crypto_0.46.2.bb create mode 100644 meta-python/recipes-devtools/python/python3-m2crypto_0.47.0.bb (limited to 'meta-python/recipes-devtools/python') diff --git a/meta-python/recipes-devtools/python/python3-m2crypto/0001-fix-allow-64-bit-time_t-on-32-bit-systems-in-test_is.patch b/meta-python/recipes-devtools/python/python3-m2crypto/0001-fix-allow-64-bit-time_t-on-32-bit-systems-in-test_is.patch deleted file mode 100644 index d49950074f..0000000000 --- a/meta-python/recipes-devtools/python/python3-m2crypto/0001-fix-allow-64-bit-time_t-on-32-bit-systems-in-test_is.patch +++ /dev/null @@ -1,40 +0,0 @@ -From d123b4ddce99c44f2c290fb3d6cc887de98778e6 Mon Sep 17 00:00:00 2001 -From: Haixiao Yan -Date: Wed, 22 Oct 2025 15:23:56 +0800 -Subject: [PATCH 1/2] fix: allow 64-bit time_t on 32-bit systems in - test_is32bit - -Some modern 32-bit Linux systems (e.g. with glibc >= 2.34 or musl time64 ABI) -use 64-bit time_t by default when _TIME_BITS=64 is enabled. The original test -assumed time_t was always 32-bit on 32-bit architectures, which is no longer -true. - -Relax the check to accept both 32-bit and 64-bit time_t values: - - self.assertIn(bit32, (32, 64)) - -This makes the test compatible with both legacy and time64 ABIs. - -Upstream-Status: Backport [https://gitlab.com/m2crypto/m2crypto/-/commit/818c3dfda6ea] - -Signed-off-by: Haixiao Yan ---- - tests/test_util.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/tests/test_util.py b/tests/test_util.py -index e925d03b090c..233fb7a099d9 100644 ---- a/tests/test_util.py -+++ b/tests/test_util.py -@@ -26,7 +26,7 @@ class UtilTestCase(unittest.TestCase): - not in ["true", "1", "yes"] - ) - ): -- self.assertEqual(bit32, 32) -+ self.assertIn(bit32, (32, 64)) - else: - self.assertNotEqual(bit32, 32) - self.assertIsInstance(bit32, int) --- -2.34.1 - diff --git a/meta-python/recipes-devtools/python/python3-m2crypto/0002-fix-correct-struct-packing-on-32-bit-with-_TIME_BITS.patch b/meta-python/recipes-devtools/python/python3-m2crypto/0002-fix-correct-struct-packing-on-32-bit-with-_TIME_BITS.patch deleted file mode 100644 index c36afa5cc0..0000000000 --- a/meta-python/recipes-devtools/python/python3-m2crypto/0002-fix-correct-struct-packing-on-32-bit-with-_TIME_BITS.patch +++ /dev/null @@ -1,72 +0,0 @@ -From b5dbfca23986429853ccb15a38cc526d9df0dd40 Mon Sep 17 00:00:00 2001 -From: Haixiao Yan -Date: Wed, 22 Oct 2025 15:23:57 +0800 -Subject: [PATCH 2/2] fix: correct struct packing on 32-bit with _TIME_BITS=64 - -On 32-bit platforms with glibc time64 ABI, time_t is 64-bit wide while -`long` remains 32-bit. This causes struct timeval to use two 64-bit fields -(tv_sec, tv_usec). The previous code incorrectly packed timeout as "ll", -leading to EINVAL in setsockopt(SO_RCVTIMEO). - -Use "qq" instead when m2.time_t_bits() == 64 to match the actual ABI. - -Fixes: https://todo.sr.ht/~mcepl/m2crypto/374 - -Upstream-Status: Backport [https://gitlab.com/m2crypto/m2crypto/-/commit/473de659f78e] - -Signed-off-by: Haixiao Yan ---- - src/M2Crypto/SSL/timeout.py | 24 ++++++++++++++++++++---- - 1 file changed, 20 insertions(+), 4 deletions(-) - -diff --git a/src/M2Crypto/SSL/timeout.py b/src/M2Crypto/SSL/timeout.py -index b45f38b1cbdb..5ba52283b6f8 100644 ---- a/src/M2Crypto/SSL/timeout.py -+++ b/src/M2Crypto/SSL/timeout.py -@@ -33,10 +33,14 @@ class timeout(object): - millisec = int(self.sec * 1000 + round(float(self.microsec) / 1000)) - binstr = struct.pack("l", millisec) - else: -- if m2.time_t_bits() == 32: -+ bits = m2.time_t_bits() -+ if bits == 32: - binstr = struct.pack("ii", self.sec, self.microsec) -+ elif bits == 64: -+ # handle both 64-bit and 32-bit+TIME_BITS=64 -+ binstr = struct.pack("qq", self.sec, self.microsec) - else: -- binstr = struct.pack("ll", self.sec, self.microsec) -+ raise ValueError(f"Unsupported time_t_bits: {bits}") - return binstr - - -@@ -48,7 +52,13 @@ def struct_to_timeout(binstr: bytes) -> timeout: - sec = int(millisec / 1000) - microsec = (millisec % 1000) * 1000 - else: -- (sec, microsec) = struct.unpack("ll", binstr) -+ bits = m2.time_t_bits() -+ if bits == 32: -+ (sec, microsec) = struct.unpack("ii", binstr) -+ elif bits == 64: -+ (sec, microsec) = struct.unpack("qq", binstr) -+ else: -+ raise ValueError(f"Unsupported time_t_bits: {bits}") - return timeout(sec, microsec) - - -@@ -56,4 +66,10 @@ def struct_size() -> int: - if sys.platform == "win32": - return struct.calcsize("l") - else: -- return struct.calcsize("ll") -+ bits = m2.time_t_bits() -+ if bits == 32: -+ return struct.calcsize("ii") -+ elif bits == 64: -+ return struct.calcsize("qq") -+ else: -+ raise ValueError(f"Unsupported time_t_bits: {bits}") --- -2.34.1 - diff --git a/meta-python/recipes-devtools/python/python3-m2crypto_0.46.2.bb b/meta-python/recipes-devtools/python/python3-m2crypto_0.46.2.bb deleted file mode 100644 index abe79671d2..0000000000 --- a/meta-python/recipes-devtools/python/python3-m2crypto_0.46.2.bb +++ /dev/null @@ -1,59 +0,0 @@ -SUMMARY = "A Python crypto and SSL toolkit" -HOMEPAGE = "https://gitlab.com/m2crypto/m2crypto" - -LICENSE = "BSD-2-Clause" -LIC_FILES_CHKSUM = "file://LICENSES/BSD-2-Clause.txt;md5=8099b0e569f862ece05740aef06c82a2" - -SRC_URI[sha256sum] = "13c2fa89562f7b8af40cc74b55f490be5e2ab8ccfb739f11c16d3ce6221a61ba" - -SRC_URI += " \ - file://0001-setup.py-Make-the-cmd-available.patch \ - file://0001-fix-allow-64-bit-time_t-on-32-bit-systems-in-test_is.patch \ - file://0002-fix-correct-struct-packing-on-32-bit-with-_TIME_BITS.patch \ -" - -CVE_STATUS[CVE-2009-0127] = "disputed: upstream claims there is no bug" -CVE_STATUS[CVE-2020-25657] = "fixed-version: the used version (0.46.2) contains the fix already" - -inherit pypi siteinfo python_setuptools_build_meta - -DEPENDS += "openssl swig-native" -RDEPENDS:${PN} += "\ - python3-datetime \ - python3-setuptools \ - python3-logging \ - python3-netclient \ - python3-netserver \ - python3-numbers \ - python3-xmlrpc \ -" - -DISTUTILS_BUILD_ARGS += "build_ext --openssl=${STAGING_EXECPREFIXDIR} -I${STAGING_INCDIR}" -DISTUTILS_INSTALL_ARGS += "build_ext --openssl=${STAGING_EXECPREFIXDIR}" - -SWIG_FEATURES ?= "-D__${HOST_ARCH}__ ${@['-D__ILP32__','-D__LP64__'][d.getVar('SITEINFO_BITS') != '32']} -DOPENSSL_NO_FILENAMES" - -SWIG_FEATURES:append:riscv64 = " -D__SIZEOF_POINTER__=${SITEINFO_BITS}/8 -D__riscv_xlen=${SITEINFO_BITS}" -SWIG_FEATURES:append:riscv32 = " -D__SIZEOF_POINTER__=${SITEINFO_BITS}/8 -D__riscv_xlen=${SITEINFO_BITS}" -SWIG_FEATURES:append:mipsarch = " -D_MIPS_SZPTR=${SITEINFO_BITS}" -SWIG_FEATURES:append:powerpc64le = " -D__powerpc64__" -SWIG_FEATURES:append:x86 = " -D__i386__" -SWIG_FEATURES:append:x32 = " -D__ILP32__" - -export SWIG_FEATURES - -export STAGING_DIR - -do_configure:prepend:class-target() { - # workaround for https://github.com/swiftlang/swift/issues/69311 - sed -i "/sys\/types.h/d" ${RECIPE_SYSROOT}${includedir}/openssl/e_os2.h -} - -do_install:append() { - rm -f ${D}${PYTHON_SITEPACKAGES_DIR}/M2Crypto/SSL/__pycache__/*.cpython-*.pyc - rm -f ${D}${PYTHON_SITEPACKAGES_DIR}/M2Crypto/__pycache__/*.cpython-*.pyc -} - -CVE_PRODUCT = "m2crypto" - -BBCLASSEXTEND = "native" diff --git a/meta-python/recipes-devtools/python/python3-m2crypto_0.47.0.bb b/meta-python/recipes-devtools/python/python3-m2crypto_0.47.0.bb new file mode 100644 index 0000000000..ba7bd9b8e3 --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-m2crypto_0.47.0.bb @@ -0,0 +1,55 @@ +SUMMARY = "A Python crypto and SSL toolkit" +HOMEPAGE = "https://gitlab.com/m2crypto/m2crypto" + +LICENSE = "BSD-2-Clause" +LIC_FILES_CHKSUM = "file://LICENSES/BSD-2-Clause.txt;md5=8099b0e569f862ece05740aef06c82a2" + +SRC_URI[sha256sum] = "9256300be1e0412be802aa1f827e0ce7f94deb1099b8ccdcfd9867a7f0f975bf" + +SRC_URI += "file://0001-setup.py-Make-the-cmd-available.patch" + +CVE_STATUS[CVE-2009-0127] = "disputed: upstream claims there is no bug" +CVE_STATUS[CVE-2020-25657] = "fixed-version: the used version (0.46.2) contains the fix already" + +inherit pypi siteinfo python_setuptools_build_meta + +DEPENDS += "openssl swig-native" +RDEPENDS:${PN} += "\ + python3-datetime \ + python3-setuptools \ + python3-logging \ + python3-netclient \ + python3-netserver \ + python3-numbers \ + python3-xmlrpc \ +" + +DISTUTILS_BUILD_ARGS += "build_ext --openssl=${STAGING_EXECPREFIXDIR} -I${STAGING_INCDIR}" +DISTUTILS_INSTALL_ARGS += "build_ext --openssl=${STAGING_EXECPREFIXDIR}" + +SWIG_FEATURES ?= "-D__${HOST_ARCH}__ ${@['-D__ILP32__','-D__LP64__'][d.getVar('SITEINFO_BITS') != '32']} -DOPENSSL_NO_FILENAMES" + +SWIG_FEATURES:append:riscv64 = " -D__SIZEOF_POINTER__=${SITEINFO_BITS}/8 -D__riscv_xlen=${SITEINFO_BITS}" +SWIG_FEATURES:append:riscv32 = " -D__SIZEOF_POINTER__=${SITEINFO_BITS}/8 -D__riscv_xlen=${SITEINFO_BITS}" +SWIG_FEATURES:append:mipsarch = " -D_MIPS_SZPTR=${SITEINFO_BITS}" +SWIG_FEATURES:append:powerpc64le = " -D__powerpc64__" +SWIG_FEATURES:append:x86 = " -D__i386__" +SWIG_FEATURES:append:x32 = " -D__ILP32__" + +export SWIG_FEATURES + +export STAGING_DIR + +do_configure:prepend:class-target() { + # workaround for https://github.com/swiftlang/swift/issues/69311 + sed -i "/sys\/types.h/d" ${RECIPE_SYSROOT}${includedir}/openssl/e_os2.h +} + +do_install:append() { + rm -f ${D}${PYTHON_SITEPACKAGES_DIR}/M2Crypto/SSL/__pycache__/*.cpython-*.pyc + rm -f ${D}${PYTHON_SITEPACKAGES_DIR}/M2Crypto/__pycache__/*.cpython-*.pyc +} + +CVE_PRODUCT = "m2crypto" + +BBCLASSEXTEND = "native" -- cgit v1.2.3-54-g00ecf