blob: 6a8911daf7b9bbc66b7dba7b4d216f207d74edbd [file] [log] [blame]
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08001From 7db6d8a657d13bb562a27c6181accaf3e53c0efd Mon Sep 17 00:00:00 2001
2From: Hongxu Jia <hongxu.jia@windriver.com>
3Date: Tue, 25 Sep 2018 14:03:10 +0800
4Subject: [PATCH] support openssl 1.1.x
5
6Long time no maintain from upstream since 2013-06-04
7(https://sourceforge.net/projects/nail/), backport a
8fix from openSUSE
9
10Upstream-Status: Backport [openSUSE]
11https://build.opensuse.org/package/view_file/openSUSE:Leap:15.0/mailx/mailx-12.5-openssl-1.1.0f.patch?expand=1
12
13Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
14---
15 openssl.c | 25 ++++++++++++++++++++++++-
16 1 file changed, 24 insertions(+), 1 deletion(-)
17
18diff --git a/openssl.c b/openssl.c
19index 44fe4e5..0ccc517 100644
20--- a/openssl.c
21+++ b/openssl.c
22@@ -137,7 +137,12 @@ ssl_rand_init(void)
23
24 if ((cp = value("ssl-rand-egd")) != NULL) {
25 cp = expand(cp);
26- if (RAND_egd(cp) == -1) {
27+#ifndef OPENSSL_NO_EGD
28+ if (RAND_egd(cp) == -1)
29+#else
30+ if (1)
31+#endif
32+ {
33 fprintf(stderr, catgets(catd, CATSET, 245,
34 "entropy daemon at \"%s\" not available\n"),
35 cp);
36@@ -216,6 +221,7 @@ ssl_select_method(const char *uhp)
37
38 cp = ssl_method_string(uhp);
39 if (cp != NULL) {
40+#if defined(OPENSSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER < 0x1010006fL
41 if (equal(cp, "ssl3"))
42 method = SSLv3_client_method();
43 else if (equal(cp, "tls1"))
44@@ -225,8 +231,25 @@ ssl_select_method(const char *uhp)
45 "Invalid SSL method \"%s\"\n"), cp);
46 method = SSLv23_client_method();
47 }
48+#else
49+ method = NULL;
50+ if (equal(cp, "tls"))
51+ method = TLS_client_method();
52+ else if (equal(cp, "dtls"))
53+ method = DTLS_client_method();
54+
55+ if (!method) {
56+ fprintf(stderr, catgets(catd, CATSET, 244,
57+ "Invalid SSL method \"%s\"\n"), cp);
58+ method = TLS_client_method();
59+ }
60+#endif
61 } else
62+#if defined(OPENSSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER < 0x1010006fL
63 method = SSLv23_client_method();
64+#else
65+ method = TLS_client_method();
66+#endif
67 return method;
68 }
69
70--
712.7.4
72