docs/libcurl/opts/CURLOPT_EGDSOCKET*,\
lib/*sha256*,\
lib/*sha512*,\
- lib/curl_des.*,\
lib/curl_hmac.*,\
lib/curl_md?.*,\
+ lib/curl_ntlm_core.*,\
lib/md?.*,\
lib/rand.*\
}"
cookie.c \
cshutdn.c \
curl_addrinfo.c \
- curl_des.c \
curl_endian.c \
curl_fnmatch.c \
curl_fopen.c \
cookie.h \
curl_addrinfo.h \
curl_ctype.h \
- curl_des.h \
curl_endian.h \
curl_fnmatch.h \
curl_fopen.h \
+++ /dev/null
-/***************************************************************************
- * _ _ ____ _
- * Project ___| | | | _ \| |
- * / __| | | | |_) | |
- * | (__| |_| | _ <| |___
- * \___|\___/|_| \_\_____|
- *
- * Copyright (C) Steve Holme, <steve_holme@hotmail.com>.
- *
- * This software is licensed as described in the file COPYING, which
- * you should have received as part of this distribution. The terms
- * are also available at https://curl.se/docs/copyright.html.
- *
- * You may opt to use, copy, modify, merge, publish, distribute and/or sell
- * copies of the Software, and permit persons to whom the Software is
- * furnished to do so, under the terms of the COPYING file.
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
- * KIND, either express or implied.
- *
- * SPDX-License-Identifier: curl
- *
- ***************************************************************************/
-
-#include "curl_setup.h"
-
-#if defined(USE_CURL_NTLM_CORE) && \
- (defined(USE_GNUTLS) || \
- defined(USE_OS400CRYPTO) || \
- defined(USE_WIN32_CRYPTO))
-
-#include "curl_des.h"
-
-/*
- * Curl_des_set_odd_parity()
- *
- * This is used to apply odd parity to the given byte array. It is typically
- * used by when a cryptography engine does not have its own version.
- *
- * The function is a port of the Java based oddParity() function over at:
- *
- * https://davenport.sourceforge.net/ntlm.html
- *
- * Parameters:
- *
- * bytes [in/out] - The data whose parity bits are to be adjusted for
- * odd parity.
- * len [out] - The length of the data.
- */
-void Curl_des_set_odd_parity(unsigned char *bytes, size_t len)
-{
- size_t i;
-
- for(i = 0; i < len; i++) {
- unsigned char b = bytes[i];
-
- bool needs_parity = (((b >> 7) ^ (b >> 6) ^ (b >> 5) ^
- (b >> 4) ^ (b >> 3) ^ (b >> 2) ^
- (b >> 1)) & 0x01) == 0;
-
- if(needs_parity)
- bytes[i] |= 0x01;
- else
- bytes[i] &= 0xfe;
- }
-}
-
-#endif
+++ /dev/null
-#ifndef HEADER_CURL_DES_H
-#define HEADER_CURL_DES_H
-/***************************************************************************
- * _ _ ____ _
- * Project ___| | | | _ \| |
- * / __| | | | |_) | |
- * | (__| |_| | _ <| |___
- * \___|\___/|_| \_\_____|
- *
- * Copyright (C) Steve Holme, <steve_holme@hotmail.com>.
- *
- * This software is licensed as described in the file COPYING, which
- * you should have received as part of this distribution. The terms
- * are also available at https://curl.se/docs/copyright.html.
- *
- * You may opt to use, copy, modify, merge, publish, distribute and/or sell
- * copies of the Software, and permit persons to whom the Software is
- * furnished to do so, under the terms of the COPYING file.
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
- * KIND, either express or implied.
- *
- * SPDX-License-Identifier: curl
- *
- ***************************************************************************/
-
-#include "curl_setup.h"
-
-#if defined(USE_CURL_NTLM_CORE) && \
- (defined(USE_GNUTLS) || \
- defined(USE_OS400CRYPTO) || \
- defined(USE_WIN32_CRYPTO))
-
-/* Applies odd parity to the given byte array */
-void Curl_des_set_odd_parity(unsigned char *bytes, size_t length);
-
-#endif
-
-#endif /* HEADER_CURL_DES_H */
#elif defined(USE_GNUTLS)
# include <nettle/des.h>
+# define USE_CURL_DES_SET_ODD_PARITY
#elif defined(USE_MBEDTLS_DES)
#elif defined(USE_OS400CRYPTO)
# include "cipher.mih" /* mih/cipher */
+# define USE_CURL_DES_SET_ODD_PARITY
#elif defined(USE_WIN32_CRYPTO)
# include <wincrypt.h>
+# define USE_CURL_DES_SET_ODD_PARITY
#else
# error "cannot compile NTLM support without a crypto library with DES."
#endif
#include "curl_hmac.h"
#include "curlx/warnless.h"
#include "curl_endian.h"
-#include "curl_des.h"
#include "curl_md4.h"
/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
+#ifdef USE_CURL_DES_SET_ODD_PARITY
+/*
+ * curl_des_set_odd_parity()
+ *
+ * Copyright (C) Steve Holme, <steve_holme@hotmail.com>
+ *
+ * This is used to apply odd parity to the given byte array. It is typically
+ * used by when a cryptography engine does not have its own version.
+ *
+ * The function is a port of the Java based oddParity() function over at:
+ *
+ * https://davenport.sourceforge.net/ntlm.html
+ *
+ * Parameters:
+ *
+ * bytes [in/out] - The data whose parity bits are to be adjusted for
+ * odd parity.
+ * len [out] - The length of the data.
+ */
+static void curl_des_set_odd_parity(unsigned char *bytes, size_t len)
+{
+ size_t i;
+
+ for(i = 0; i < len; i++) {
+ unsigned char b = bytes[i];
+
+ bool needs_parity = (((b >> 7) ^ (b >> 6) ^ (b >> 5) ^
+ (b >> 4) ^ (b >> 3) ^ (b >> 2) ^
+ (b >> 1)) & 0x01) == 0;
+
+ if(needs_parity)
+ bytes[i] |= 0x01;
+ else
+ bytes[i] &= 0xfe;
+ }
+}
+#endif /* USE_CURL_DES_SET_ODD_PARITY */
+
/*
* Turns a 56-bit key into being 64-bit wide.
*/
extend_key_56_to_64(key_56, key);
/* Set the key parity to odd */
- Curl_des_set_odd_parity((unsigned char *) key, sizeof(key));
+ curl_des_set_odd_parity((unsigned char *) key, sizeof(key));
/* Set the key */
des_set_key(des, (const uint8_t *) key);
extend_key_56_to_64(key_56, ctl.Crypto_Key);
/* Set the key parity to odd */
- Curl_des_set_odd_parity((unsigned char *) ctl.Crypto_Key, ctl.Data_Len);
+ curl_des_set_odd_parity((unsigned char *) ctl.Crypto_Key, ctl.Data_Len);
/* Perform the encryption */
_CIPHER((_SPCPTR *) &out, &ctl, (_SPCPTR *) &in);
extend_key_56_to_64(key_56, blob.key);
/* Set the key parity to odd */
- Curl_des_set_odd_parity((unsigned char *) blob.key, sizeof(blob.key));
+ curl_des_set_odd_parity((unsigned char *) blob.key, sizeof(blob.key));
/* Import the key */
if(!CryptImportKey(hprov, (BYTE *) &blob, sizeof(blob), 0, 0, &hkey)) {