blob: 6a8911daf7b9bbc66b7dba7b4d216f207d74edbd [file] [log] [blame]
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