lib: fix building with wolfSSL without DES support
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:
802d864450 #7808
Cherry-picked from #14495
Closes #14512
This commit is contained in:
parent
28c12bc9be
commit
4111d10803
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
#include "curl_setup.h"
|
#include "curl_setup.h"
|
||||||
|
|
||||||
#if defined(USE_CURL_NTLM_CORE) && !defined(USE_WOLFSSL) && \
|
#if defined(USE_CURL_NTLM_CORE) && \
|
||||||
(defined(USE_GNUTLS) || \
|
(defined(USE_GNUTLS) || \
|
||||||
defined(USE_SECTRANSP) || \
|
defined(USE_SECTRANSP) || \
|
||||||
defined(USE_OS400CRYPTO) || \
|
defined(USE_OS400CRYPTO) || \
|
||||||
|
|||||||
@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
#include "curl_setup.h"
|
#include "curl_setup.h"
|
||||||
|
|
||||||
#if defined(USE_CURL_NTLM_CORE) && !defined(USE_WOLFSSL) && \
|
#if defined(USE_CURL_NTLM_CORE) && \
|
||||||
(defined(USE_GNUTLS) || \
|
(defined(USE_GNUTLS) || \
|
||||||
defined(USE_SECTRANSP) || \
|
defined(USE_SECTRANSP) || \
|
||||||
defined(USE_OS400CRYPTO) || \
|
defined(USE_OS400CRYPTO) || \
|
||||||
|
|||||||
@ -57,9 +57,14 @@
|
|||||||
#if !defined(OPENSSL_NO_DES) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
#if !defined(OPENSSL_NO_DES) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||||
#define USE_OPENSSL_DES
|
#define USE_OPENSSL_DES
|
||||||
#endif
|
#endif
|
||||||
|
#elif defined(USE_WOLFSSL)
|
||||||
|
#include <wolfssl/options.h>
|
||||||
|
#if !defined(NO_DES3)
|
||||||
|
#define USE_OPENSSL_DES
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(USE_OPENSSL_DES) || defined(USE_WOLFSSL)
|
#if defined(USE_OPENSSL_DES)
|
||||||
|
|
||||||
#if defined(USE_OPENSSL)
|
#if defined(USE_OPENSSL)
|
||||||
# include <openssl/des.h>
|
# include <openssl/des.h>
|
||||||
@ -67,7 +72,6 @@
|
|||||||
# include <openssl/ssl.h>
|
# include <openssl/ssl.h>
|
||||||
# include <openssl/rand.h>
|
# include <openssl/rand.h>
|
||||||
#else
|
#else
|
||||||
# include <wolfssl/options.h>
|
|
||||||
# include <wolfssl/openssl/des.h>
|
# include <wolfssl/openssl/des.h>
|
||||||
# include <wolfssl/openssl/md5.h>
|
# include <wolfssl/openssl/md5.h>
|
||||||
# include <wolfssl/openssl/ssl.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
|
#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
|
* Turns a 56-bit key into a 64-bit, odd parity key and sets the key. The
|
||||||
* key schedule ks is also set.
|
* key schedule ks is also set.
|
||||||
@ -313,7 +317,7 @@ void Curl_ntlm_core_lm_resp(const unsigned char *keys,
|
|||||||
const unsigned char *plaintext,
|
const unsigned char *plaintext,
|
||||||
unsigned char *results)
|
unsigned char *results)
|
||||||
{
|
{
|
||||||
#if defined(USE_OPENSSL_DES) || defined(USE_WOLFSSL)
|
#if defined(USE_OPENSSL_DES)
|
||||||
DES_key_schedule ks;
|
DES_key_schedule ks;
|
||||||
|
|
||||||
setup_des_key(keys, DESKEY(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. */
|
/* Create LanManager hashed password. */
|
||||||
|
|
||||||
#if defined(USE_OPENSSL_DES) || defined(USE_WOLFSSL)
|
#if defined(USE_OPENSSL_DES)
|
||||||
DES_key_schedule ks;
|
DES_key_schedule ks;
|
||||||
|
|
||||||
setup_des_key(pw, DESKEY(ks));
|
setup_des_key(pw, DESKEY(ks));
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user