blob: 0840cbbd8b30bca97cff305f6636993b5cfae507 [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>
Patrick Williamsdb4c27e2022-08-05 08:10:29 -050014
Brad Bishopd7bf8c12018-02-25 22:55:05 -050015---
Patrick Williamsdb4c27e2022-08-05 08:10:29 -050016 src/common.h | 2 ++
17 src/protocol.c | 6 +++---
18 2 files changed, 5 insertions(+), 3 deletions(-)
19
Brad Bishopd7bf8c12018-02-25 22:55:05 -050020diff --git a/src/common.h b/src/common.h
Patrick Williamsdb4c27e2022-08-05 08:10:29 -050021index bc37eb5..03ee3e5 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -050022--- a/src/common.h
23+++ b/src/common.h
Patrick Williamsdb4c27e2022-08-05 08:10:29 -050024@@ -486,7 +486,9 @@ extern char *sys_errlist[];
Brad Bishopd7bf8c12018-02-25 22:55:05 -050025 #ifndef OPENSSL_NO_MD4
26 #include <openssl/md4.h>
27 #endif /* !defined(OPENSSL_NO_MD4) */
28+#ifndef OPENSSL_NO_DES
29 #include <openssl/des.h>
30+#endif
31 #ifndef OPENSSL_NO_DH
32 #include <openssl/dh.h>
33 #if OPENSSL_VERSION_NUMBER<0x10100000L
34diff --git a/src/protocol.c b/src/protocol.c
Patrick Williamsdb4c27e2022-08-05 08:10:29 -050035index 804f115..d9b2b50 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -050036--- a/src/protocol.c
37+++ b/src/protocol.c
Patrick Williamsdb4c27e2022-08-05 08:10:29 -050038@@ -66,7 +66,7 @@ NOEXPORT char *nntp_client(CLI *, SERVICE_OPTIONS *, const PHASE);
Andrew Geisslere34f8962021-04-15 15:53:51 -050039 NOEXPORT char *ldap_client(CLI *, SERVICE_OPTIONS *, const PHASE);
Brad Bishopd7bf8c12018-02-25 22:55:05 -050040 NOEXPORT char *connect_server(CLI *, SERVICE_OPTIONS *, const PHASE);
41 NOEXPORT char *connect_client(CLI *, SERVICE_OPTIONS *, const PHASE);
42-#ifndef OPENSSL_NO_MD4
43+#if !defined(OPENSSL_NO_MD4) && !defined(OPENSSL_NO_DES)
44 NOEXPORT void ntlm(CLI *, SERVICE_OPTIONS *);
Patrick Williamsdb4c27e2022-08-05 08:10:29 -050045 NOEXPORT char *ntlm1(void);
Brad Bishopd7bf8c12018-02-25 22:55:05 -050046 NOEXPORT char *ntlm3(char *, char *, char *, char *);
Patrick Williamsdb4c27e2022-08-05 08:10:29 -050047@@ -1351,7 +1351,7 @@ NOEXPORT char *connect_client(CLI *c, SERVICE_OPTIONS *opt, const PHASE phase) {
Brad Bishopd7bf8c12018-02-25 22:55:05 -050048 fd_printf(c, c->remote_fd.fd, "Host: %s", opt->protocol_host);
49 if(opt->protocol_username && opt->protocol_password) {
50 if(!strcasecmp(opt->protocol_authentication, "ntlm")) {
51-#ifndef OPENSSL_NO_MD4
52+#if !defined(OPENSSL_NO_MD4) && !defined(OPENSSL_NO_DES)
53 ntlm(c, opt);
54 #else
55 s_log(LOG_ERR, "NTLM authentication is not available");
Patrick Williamsdb4c27e2022-08-05 08:10:29 -050056@@ -1395,7 +1395,7 @@ NOEXPORT char *connect_client(CLI *c, SERVICE_OPTIONS *opt, const PHASE phase) {
Brad Bishopd7bf8c12018-02-25 22:55:05 -050057 return NULL;
58 }
59
60-#ifndef OPENSSL_NO_MD4
61+#if !defined(OPENSSL_NO_MD4) && !defined(OPENSSL_NO_DES)
62
63 /*
64 * NTLM code is based on the following documentation: