blob: 82d35510199aaffda310b22da42f93d53162e7b9 [file] [log] [blame]
Patrick Williamsdb4c27e2022-08-05 08:10:29 -05001From 7ff4eba20b5c4fc7365e5ee0dfb775ed29bdd5ce Mon Sep 17 00:00:00 2001
2From: Kai Kang <kai.kang@windriver.com>
3Date: Wed, 1 Nov 2017 09:23:41 -0400
4Subject: [PATCH] stunnel: fix compile error when openssl disable des support
5
Brad Bishopd7bf8c12018-02-25 22:55:05 -05006Upstream-Status: Pending
7
8When openssl disable des support with configure option 'no-des', it doesn't
9provide des related header file and functions. That causes stunnel compile
10failed. Fix it by checking macro OPENSSL_NO_DES to use openssl des related
11library conditionaly.
12
13Signed-off-by: Kai Kang <kai.kang@windriver.com>
14---
Patrick Williamsdb4c27e2022-08-05 08:10:29 -050015 src/common.h | 2 ++
16 src/protocol.c | 6 +++---
17 2 files changed, 5 insertions(+), 3 deletions(-)
18
Brad Bishopd7bf8c12018-02-25 22:55:05 -050019diff --git a/src/common.h b/src/common.h
Patrick Williams03514f12024-04-05 07:04:11 -050020index 2b4869f..180d31a 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -050021--- a/src/common.h
22+++ b/src/common.h
Patrick Williams03514f12024-04-05 07:04:11 -050023@@ -492,7 +492,9 @@ extern char *sys_errlist[];
Brad Bishopd7bf8c12018-02-25 22:55:05 -050024 #ifndef OPENSSL_NO_MD4
25 #include <openssl/md4.h>
26 #endif /* !defined(OPENSSL_NO_MD4) */
27+#ifndef OPENSSL_NO_DES
28 #include <openssl/des.h>
29+#endif
30 #ifndef OPENSSL_NO_DH
31 #include <openssl/dh.h>
32 #if OPENSSL_VERSION_NUMBER<0x10100000L
33diff --git a/src/protocol.c b/src/protocol.c
Patrick Williams03514f12024-04-05 07:04:11 -050034index cfe6d3b..3936aea 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -050035--- a/src/protocol.c
36+++ b/src/protocol.c
Patrick Williams03514f12024-04-05 07:04:11 -050037@@ -81,7 +81,7 @@ NOEXPORT void ldap_client_middle(CLI *);
38
39 NOEXPORT void connect_server_early(CLI *);
40 NOEXPORT void connect_client_middle(CLI *);
Brad Bishopd7bf8c12018-02-25 22:55:05 -050041-#ifndef OPENSSL_NO_MD4
42+#if !defined(OPENSSL_NO_MD4) && !defined(OPENSSL_NO_DES)
Patrick Williams03514f12024-04-05 07:04:11 -050043 NOEXPORT void ntlm(CLI *);
Patrick Williamsdb4c27e2022-08-05 08:10:29 -050044 NOEXPORT char *ntlm1(void);
Brad Bishopd7bf8c12018-02-25 22:55:05 -050045 NOEXPORT char *ntlm3(char *, char *, char *, char *);
Patrick Williams03514f12024-04-05 07:04:11 -050046@@ -1331,7 +1331,7 @@ NOEXPORT void connect_client_middle(CLI *c) {
47 fd_printf(c, c->remote_fd.fd, "Host: %s", c->opt->protocol_host);
48 if(c->opt->protocol_username && c->opt->protocol_password) {
49 if(!strcasecmp(c->opt->protocol_authentication, "ntlm")) {
Brad Bishopd7bf8c12018-02-25 22:55:05 -050050-#ifndef OPENSSL_NO_MD4
51+#if !defined(OPENSSL_NO_MD4) && !defined(OPENSSL_NO_DES)
Patrick Williams03514f12024-04-05 07:04:11 -050052 ntlm(c);
Brad Bishopd7bf8c12018-02-25 22:55:05 -050053 #else
54 s_log(LOG_ERR, "NTLM authentication is not available");
Patrick Williams03514f12024-04-05 07:04:11 -050055@@ -1374,7 +1374,7 @@ NOEXPORT void connect_client_middle(CLI *c) {
56 str_free(line);
Brad Bishopd7bf8c12018-02-25 22:55:05 -050057 }
58
59-#ifndef OPENSSL_NO_MD4
60+#if !defined(OPENSSL_NO_MD4) && !defined(OPENSSL_NO_DES)
61
62 /*
63 * NTLM code is based on the following documentation:
Patrick Williams03514f12024-04-05 07:04:11 -050064--
652.34.1
66