xref: /OK3568_Linux_fs/buildroot/package/heirloom-mailx/0002-fix-libressl-support.patch (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1From aad28d30af6c3a74c522dd61943788e908860c84 Mon Sep 17 00:00:00 2001
2From: Adam Duskett <aduskett@gmail.com>
3Date: Fri, 4 Aug 2017 07:22:47 -0400
4Subject: [PATCH] fix libressl support
5
6heirloom-mailx has two small issues when compiling against LibreSSL:
7  - RAND_egd is used (LibreSSL does not support RAND_egd)
8    Solution: "Guard" the code calling RAND_egd
9
10  - SSLv3_client_method function is used (LibreSSL does not support SSLv3)
11    Solution: "Guard" the code with #ifndef OPENSSL_NO_SSL3
12
13Signed-off-by: Adam Duskett <aduskett@gmail.com>
14---
15 openssl.c | 7 +++++++
16 1 file changed, 7 insertions(+)
17
18diff --git a/openssl.c b/openssl.c
19index 44fe4e5..c4a1bb7 100644
20--- a/openssl.c
21+++ b/openssl.c
22@@ -137,11 +137,13 @@ ssl_rand_init(void)
23
24 	if ((cp = value("ssl-rand-egd")) != NULL) {
25 		cp = expand(cp);
26+#ifndef OPENSSL_NO_EGD
27 		if (RAND_egd(cp) == -1) {
28 			fprintf(stderr, catgets(catd, CATSET, 245,
29 				"entropy daemon at \"%s\" not available\n"),
30 					cp);
31 		} else
32+#endif
33 			state = 1;
34 	} else if ((cp = value("ssl-rand-file")) != NULL) {
35 		cp = expand(cp);
36@@ -216,10 +218,15 @@ ssl_select_method(const char *uhp)
37
38 	cp = ssl_method_string(uhp);
39 	if (cp != NULL) {
40+		#ifndef OPENSSL_NO_SSL3
41 		if (equal(cp, "ssl3"))
42 			method = SSLv3_client_method();
43 		else if (equal(cp, "tls1"))
44 			method = TLSv1_client_method();
45+		#else
46+		if (equal(cp, "tls1"))
47+			method = TLSv1_client_method();
48+		#endif
49 		else {
50 			fprintf(stderr, catgets(catd, CATSET, 244,
51 					"Invalid SSL method \"%s\"\n"), cp);
52--
532.13.3
54
55