aboutsummaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-extended/mailx/files/0001-support-openssl-1.1.x.patch
blob: 6a8911daf7b9bbc66b7dba7b4d216f207d74edbd (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
61
62
63
64
65
66
67
68
69
70
71
72
From 7db6d8a657d13bb562a27c6181accaf3e53c0efd Mon Sep 17 00:00:00 2001
From: Hongxu Jia <hongxu.jia@windriver.com>
Date: Tue, 25 Sep 2018 14:03:10 +0800
Subject: [PATCH] support openssl 1.1.x

Long time no maintain from upstream since 2013-06-04
(https://sourceforge.net/projects/nail/), backport a
fix from openSUSE

Upstream-Status: Backport [openSUSE]
https://build.opensuse.org/package/view_file/openSUSE:Leap:15.0/mailx/mailx-12.5-openssl-1.1.0f.patch?expand=1

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
 openssl.c | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/openssl.c b/openssl.c
index 44fe4e5..0ccc517 100644
--- a/openssl.c
+++ b/openssl.c
@@ -137,7 +137,12 @@ ssl_rand_init(void)
 
 	if ((cp = value("ssl-rand-egd")) != NULL) {
 		cp = expand(cp);
-		if (RAND_egd(cp) == -1) {
+#ifndef OPENSSL_NO_EGD
+		if (RAND_egd(cp) == -1)
+#else
+		if (1)
+#endif
+		{
 			fprintf(stderr, catgets(catd, CATSET, 245,
 				"entropy daemon at \"%s\" not available\n"),
 					cp);
@@ -216,6 +221,7 @@ ssl_select_method(const char *uhp)
 
 	cp = ssl_method_string(uhp);
 	if (cp != NULL) {
+#if defined(OPENSSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER < 0x1010006fL
 		if (equal(cp, "ssl3"))
 			method = SSLv3_client_method();
 		else if (equal(cp, "tls1"))
@@ -225,8 +231,25 @@ ssl_select_method(const char *uhp)
 					"Invalid SSL method \"%s\"\n"), cp);
 			method = SSLv23_client_method();
 		}
+#else
+		method = NULL;
+		if (equal(cp, "tls"))
+			method = TLS_client_method();
+		else if (equal(cp, "dtls"))
+			method = DTLS_client_method();
+
+		if (!method) {
+			fprintf(stderr, catgets(catd, CATSET, 244,
+					"Invalid SSL method \"%s\"\n"), cp);
+			method = TLS_client_method();
+		}
+#endif
 	} else
+#if defined(OPENSSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER < 0x1010006fL
 		method = SSLv23_client_method();
+#else
+		method = TLS_client_method();
+#endif
 	return method;
 }
 
-- 
2.7.4