misc: remove duplicated include files

Closes #9796
This commit is contained in:
Daniel Stenberg 2022-10-24 23:27:31 +02:00
parent 3678336b20
commit 279834dd45
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
15 changed files with 85 additions and 142 deletions

View File

@ -75,7 +75,6 @@
#include "inet_ntop.h" #include "inet_ntop.h"
#include "curl_threads.h" #include "curl_threads.h"
#include "connect.h" #include "connect.h"
#include "socketpair.h"
/* The last 3 #include files should be in this order */ /* The last 3 #include files should be in this order */
#include "curl_printf.h" #include "curl_printf.h"
#include "curl_memory.h" #include "curl_memory.h"

View File

@ -71,7 +71,6 @@
#include "mime.h" #include "mime.h"
#include "amigaos.h" #include "amigaos.h"
#include "warnless.h" #include "warnless.h"
#include "multiif.h"
#include "sigpipe.h" #include "sigpipe.h"
#include "vssh/ssh.h" #include "vssh/ssh.h"
#include "setopt.h" #include "setopt.h"

View File

@ -74,7 +74,6 @@
#include "sockaddr.h" /* required for Curl_sockaddr_storage */ #include "sockaddr.h" /* required for Curl_sockaddr_storage */
#include "multiif.h" #include "multiif.h"
#include "url.h" #include "url.h"
#include "strcase.h"
#include "speedcheck.h" #include "speedcheck.h"
#include "warnless.h" #include "warnless.h"
#include "http_proxy.h" #include "http_proxy.h"

View File

@ -39,7 +39,6 @@
#include "parsedate.h" #include "parsedate.h"
#include "fopen.h" #include "fopen.h"
#include "rename.h" #include "rename.h"
#include "strtoofft.h"
/* The last 3 #include files should be in this order */ /* The last 3 #include files should be in this order */
#include "curl_printf.h" #include "curl_printf.h"

View File

@ -32,8 +32,6 @@
#include "http_aws_sigv4.h" #include "http_aws_sigv4.h"
#include "curl_sha256.h" #include "curl_sha256.h"
#include "transfer.h" #include "transfer.h"
#include "strcase.h"
#include "parsedate.h" #include "parsedate.h"
#include "sendf.h" #include "sendf.h"

View File

@ -79,7 +79,6 @@
#include "select.h" #include "select.h"
#include "multiif.h" #include "multiif.h"
#include "url.h" #include "url.h"
#include "strcase.h"
#include "bufref.h" #include "bufref.h"
#include "curl_sasl.h" #include "curl_sasl.h"
#include "warnless.h" #include "warnless.h"

View File

