From: Christian Heimes Date: Fri, 17 Dec 2021 16:02:38 +0000 (+0200) Subject: [3.9] bpo-46114: Fix OpenSSL version check for 3.0.1 (GH-30170) (GH-30173) X-Git-Tag: v3.9.10~53 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a9b3edb66f2976a5895b6399ee905ac2f27718ac;p=thirdparty%2FPython%2Fcpython.git [3.9] bpo-46114: Fix OpenSSL version check for 3.0.1 (GH-30170) (GH-30173) Co-authored-by: Christian Heimes --- diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 295b24c2cf13..e7f37f57e9a9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -207,7 +207,7 @@ jobs: strategy: fail-fast: false matrix: - openssl_ver: [1.0.2u, 1.1.0l, 1.1.1l, 3.0.0] + openssl_ver: [1.0.2u, 1.1.0l, 1.1.1l, 3.0.1] env: OPENSSL_VER: ${{ matrix.openssl_ver }} MULTISSL_DIR: ${{ github.workspace }}/multissl diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py index 42ebcc04dc2b..b5eb40f86970 100644 --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -589,13 +589,16 @@ class BasicSocketTests(unittest.TestCase): self.assertLessEqual(patch, 63) self.assertGreaterEqual(status, 0) self.assertLessEqual(status, 15) - # Version string as returned by {Open,Libre}SSL, the format might change - if IS_LIBRESSL: - self.assertTrue(s.startswith("LibreSSL {:d}".format(major)), - (s, t, hex(n))) + libressl_ver = f"LibreSSL {major:d}" + if major >= 3: + # 3.x uses 0xMNN00PP0L + openssl_ver = f"OpenSSL {major:d}.{minor:d}.{patch:d}" else: - self.assertTrue(s.startswith("OpenSSL {:d}.{:d}.{:d}".format(major, minor, fix)), - (s, t, hex(n))) + openssl_ver = f"OpenSSL {major:d}.{minor:d}.{fix:d}" + self.assertTrue( + s.startswith((openssl_ver, libressl_ver)), + (s, t, hex(n)) + ) @support.cpython_only def test_refcycle(self): diff --git a/Misc/NEWS.d/next/Tests/2021-12-17-14-46-19.bpo-46114.9iyZ_9.rst b/Misc/NEWS.d/next/Tests/2021-12-17-14-46-19.bpo-46114.9iyZ_9.rst new file mode 100644 index 000000000000..6878cea03238 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2021-12-17-14-46-19.bpo-46114.9iyZ_9.rst @@ -0,0 +1 @@ +Fix test case for OpenSSL 3.0.1 version. OpenSSL 3.0 uses ``0xMNN00PP0L``. diff --git a/Tools/ssl/multissltests.py b/Tools/ssl/multissltests.py index 8888c4a6e585..8732d01e51be 100755 --- a/Tools/ssl/multissltests.py +++ b/Tools/ssl/multissltests.py @@ -50,7 +50,7 @@ OPENSSL_OLD_VERSIONS = [ OPENSSL_RECENT_VERSIONS = [ "1.1.1l", - "3.0.0" + "3.0.1" ] LIBRESSL_OLD_VERSIONS = [