From e2be38a5e98caf348fae0826b471655c76c741cdfb7d77c3e7c2fa59a9ae0031 Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Tue, 24 Oct 2023 15:14:34 +0000 Subject: [PATCH 1/2] =?UTF-8?q?-=20Update=20to=200.40.0:=20=20=20-=20OK,?= =?UTF-8?q?=20SO=20NOT=20THIS=20RELEASE,=20BUT=20IN=20THE=20NEXT=20RELEASE?= =?UTF-8?q?=20PYTHON2=20WILL=20=20=20=20=20TRULY=20GO!=20=20=20-=20BREAKIN?= =?UTF-8?q?G=20CHANGES:=20=20=20=20=20-=20There=20are=20no=20SWIG=20genera?= =?UTF-8?q?ted=20files=20(src/SWIG/=5Fm2crytpo=5Fwrap.c)=20=20=20=20=20=20?= =?UTF-8?q?=20included=20anymore,=20so=20swig=20must=20be=20installed,=20n?= =?UTF-8?q?o=20=20=20=20=20=20=20exceptions!=20Also,=20for=20compatibility?= =?UTF-8?q?=20with=20Python=203.12+,=20swig=20=20=20=20=20=20=204.0+=20is?= =?UTF-8?q?=20required.=20=20=20=20=20=20-=20All=20support=20for=20asyncor?= =?UTF-8?q?e=20has=20been=20removed,=20as=20it=20has=20been=20=20=20=20=20?= =?UTF-8?q?=20=20=20removed=20in=20Python=203.12=20as=20well=20(which=20me?= =?UTF-8?q?ans=20also=20removal=20of=20=20=20=20=20=20=20=20contrib/dispat?= =?UTF-8?q?cher.py,=20M2Crypto/SSL/ssl=5Fdispatcher.py,=20=20=20=20=20=20?= =?UTF-8?q?=20=20ZServerSSL).=20=20=20=20=20=20-=20All=20use=20of=20distut?= =?UTF-8?q?ils=20(including=20the=20bundled=20ones=20in=20=20=20=20=20=20?= =?UTF-8?q?=20=20setuptools)=20has=20been=20removed,=20so=20`setup.py=20cl?= =?UTF-8?q?ean`=20is=20no=20=20=20=20=20=20=20=20more.=20=20=20=20=20=20-?= =?UTF-8?q?=20Excessively=20complicated=20and=20error-prone=20=5F=5Finit?= =?UTF-8?q?=5F=5Fpy=20has=20been=20=20=20=20=20=20=20=20cleaned=20and=20`i?= =?UTF-8?q?mport=20M2Crypto`=20doesn=E2=80=99t=20include=20everything=20?= =?UTF-8?q?=20=20=20=20=20=20=20anymore.=20Imports=20should=20specified=20?= =?UTF-8?q?as=20for=20example=20with=20`from=20=20=20=20=20=20=20=20M2Cryp?= =?UTF-8?q?to=20import=20foo`.=20=20=20-=20ASN1=5FTime=20handling=20has=20?= =?UTF-8?q?been=20mostly=20rewritten=20and=20it=20almost=20=20=20=20=20wor?= =?UTF-8?q?ks=20even=20on=20Windows.=20=20=20-=20All=20tests=20in=20Gitlab?= =?UTF-8?q?=20CI=20(with=20exceptions=20of=20some=20skipped=20tests=20=20?= =?UTF-8?q?=20=20=20especially=20on=20Windows)=20are=20now=20green,=20test?= =?UTF-8?q?s=20of=20Python=202.7=20on=20=20=20=20=20CentOS=207=20have=20be?= =?UTF-8?q?en=20included.=20=20=20-=20Introduce=20m2.err=5Fclear=5Ferror()?= =?UTF-8?q?=20=20=20-=20Make=20X509=5Fverify=5Fcert()=20accessible=20as=20?= =?UTF-8?q?m2.x509=5Fverify=5Fcert?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-M2Crypto?expand=0&rev=123 --- M2Crypto-0.39.0.tar.gz | 3 --- M2Crypto-0.39.0.tar.gz.asc | 6 ------ M2Crypto-0.40.0.tar.gz | 3 +++ M2Crypto-0.40.0.tar.gz.asc | Bin 0 -> 95 bytes python-M2Crypto.changes | 30 ++++++++++++++++++++++++++++++ python-M2Crypto.spec | 2 +- 6 files changed, 34 insertions(+), 10 deletions(-) delete mode 100644 M2Crypto-0.39.0.tar.gz delete mode 100644 M2Crypto-0.39.0.tar.gz.asc create mode 100644 M2Crypto-0.40.0.tar.gz create mode 100644 M2Crypto-0.40.0.tar.gz.asc diff --git a/M2Crypto-0.39.0.tar.gz b/M2Crypto-0.39.0.tar.gz deleted file mode 100644 index bc28737..0000000 --- a/M2Crypto-0.39.0.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:24c0f471358b8b19ad4c8aa9da12e868030b65c1fdb3279d006df60c9501338a -size 1248372 diff --git a/M2Crypto-0.39.0.tar.gz.asc b/M2Crypto-0.39.0.tar.gz.asc deleted file mode 100644 index fcdfa3e..0000000 --- a/M2Crypto-0.39.0.tar.gz.asc +++ /dev/null @@ -1,6 +0,0 @@ ------BEGIN PGP SIGNATURE----- - -iF0EABECAB0WIQSJ70vGKIq/QxurJcPgn+8l2WSErAUCZKRcPQAKCRDgn+8l2WSE -rOdTAJ94HzHyNz9/cD+BQje4mM6EBhPkzwCcCaHGd/j7TbdV4Y0GvdbzvHgAbFY= -=nPc4 ------END PGP SIGNATURE----- diff --git a/M2Crypto-0.40.0.tar.gz b/M2Crypto-0.40.0.tar.gz new file mode 100644 index 0000000..a2e78bf --- /dev/null +++ b/M2Crypto-0.40.0.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7eaac7d8e90a7075b1e5a21e4a2696cec39a5df292044a13734ac7169e1e4356 +size 1265903 diff --git a/M2Crypto-0.40.0.tar.gz.asc b/M2Crypto-0.40.0.tar.gz.asc new file mode 100644 index 0000000000000000000000000000000000000000000000000000000000000000..c003365192e5c269cf79f99890285d692d68ec18fdb044119786b1cb49983ec4 GIT binary patch literal 95 zcmeB(WnmCxVvrS6Wa)hGeN3Zkzq9me)x!_wzgNAP(z1q?Db@V$dfO% vwGkTYbGO?uPwn|Bl(2KV!N)z)4D+Ma{_S@EYpUMmBibIZu;X26x?>{%=T0Y_ literal 0 HcmV?d00001 diff --git a/python-M2Crypto.changes b/python-M2Crypto.changes index 0b36aa3..b91b2d6 100644 --- a/python-M2Crypto.changes +++ b/python-M2Crypto.changes @@ -1,3 +1,33 @@ +------------------------------------------------------------------- +Tue Oct 24 15:13:16 UTC 2023 - Matej Cepl + +- Update to 0.40.0: + - OK, SO NOT THIS RELEASE, BUT IN THE NEXT RELEASE PYTHON2 WILL + TRULY GO! + - BREAKING CHANGES: + - There are no SWIG generated files (src/SWIG/_m2crytpo_wrap.c) + included anymore, so swig must be installed, no + exceptions! Also, for compatibility with Python 3.12+, swig + 4.0+ is required. + - All support for asyncore has been removed, as it has been + removed in Python 3.12 as well (which means also removal of + contrib/dispatcher.py, M2Crypto/SSL/ssl_dispatcher.py, + ZServerSSL). + - All use of distutils (including the bundled ones in + setuptools) has been removed, so `setup.py clean` is no + more. + - Excessively complicated and error-prone __init__py has been + cleaned and `import M2Crypto` doesn’t include everything + anymore. Imports should specified as for example with `from + M2Crypto import foo`. + - ASN1_Time handling has been mostly rewritten and it almost + works even on Windows. + - All tests in Gitlab CI (with exceptions of some skipped tests + especially on Windows) are now green, tests of Python 2.7 on + CentOS 7 have been included. + - Introduce m2.err_clear_error() + - Make X509_verify_cert() accessible as m2.x509_verify_cert + ------------------------------------------------------------------- Mon Aug 7 13:14:41 UTC 2023 - Matej Cepl diff --git a/python-M2Crypto.spec b/python-M2Crypto.spec index fc951e4..41bae24 100644 --- a/python-M2Crypto.spec +++ b/python-M2Crypto.spec @@ -18,7 +18,7 @@ %define oldpython python Name: python-M2Crypto -Version: 0.39.0 +Version: 0.40.0 Release: 0 Summary: Crypto and SSL toolkit for Python License: MIT From b5fd22981b54fe340e906295277e750b95e73c508c934874176af727958d8122 Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Tue, 24 Oct 2023 15:32:34 +0000 Subject: [PATCH 2/2] - Add 32bit_ASN1_Time.patch to quench errors on 32bit archs. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-M2Crypto?expand=0&rev=124 --- 32bit_ASN1_Time.patch | 115 ++++++++++++++++++++++++++++++++++++++++ python-M2Crypto.changes | 1 + python-M2Crypto.spec | 3 ++ 3 files changed, 119 insertions(+) create mode 100644 32bit_ASN1_Time.patch diff --git a/32bit_ASN1_Time.patch b/32bit_ASN1_Time.patch new file mode 100644 index 0000000..8a84fe3 --- /dev/null +++ b/32bit_ASN1_Time.patch @@ -0,0 +1,115 @@ +--- + src/M2Crypto/util.py | 4 ++++ + tests/test_asn1.py | 11 +++++------ + tests/test_x509.py | 9 ++++----- + 3 files changed, 13 insertions(+), 11 deletions(-) + +--- a/src/M2Crypto/util.py ++++ b/src/M2Crypto/util.py +@@ -13,6 +13,7 @@ from __future__ import absolute_import + + import binascii + import logging ++import struct + import sys + + from M2Crypto import m2, six +@@ -29,6 +30,9 @@ class UtilError(Exception): + + m2.util_init(UtilError) + ++def is_32bit(): ++ # type: () -> bool ++ return (struct.calcsize("P") * 8) == 32 + + def pkcs5_pad(data, blklen=8): + # type: (str, int) -> str +--- a/tests/test_asn1.py ++++ b/tests/test_asn1.py +@@ -5,10 +5,9 @@ + Copyright (c) 2005 Open Source Applications Foundation. All rights reserved.""" + + import datetime +-import platform + import time + +-from M2Crypto import ASN1, m2 ++from M2Crypto import ASN1, m2, util + from tests import unittest + + +@@ -39,7 +38,7 @@ class ASN1TestCase(unittest.TestCase): + def test_Object(self): + pass # XXX Dunno how to test + +- @unittest.skipIf(platform.system() == 'Windows', 'Skip on Windows.') ++ @unittest.skipIf(util.is_32bit(), 'Skip on 32bit architectures.') + def test_TIME(self): + asn1 = ASN1.ASN1_TIME() + self.assertEqual(str(asn1), 'Bad time value') +@@ -66,7 +65,7 @@ class ASN1TestCase(unittest.TestCase): + t2 = time.strftime(format, time.gmtime(t)) + self.assertEqual(t1, t2) + +- @unittest.skipIf(platform.system() == 'Windows', 'Skip on Windows.') ++ @unittest.skipIf(util.is_32bit(), 'Skip on 32bit architectures.') + def test_UTCTIME(self): + asn1 = ASN1.ASN1_UTCTIME() + self.assertEqual(str(asn1), 'Bad time value') +@@ -93,7 +92,7 @@ class ASN1TestCase(unittest.TestCase): + t2 = time.strftime(format, time.gmtime(t)) + self.assertEqual(t1, t2) + +- @unittest.skipIf(platform.system() == 'Windows', 'Skip on Windows.') ++ @unittest.skipIf(util.is_32bit(), 'Skip on 32bit architectures.') + def test_TIME_datetime(self): + asn1 = ASN1.ASN1_TIME() + # Test get_datetime and set_datetime +@@ -119,7 +118,7 @@ class ASN1TestCase(unittest.TestCase): + self.assertEqual(t1, t2) + self.assertEqual(str(udt), str(asn1.get_datetime())) + +- @unittest.skipIf(platform.system() == 'Windows', 'Skip on Windows.') ++ @unittest.skipIf(util.is_32bit(), 'Skip on 32bit architectures.') + def test_UTCTIME_datetime(self): + asn1 = ASN1.ASN1_UTCTIME() + # Test get_datetime and set_datetime +--- a/tests/test_x509.py ++++ b/tests/test_x509.py +@@ -12,11 +12,10 @@ Author: Heikki Toivonen + import base64 + import logging + import os +-import platform + import time + import warnings + +-from M2Crypto import ASN1, BIO, EVP, RSA, Rand, X509, m2, six # noqa ++from M2Crypto import ASN1, BIO, EVP, RSA, Rand, X509, m2, six, util # noqa + from tests import unittest + + log = logging.getLogger(__name__) +@@ -244,7 +243,7 @@ class X509TestCase(unittest.TestCase): + req.set_version(0) + self.assertEqual(req.get_version(), 0) + +- @unittest.skipIf(platform.system() == 'Windows', 'Skip on Windows.') ++ @unittest.skipIf(util.is_32bit(), 'Skip on 32bit architectures.') + def test_mkcert(self): + for utc in (True, False): + req, pk = self.mkreq(1024) +@@ -588,12 +587,12 @@ class X509TestCase(unittest.TestCase): + self.assertEqual(cert.get_serial_number(), + 127614157056681299805556476275995414779) + +- @unittest.skipIf(platform.system() == 'Windows', 'Skip on Windows.') ++ @unittest.skipIf(util.is_32bit(), 'Skip on 32bit architectures.') + def test_date_after_2050_working(self): + cert = X509.load_cert('tests/bad_date_cert.crt') + self.assertEqual(str(cert.get_not_after()), 'Feb 9 14:57:46 2116 GMT') + +- @unittest.skipIf(platform.system() == 'Windows', 'Skip on Windows.') ++ @unittest.skipIf(util.is_32bit(), 'Skip on 32bit architectures.') + def test_date_reference_counting(self): + """x509_get_not_before() and x509_get_not_after() return internal + pointers into X509. As the returned ASN1_TIME objects do not store any diff --git a/python-M2Crypto.changes b/python-M2Crypto.changes index b91b2d6..0191f4c 100644 --- a/python-M2Crypto.changes +++ b/python-M2Crypto.changes @@ -27,6 +27,7 @@ Tue Oct 24 15:13:16 UTC 2023 - Matej Cepl CentOS 7 have been included. - Introduce m2.err_clear_error() - Make X509_verify_cert() accessible as m2.x509_verify_cert +- Add 32bit_ASN1_Time.patch to quench errors on 32bit archs. ------------------------------------------------------------------- Mon Aug 7 13:14:41 UTC 2023 - Matej Cepl diff --git a/python-M2Crypto.spec b/python-M2Crypto.spec index 41bae24..f7812d0 100644 --- a/python-M2Crypto.spec +++ b/python-M2Crypto.spec @@ -27,6 +27,9 @@ URL: https://gitlab.com/m2crypto/m2crypto Source0: https://files.pythonhosted.org/packages/source/M/M2Crypto/M2Crypto-%{version}.tar.gz Source1: M2Crypto-%{version}.tar.gz.asc Source99: python-M2Crypto.keyring +# PATCH-FIX-UPSTREAM 32bit_ASN1_Time.patch gl#m2crypto/m2crypto/-#341 mcepl@suse.com +# Not only Windows but all 32bit archs have fouled ASN1_Time. +Patch0: 32bit_ASN1_Time.patch BuildRequires: %{python_module devel} BuildRequires: %{python_module pip} BuildRequires: %{python_module typing}