summaryrefslogtreecommitdiff
path: root/dev-perl/IO-Socket-SSL/files/2.83.0-openssl-compat.patch
blob: 4653246125c83163e3aae9694f87b78bcc18688b (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
From a1ff93e99d504eb11cec1739ca57057731e3c2cb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
Date: Thu, 28 Sep 2023 22:20:59 +0200
Subject: [PATCH] Adapt to new OpenSSL version / ABI compatibility scheme
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

https://www.openssl.org/policies/releasestrat.html

In short, as of 3.0.0, when the version is MAJOR.MINOR.PATCH,
only changes in MAJOR indicate API/ABI incompatible changes.

Fixes: https://github.com/noxxi/p5-io-socket-ssl/issues/137
Bug: https://bugs.gentoo.org/show_bug.cgi?id=909545
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
---
 Makefile.PL | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/Makefile.PL b/Makefile.PL
index 8a35591..f6b3195 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -64,16 +64,27 @@ if (my $compiled = eval {
 	$compiled) if $compiled < 0x00908000;
 
     my $linked = Net::SSLeay::SSLeay();
-    if (($compiled ^ $linked) >= 0x00001000) {
-	die sprintf("API-different OpenSSL versions compiled in (0x%08x) vs linked (0x%08x)",
-	    $compiled,$linked);
-    }
 
     # OpenSSL 1.1.1e introduced behavior changes breaking various code
     # will likely be reverted  in 1.1.1f - enforce to not use this version
     if ($linked == 0x1010105f) {
 	die "detected OpenSSL 1.1.1e - please use a different version\n";
     }
+
+    # For old versions we need to be rather strict, however OpenSSL explicitly
+    # declares that from 3.0 on x.y versions are for all y ABI-compatible.
+    # https://www.openssl.org/policies/releasestrat.html
+    if ($linked <  0x30000000) {
+      if (($compiled ^ $linked) >= 0x00001000) {
+	  die sprintf("API-different OpenSSL versions compiled in (0x%08x) vs linked (0x%08x)",
+	      $compiled,$linked);
+      }
+    } else {
+      if (($compiled ^ $linked) >= 0x10000000) {
+	  die sprintf("API-different OpenSSL versions compiled in (0x%08x) vs linked (0x%08x)",
+	      $compiled,$linked);
+      }
+    }
 }
 
 # make sure that we have dualvar from the XS Version of Scalar::Util