@ -26,10 +26,11 @@
#if !defined(CURL_DISABLE_CRYPTO_AUTH) #if !defined(CURL_DISABLE_CRYPTO_AUTH)
#include <string.h>
#include "curl_md4.h" #include "curl_md4.h"
#include "warnless.h" #include "warnless.h"
#ifdef USE_OPENSSL #ifdef USE_OPENSSL
#include <openssl/opensslconf.h> #include <openssl/opensslconf.h>
#if defined(OPENSSL_VERSION_MAJOR) && (OPENSSL_VERSION_MAJOR >= 3) && \ #if defined(OPENSSL_VERSION_MAJOR) && (OPENSSL_VERSION_MAJOR >= 3) && \
@ -53,21 +54,44 @@
#else #else
#include <mbedtls/config.h> #include <mbedtls/config.h>
#endif #endif
#if(MBEDTLS_VERSION_NUMBER >= 0x02070000) #if(MBEDTLS_VERSION_NUMBER >= 0x02070000)
#define HAS_MBEDTLS_RESULT_CODE_BASED_FUNCTIONS #define HAS_MBEDTLS_RESULT_CODE_BASED_FUNCTIONS
#endif #endif
#endif /* USE_MBEDTLS */ #endif /* USE_MBEDTLS */
#if defined(USE_GNUTLS) #if defined(USE_GNUTLS)
#include <nettle/md4.h> #include <nettle/md4.h>
/* When OpenSSL or wolfSSL is available, we use their MD4 functions. */
#elif defined(USE_WOLFSSL) && !defined(WOLFSSL_NO_MD4)
#include <wolfssl/openssl/md4.h>
#elif defined(USE_OPENSSL) && !defined(OPENSSL_NO_MD4)
#include <openssl/md4.h>
#elif (defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && \
(__MAC_OS_X_VERSION_MAX_ALLOWED >= 1040) && \
defined(__MAC_OS_X_VERSION_MIN_ALLOWED) && \
(__MAC_OS_X_VERSION_MIN_ALLOWED < 101500)) || \
(defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && \
(__IPHONE_OS_VERSION_MAX_ALLOWED >= 20000))
#define AN_APPLE_OS
#include <CommonCrypto/CommonDigest.h>
#elif defined(USE_WIN32_CRYPTO)
#include <wincrypt.h>
#elif(defined(USE_MBEDTLS) && defined(MBEDTLS_MD4_C))
#include <mbedtls/md4.h>
#endif
/* The last 3 #include files should be in this order */
#include "curl_printf.h"
#include "curl_memory.h" #include "curl_memory.h"
/* The last #include file should be: */
#include "memdebug.h" #include "memdebug.h"
#if defined(USE_WOLFSSL) && !defined(WOLFSSL_NO_MD4)
#elif defined(USE_OPENSSL) && !defined(OPENSSL_NO_MD4)
#elif defined(USE_GNUTLS)
typedef struct md4_ctx MD4_CTX; typedef struct md4_ctx MD4_CTX;
static void MD4_Init(MD4_CTX *ctx) static void MD4_Init(MD4_CTX *ctx)
@ -85,27 +109,7 @@ static void MD4_Final(unsigned char *result, MD4_CTX *ctx)
md4_digest(ctx, MD4_DIGEST_SIZE, result); md4_digest(ctx, MD4_DIGEST_SIZE, result);
} }
/* When OpenSSL or wolfSSL is available, we use their MD4 functions. */ #elif defined(AN_APPLE_OS)
#elif defined(USE_WOLFSSL) && !defined(WOLFSSL_NO_MD4)
#include <wolfssl/openssl/md4.h>
#elif defined(USE_OPENSSL) && !defined(OPENSSL_NO_MD4)
#include <openssl/md4.h>
#elif (defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && \
(__MAC_OS_X_VERSION_MAX_ALLOWED >= 1040) && \
defined(__MAC_OS_X_VERSION_MIN_ALLOWED) && \
(__MAC_OS_X_VERSION_MIN_ALLOWED < 101500)) || \
(defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && \
(__IPHONE_OS_VERSION_MAX_ALLOWED >= 20000))
#include <CommonCrypto/CommonDigest.h>
#include "curl_memory.h"
/* The last #include file should be: */
#include "memdebug.h"
typedef CC_MD4_CTX MD4_CTX; typedef CC_MD4_CTX MD4_CTX;
static void MD4_Init(MD4_CTX *ctx) static void MD4_Init(MD4_CTX *ctx)
@ -125,13 +129,6 @@ static void MD4_Final(unsigned char *result, MD4_CTX *ctx)
#elif defined(USE_WIN32_CRYPTO) #elif defined(USE_WIN32_CRYPTO)
#include <wincrypt.h>
#include "curl_memory.h"
/* The last #include file should be: */
#include "memdebug.h"
struct md4_ctx { struct md4_ctx {
HCRYPTPROV hCryptProv; HCRYPTPROV hCryptProv;
HCRYPTHASH hHash; HCRYPTHASH hHash;
@ -171,13 +168,6 @@ static void MD4_Final(unsigned char *result, MD4_CTX *ctx)
#elif(defined(USE_MBEDTLS) && defined(MBEDTLS_MD4_C)) #elif(defined(USE_MBEDTLS) && defined(MBEDTLS_MD4_C))
#include <mbedtls/md4.h>
#include "curl_memory.h"
/* The last #include file should be: */
#include "memdebug.h"
struct md4_ctx { struct md4_ctx {
void *data; void *data;
unsigned long size; unsigned long size;
@ -255,9 +245,6 @@ static void MD4_Final(unsigned char *result, MD4_CTX *ctx)
* compile-time configuration. * compile-time configuration.
*/ */
#include <string.h>
/* Any 32-bit or wider unsigned integer data type will do */ /* Any 32-bit or wider unsigned integer data type will do */
typedef unsigned int MD4_u32plus; typedef unsigned int MD4_u32plus;

View File

@ -26,6 +26,7 @@
#ifndef CURL_DISABLE_CRYPTO_AUTH #ifndef CURL_DISABLE_CRYPTO_AUTH
#include <string.h>
#include <curl/curl.h> #include <curl/curl.h>
#include "curl_md5.h" #include "curl_md5.h"
@ -56,12 +57,32 @@
#endif #endif
#if defined(USE_GNUTLS) #if defined(USE_GNUTLS)
#include <nettle/md5.h> #include <nettle/md5.h>
#elif defined(USE_OPENSSL_MD5)
#include <openssl/md5.h>
#elif defined(USE_WOLFSSL_MD5)
#include <wolfssl/openssl/md5.h>
#elif defined(USE_MBEDTLS)
#include <mbedtls/md5.h>
#elif (defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && \
(__MAC_OS_X_VERSION_MAX_ALLOWED >= 1040) && \
defined(__MAC_OS_X_VERSION_MIN_ALLOWED) && \
(__MAC_OS_X_VERSION_MIN_ALLOWED < 101500)) || \
(defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && \
(__IPHONE_OS_VERSION_MAX_ALLOWED >= 20000))
#define AN_APPLE_OS
#include <CommonCrypto/CommonDigest.h>
#elif defined(USE_WIN32_CRYPTO)
#include <wincrypt.h>
#endif
/* The last 3 #include files should be in this order */
#include "curl_printf.h"
#include "curl_memory.h" #include "curl_memory.h"
/* The last #include file should be: */
#include "memdebug.h" #include "memdebug.h"
#if defined(USE_GNUTLS)
typedef struct md5_ctx my_md5_ctx; typedef struct md5_ctx my_md5_ctx;
static CURLcode my_md5_init(my_md5_ctx *ctx) static CURLcode my_md5_init(my_md5_ctx *ctx)
@ -84,17 +105,6 @@ static void my_md5_final(unsigned char *digest, my_md5_ctx *ctx)
#elif defined(USE_OPENSSL_MD5) || defined(USE_WOLFSSL_MD5) #elif defined(USE_OPENSSL_MD5) || defined(USE_WOLFSSL_MD5)
/* When OpenSSL or wolfSSL is available, we use their MD5 functions. */
#if defined(USE_OPENSSL_MD5)
#include <openssl/md5.h>
#elif defined(USE_WOLFSSL_MD5)
#include <wolfssl/openssl/md5.h>
#endif
#include "curl_memory.h"
/* The last #include file should be: */
#include "memdebug.h"
typedef MD5_CTX my_md5_ctx; typedef MD5_CTX my_md5_ctx;
static CURLcode my_md5_init(my_md5_ctx *ctx) static CURLcode my_md5_init(my_md5_ctx *ctx)
@ -119,13 +129,6 @@ static void my_md5_final(unsigned char *digest, my_md5_ctx *ctx)
#elif defined(USE_MBEDTLS) #elif defined(USE_MBEDTLS)
#include <mbedtls/md5.h>
#include "curl_memory.h"
/* The last #include file should be: */
#include "memdebug.h"
typedef mbedtls_md5_context my_md5_ctx; typedef mbedtls_md5_context my_md5_ctx;
static CURLcode my_md5_init(my_md5_ctx *ctx) static CURLcode my_md5_init(my_md5_ctx *ctx)
@ -162,12 +165,7 @@ static void my_md5_final(unsigned char *digest, my_md5_ctx *ctx)
#endif #endif
} }
#elif (defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && \ #elif defined(AN_APPLE_OS)
(__MAC_OS_X_VERSION_MAX_ALLOWED >= 1040) && \
defined(__MAC_OS_X_VERSION_MIN_ALLOWED) && \
(__MAC_OS_X_VERSION_MIN_ALLOWED < 101500)) || \
(defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && \
(__IPHONE_OS_VERSION_MAX_ALLOWED >= 20000))
/* For Apple operating systems: CommonCrypto has the functions we need. /* For Apple operating systems: CommonCrypto has the functions we need.
These functions are available on Tiger and later, as well as iOS 2.0 These functions are available on Tiger and later, as well as iOS 2.0
@ -175,11 +173,7 @@ static void my_md5_final(unsigned char *digest, my_md5_ctx *ctx)
Declaring the functions as static like this seems to be a bit more Declaring the functions as static like this seems to be a bit more
reliable than defining COMMON_DIGEST_FOR_OPENSSL on older cats. */ reliable than defining COMMON_DIGEST_FOR_OPENSSL on older cats. */
# include <CommonCrypto/CommonDigest.h>
# define my_md5_ctx CC_MD5_CTX # define my_md5_ctx CC_MD5_CTX
#include "curl_memory.h"
/* The last #include file should be: */
#include "memdebug.h"
static CURLcode my_md5_init(my_md5_ctx *ctx) static CURLcode my_md5_init(my_md5_ctx *ctx)
{ {
@ -203,11 +197,6 @@ static void my_md5_final(unsigned char *digest, my_md5_ctx *ctx)
#elif defined(USE_WIN32_CRYPTO) #elif defined(USE_WIN32_CRYPTO)
#include <wincrypt.h>
#include "curl_memory.h"
/* The last #include file should be: */
#include "memdebug.h"
struct md5_ctx { struct md5_ctx {
HCRYPTPROV hCryptProv; HCRYPTPROV hCryptProv;
HCRYPTHASH hHash; HCRYPTHASH hHash;
@ -288,12 +277,6 @@ static void my_md5_final(unsigned char *digest, my_md5_ctx *ctx)
* compile-time configuration. * compile-time configuration.
*/ */
#include <string.h>
/* The last #include files should be: */
#include "curl_memory.h"
#include "memdebug.h"
/* Any 32-bit or wider unsigned integer data type will do */ /* Any 32-bit or wider unsigned integer data type will do */
typedef unsigned int MD5_u32plus; typedef unsigned int MD5_u32plus;

View File

@ -57,6 +57,36 @@
#endif #endif
#endif /* USE_MBEDTLS */ #endif /* USE_MBEDTLS */
#if defined(USE_OPENSSL_SHA256)
/* When OpenSSL or wolfSSL is available is available we use their
* SHA256-functions.
*/
#if defined(USE_OPENSSL)
#include <openssl/evp.h>
#elif defined(USE_WOLFSSL)
#include <wolfssl/openssl/evp.h>
#endif
#elif defined(USE_GNUTLS)
#include <nettle/sha.h>
#elif defined(USE_MBEDTLS)
#include <mbedtls/sha256.h>
#elif (defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && \
(__MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)) || \
(defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && \
(__IPHONE_OS_VERSION_MAX_ALLOWED >= 20000))
#include <CommonCrypto/CommonDigest.h>
#define AN_APPLE_OS
#elif defined(USE_WIN32_CRYPTO)
#include <wincrypt.h>
#endif
/* The last 3 #include files should be in this order */
#include "curl_printf.h"
#include "curl_memory.h"
#include "memdebug.h"
/* Please keep the SSL backend-specific #if branches in this order: /* Please keep the SSL backend-specific #if branches in this order:
* *
* 1. USE_OPENSSL * 1. USE_OPENSSL
@ -71,20 +101,6 @@
#if defined(USE_OPENSSL_SHA256) #if defined(USE_OPENSSL_SHA256)
/* When OpenSSL or wolfSSL is available is available we use their
* SHA256-functions.
*/
#if defined(USE_OPENSSL)
#include <openssl/evp.h>
#elif defined(USE_WOLFSSL)
#include <wolfssl/openssl/evp.h>
#endif
#include "curl_memory.h"
/* The last #include file should be: */
#include "memdebug.h"
struct sha256_ctx { struct sha256_ctx {
EVP_MD_CTX *openssl_ctx; EVP_MD_CTX *openssl_ctx;
}; };
@ -115,13 +131,6 @@ static void my_sha256_final(unsigned char *digest, my_sha256_ctx *ctx)
#elif defined(USE_GNUTLS) #elif defined(USE_GNUTLS)
#include <nettle/sha.h>
#include "curl_memory.h"
/* The last #include file should be: */
#include "memdebug.h"
typedef struct sha256_ctx my_sha256_ctx; typedef struct sha256_ctx my_sha256_ctx;
static CURLcode my_sha256_init(my_sha256_ctx *ctx) static CURLcode my_sha256_init(my_sha256_ctx *ctx)
@ -144,13 +153,6 @@ static void my_sha256_final(unsigned char *digest, my_sha256_ctx *ctx)
#elif defined(USE_MBEDTLS) #elif defined(USE_MBEDTLS)
#include <mbedtls/sha256.h>
#include "curl_memory.h"
/* The last #include file should be: */
#include "memdebug.h"
typedef mbedtls_sha256_context my_sha256_ctx; typedef mbedtls_sha256_context my_sha256_ctx;
static CURLcode my_sha256_init(my_sha256_ctx *ctx) static CURLcode my_sha256_init(my_sha256_ctx *ctx)
@ -183,18 +185,7 @@ static void my_sha256_final(unsigned char *digest, my_sha256_ctx *ctx)
#endif #endif
} }
#elif (defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && \ #elif defined(AN_APPLE_OS)
(__MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)) || \
(defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && \
(__IPHONE_OS_VERSION_MAX_ALLOWED >= 20000))
#include <CommonCrypto/CommonDigest.h>
#include "curl_memory.h"
/* The last #include file should be: */
#include "memdebug.h"
typedef CC_SHA256_CTX my_sha256_ctx; typedef CC_SHA256_CTX my_sha256_ctx;
static CURLcode my_sha256_init(my_sha256_ctx *ctx) static CURLcode my_sha256_init(my_sha256_ctx *ctx)
@ -217,8 +208,6 @@ static void my_sha256_final(unsigned char *digest, my_sha256_ctx *ctx)
#elif defined(USE_WIN32_CRYPTO) #elif defined(USE_WIN32_CRYPTO)
#include <wincrypt.h>
struct sha256_ctx { struct sha256_ctx {
HCRYPTPROV hCryptProv; HCRYPTPROV hCryptProv;
HCRYPTHASH hHash; HCRYPTHASH hHash;

View File

@ -83,7 +83,6 @@
#include "select.h" #include "select.h"
#include "warnless.h" #include "warnless.h"
#include "curl_path.h" #include "curl_path.h"
#include "strcase.h"
#include <curl_base64.h> /* for base64 encoding/decoding */ #include <curl_base64.h> /* for base64 encoding/decoding */
#include <curl_sha256.h> #include <curl_sha256.h>

View File

@ -68,7 +68,6 @@
#include <ocsp.h> #include <ocsp.h>
#endif #endif
#include "strcase.h"
#include "warnless.h" #include "warnless.h"
#include "x509asn1.h" #include "x509asn1.h"

View File

@ -83,8 +83,6 @@ CURLcode Curl_verify_certificate(struct Curl_easy *data,
/* structs to expose only in schannel.c and schannel_verify.c */ /* structs to expose only in schannel.c and schannel_verify.c */
#ifdef EXPOSE_SCHANNEL_INTERNAL_STRUCTS #ifdef EXPOSE_SCHANNEL_INTERNAL_STRUCTS
#include <wincrypt.h>
#ifdef __MINGW32__ #ifdef __MINGW32__
#ifdef __MINGW64_VERSION_MAJOR #ifdef __MINGW64_VERSION_MAJOR
#define HAS_MANUAL_VERIFY_API #define HAS_MANUAL_VERIFY_API

View File

@ -122,7 +122,6 @@
#include <sys/sysctl.h> #include <sys/sysctl.h>
#endif /* CURL_BUILD_MAC */ #endif /* CURL_BUILD_MAC */
#include "urldata.h"
#include "sendf.h" #include "sendf.h"
#include "inet_pton.h" #include "inet_pton.h"
#include "connect.h" #include "connect.h"

View File

@ -710,7 +710,4 @@ CURLcode tool_setopt(CURL *curl, bool str, struct GlobalConfig *global,
#else /* CURL_DISABLE_LIBCURL_OPTION */ #else /* CURL_DISABLE_LIBCURL_OPTION */
#include "tool_cfgable.h"
#include "tool_setopt.h"
#endif /* CURL_DISABLE_LIBCURL_OPTION */ #endif /* CURL_DISABLE_LIBCURL_OPTION */

View File

@ -62,7 +62,6 @@
#include "curlx.h" /* from the private lib dir */ #include "curlx.h" /* from the private lib dir */
#include "getpart.h" #include "getpart.h"
#include "inet_pton.h" #include "inet_pton.h"
#include "util.h"
#include "server_sockaddr.h" #include "server_sockaddr.h"
#include "warnless.h" #include "warnless.h"