summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/python/python3/0001-bpo-46114-Fix-OpenSSL-version-check-for-3.0.1-GH-301.patch
blob: 6f4ceae1889db9825b984d78bea618df059d186c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Upstream-Status: Backport
Signed-off-by: Ross Burton <ross.burton@arm.com>

From 251d2eadc7f5b4042245709f41c38169a284e146 Mon Sep 17 00:00:00 2001
From: "Miss Islington (bot)"
 <31488909+miss-islington@users.noreply.github.com>
Date: Fri, 17 Dec 2021 07:38:11 -0800
Subject: [PATCH] bpo-46114: Fix OpenSSL version check for 3.0.1 (GH-30170)

(cherry picked from commit 2985feac4e02d590bb78bcce9e30864be53280ac)

Co-authored-by: Christian Heimes <christian@python.org>
---
 .github/workflows/build.yml                                 | 2 +-
 Lib/test/test_ssl.py                                        | 6 +++++-
 .../next/Tests/2021-12-17-14-46-19.bpo-46114.9iyZ_9.rst     | 1 +
 Tools/ssl/multissltests.py                                  | 2 +-
 4 files changed, 8 insertions(+), 3 deletions(-)
 create mode 100644 Misc/NEWS.d/next/Tests/2021-12-17-14-46-19.bpo-46114.9iyZ_9.rst

diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py
index a485f7d4c3..873db6403d 100644
--- a/Lib/test/test_ssl.py
+++ b/Lib/test/test_ssl.py
@@ -539,7 +539,11 @@ def test_openssl_version(self):
         self.assertLessEqual(status, 15)
 
         libressl_ver = f"LibreSSL {major:d}"
-        openssl_ver = f"OpenSSL {major:d}.{minor:d}.{fix:d}"
+        if major >= 3:
+            # 3.x uses 0xMNN00PP0L
+            openssl_ver = f"OpenSSL {major:d}.{minor:d}.{patch:d}"
+        else:
+            openssl_ver = f"OpenSSL {major:d}.{minor:d}.{fix:d}"
         self.assertTrue(
             s.startswith((openssl_ver, libressl_ver)),
             (s, t, hex(n))
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 0000000000..6878cea032
--- /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 ba2663e9a3..8fe5b5d0c2 100755
--- a/Tools/ssl/multissltests.py
+++ b/Tools/ssl/multissltests.py
@@ -48,7 +48,7 @@
 
 OPENSSL_RECENT_VERSIONS = [
     "1.1.1l",
-    "3.0.0"
+    "3.0.1"
 ]
 
 LIBRESSL_OLD_VERSIONS = [
-- 
2.25.1