]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
lib: fix building with wolfSSL without DES support
authorViktor Szakats <commit@vsz.me>
Sun, 11 Aug 2024 20:26:21 +0000 (22:26 +0200)
committerViktor Szakats <commit@vsz.me>
Tue, 13 Aug 2024 07:28:27 +0000 (09:28 +0200)
E.g. with Homebrew wolfssl 5.7.2 on macOS:
```
In file included from _bld/lib/CMakeFiles/libcurl_static.dir/Unity/unity_0_c.c:85:
lib/curl_ntlm_core.c:157:27: error: unknown type name 'DES_key_schedule'
                          DES_key_schedule DESKEYARG(ks))
                          ^
lib/curl_ntlm_core.c:159:3: error: use of undeclared identifier 'DES_cblock'
  DES_cblock key;
  ^
[...]
```

Earlier patch addressing this for OpenSSL:
802d8644500f5b18c895b77a23d85e029766d65e #7808

Cherry-picked from #14495
Closes #14512

lib/curl_des.c
lib/curl_des.h
lib/curl_ntlm_core.c

index 9662ba39ab9f6e41d88f79a189ece5a5ec4122f6..15836f58b97ca23a5a07becc3a3bccbdcbef57fd 100644 (file)
 
 #include "curl_setup.h"
 
-#if defined(USE_CURL_NTLM_CORE) && !defined(USE_WOLFSSL) &&     \
-  (defined(USE_GNUTLS) ||                                       \
-   defined(USE_SECTRANSP) ||                                    \
-   defined(USE_OS400CRYPTO) ||                                  \
+#if defined(USE_CURL_NTLM_CORE) && \
+  (defined(USE_GNUTLS) ||          \
+   defined(USE_SECTRANSP) ||       \
+   defined(USE_OS400CRYPTO) ||     \
    defined(USE_WIN32_CRYPTO))
 
 #include "curl_des.h"
index 66525ab43637e9b039ff3d1c29639f9a6f267f19..2dd498da245fe0b02199e4c1f210dc1a84dcce34 100644 (file)
 
 #include "curl_setup.h"
 
-#if defined(USE_CURL_NTLM_CORE) && !defined(USE_WOLFSSL) &&     \
-  (defined(USE_GNUTLS) ||                                       \
-   defined(USE_SECTRANSP) ||                                    \
-   defined(USE_OS400CRYPTO) ||                                  \
+#if defined(USE_CURL_NTLM_CORE) && \
+  (defined(USE_GNUTLS) ||          \
+   defined(USE_SECTRANSP) ||       \
+   defined(USE_OS400CRYPTO) ||     \
    defined(USE_WIN32_CRYPTO))
 
 /* Applies odd parity to the given byte array */
index 51d9d39c4172b1eb4a6c8721578104d037654da7..eee33afe5f97928bb9c02196d12a6c3147c22db3 100644 (file)
   #if !defined(OPENSSL_NO_DES) && !defined(OPENSSL_NO_DEPRECATED_3_0)
     #define USE_OPENSSL_DES
   #endif
+#elif defined(USE_WOLFSSL)
+  #include <wolfssl/options.h>
+  #if !defined(NO_DES3)
+    #define USE_OPENSSL_DES
+  #endif
 #endif
 
-#if defined(USE_OPENSSL_DES) || defined(USE_WOLFSSL)
+#if defined(USE_OPENSSL_DES)
 
 #if defined(USE_OPENSSL)
 #  include <openssl/des.h>
@@ -67,7 +72,6 @@
 #  include <openssl/ssl.h>
 #  include <openssl/rand.h>
 #else
-#  include <wolfssl/options.h>
 #  include <wolfssl/openssl/des.h>
 #  include <wolfssl/openssl/md5.h>
 #  include <wolfssl/openssl/ssl.h>
@@ -148,7 +152,7 @@ static void extend_key_56_to_64(const unsigned char *key_56, char *key)
 }
 #endif
 
-#if defined(USE_OPENSSL_DES) || defined(USE_WOLFSSL)
+#if defined(USE_OPENSSL_DES)
 /*
  * Turns a 56-bit key into a 64-bit, odd parity key and sets the key. The
  * key schedule ks is also set.
@@ -313,7 +317,7 @@ void Curl_ntlm_core_lm_resp(const unsigned char *keys,
                             const unsigned char *plaintext,
                             unsigned char *results)
 {
-#if defined(USE_OPENSSL_DES) || defined(USE_WOLFSSL)
+#if defined(USE_OPENSSL_DES)
   DES_key_schedule ks;
 
   setup_des_key(keys, DESKEY(ks));
@@ -367,7 +371,7 @@ CURLcode Curl_ntlm_core_mk_lm_hash(const char *password,
   {
     /* Create LanManager hashed password. */
 
-#if defined(USE_OPENSSL_DES) || defined(USE_WOLFSSL)
+#if defined(USE_OPENSSL_DES)
     DES_key_schedule ks;
 
     setup_des_key(pw, DESKEY(ks));