- vtls: fix unused variable and symbols.
- ftp: fix unused variable.
- http: fix unused variables.
- smtp: fix unsued variable.
- wolfssl: fix unused variable with !proxy.
- libssh: fix unused argument.
- curl_trc: sync guards between declaration and definition.
- curl_trc: add missing guard for `Curl_trc_ssls` when !verbose.
- curl_trc: fix errors with !http + http3.
- curl_trc: fix missing function with !http + nghttp2.
- cf-h2-proxy: disable when !http + nghttp2, to avoid calling undeclared
functions.
- sha256: fix missing declaration in rare configs.
- md4: fix symbol conflict when building GnuTLS together with AWS-LC or
wolfSSL. By prioritizing the latter two. AWS-LC has no option
to disable the clashing symbol. wolfSSL does, but the most seamless is
to skip including GnuTLS's standalone `md4.h` to avoid the clash.
- build: fix errors with !http + nghttp2.
- build: catch !ssl + ssls-export combination in source. Convert
build-level errors to warnings.
- build: fix errors with !http + http3.
- build: fix building curl tool and unit1302 in rare combinations.
By always compiling base64 curlx functions.
- cmake: add `_CURL_SKIP_BUILD_CERTS` internal option.
To disable automatically building certs with the testdeps target.
To improve performance when testing builds.
(used locally to find the failing builds fixed in this PR.)
Closes #17962
if(_ssl_enabled)
message(STATUS "SSL export enabled.")
else()
- message(FATAL_ERROR "SSL session export requires SSL enabled")
+ message(WARNING "SSL session export requires SSL enabled")
endif()
endif()
SSLS_EXPORT_SUPPORT=''
if test "x$SSL_ENABLED" != "x1"; then
- AC_MSG_ERROR([--enable-ssls-export ignored: No SSL support])
+ AC_MSG_WARN([--enable-ssls-export ignored: No SSL support])
else
SSLS_EXPORT_ENABLED=1
AC_DEFINE(USE_SSLS_EXPORT, 1, [if SSL session export support is available])
#include "curl_setup.h"
-#if defined(USE_NGHTTP2) && !defined(CURL_DISABLE_PROXY)
+#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_PROXY) && \
+ defined(USE_NGHTTP2)
#include <nghttp2/nghttp2.h>
#include "urldata.h"
return result;
}
-#endif /* defined(USE_NGHTTP2) && !defined(CURL_DISABLE_PROXY) */
+#endif /* !CURL_DISABLE_HTTP && !CURL_DISABLE_PROXY && USE_NGHTTP2 */
#endif
struct transport_provider transport_providers[] = {
{ TRNSPRT_TCP, Curl_cf_tcp_create },
-#ifdef USE_HTTP3
+#if !defined(CURL_DISABLE_HTTP) && defined(USE_HTTP3)
{ TRNSPRT_QUIC, Curl_cf_quic_create },
#endif
#ifndef CURL_DISABLE_TFTP
#if (defined(USE_CURL_NTLM_CORE) && !defined(USE_WINDOWS_SSPI)) || \
!defined(CURL_DISABLE_AWS) || !defined(CURL_DISABLE_DIGEST_AUTH) || \
- defined(USE_SSL)
+ defined(USE_LIBSSH2) || defined(USE_SSL)
#include <curl/curl.h>
#if !defined(CURL_DISABLE_VERBOSE_STRINGS)
-
static void trc_infof(struct Curl_easy *data,
struct curl_trc_feat *feat,
const char *opt_id, int opt_id_idx,
{ &Curl_cft_tcp_accept, TRC_CT_NETWORK },
{ &Curl_cft_happy_eyeballs, TRC_CT_NETWORK },
{ &Curl_cft_setup, TRC_CT_PROTOCOL },
-#ifdef USE_NGHTTP2
+#if !defined(CURL_DISABLE_HTTP) && defined(USE_NGHTTP2)
{ &Curl_cft_nghttp2, TRC_CT_PROTOCOL },
#endif
#ifdef USE_SSL
{ &Curl_cft_haproxy, TRC_CT_PROXY },
{ &Curl_cft_socks_proxy, TRC_CT_PROXY },
#endif /* !CURL_DISABLE_PROXY */
-#ifdef USE_HTTP3
+#if !defined(CURL_DISABLE_HTTP) && defined(USE_HTTP3)
{ &Curl_cft_http3, TRC_CT_PROTOCOL },
#endif
#if !defined(CURL_DISABLE_HTTP)
(void)data; (void)fmt;
}
#endif
-#if !defined(CURL_DISABLE_WEBSOCKETS) || !defined(CURL_DISABLE_HTTP)
+#if !defined(CURL_DISABLE_WEBSOCKETS) && !defined(CURL_DISABLE_HTTP)
void Curl_trc_ws(struct Curl_easy *data, const char *fmt, ...)
{
(void)data; (void)fmt;
}
#endif
-
+#ifdef USE_SSL
void Curl_trc_ssls(struct Curl_easy *data, const char *fmt, ...)
{
(void)data;
(void)fmt;
}
+#endif
#endif /* !defined(CURL_DISABLE_VERBOSE_STRINGS) */
#include "../curl_setup.h"
-#if !defined(CURL_DISABLE_HTTP_AUTH) || defined(USE_SSH) || \
- !defined(CURL_DISABLE_LDAP) || \
- !defined(CURL_DISABLE_SMTP) || \
- !defined(CURL_DISABLE_POP3) || \
- !defined(CURL_DISABLE_IMAP) || \
- !defined(CURL_DISABLE_DIGEST_AUTH) || \
- !defined(CURL_DISABLE_DOH) || defined(USE_SSL) || !defined(BUILDING_LIBCURL)
#include <curl/curl.h>
#include "warnless.h"
#include "base64.h"
{
return base64_encode(base64url, 0, inputbuff, insize, outptr, outlen);
}
-
-#endif /* no users so disabled */
const unsigned char *shmac, size_t shmac_len,
const unsigned char *sdata, size_t sdata_len)
{
-#ifdef USE_SSLS_EXPORT
+#if defined(USE_SSL) && defined(USE_SSLS_EXPORT)
struct Curl_easy *data = d;
if(!GOOD_EASY_HANDLE(data))
return CURLE_BAD_FUNCTION_ARGUMENT;
curl_ssls_export_cb *export_fn,
void *userptr)
{
-#ifdef USE_SSLS_EXPORT
+#if defined(USE_SSL) && defined(USE_SSLS_EXPORT)
struct Curl_easy *data = d;
if(!GOOD_EASY_HANDLE(data))
return CURLE_BAD_FUNCTION_ARGUMENT;
)
{
#if defined(CURL_DISABLE_VERBOSE_STRINGS)
+ (void)data;
#ifdef DEBUGBUILD
(void)lineno;
#endif
}
return result;
#else
- (void) proxy;
+ (void)data;
+ (void)proxy;
+ (void)auth;
/* nothing to do when disabled */
return CURLE_OK;
#endif
#include "curl_setup.h"
-#ifdef USE_NGHTTP2
+#if !defined(CURL_DISABLE_HTTP) && defined(USE_NGHTTP2)
#include <stdint.h>
#include <nghttp2/nghttp2.h>
#include "urldata.h"
return Curl_crealloc(ptr, size);
}
-#else /* !USE_NGHTTP2 */
+#else /* CURL_DISABLE_HTTP || !USE_NGHTTP2 */
/* Satisfy external references even if http2 is not compiled in. */
#include <curl/curl.h>
return NULL;
}
-#endif /* USE_NGHTTP2 */
+#endif /* !CURL_DISABLE_HTTP && USE_NGHTTP2 */
#endif
#endif /* USE_MBEDTLS */
-#if defined(USE_GNUTLS)
-#include <nettle/md4.h>
/* When OpenSSL or wolfSSL is available, we use their MD4 functions. */
-#elif defined(USE_WOLFSSL) && !defined(WOLFSSL_NO_MD4)
+#if defined(USE_WOLFSSL) && !defined(WOLFSSL_NO_MD4)
#include <wolfssl/openssl/md4.h>
#elif defined(USE_OPENSSL) && !defined(OPENSSL_NO_MD4)
#include <openssl/md4.h>
#include <CommonCrypto/CommonDigest.h>
#elif defined(USE_WIN32_CRYPTO)
#include <wincrypt.h>
+#elif defined(USE_GNUTLS)
+#include <nettle/md4.h>
#elif(defined(USE_MBEDTLS) && defined(MBEDTLS_MD4_C))
#include <mbedtls/md4.h>
#endif
#include "memdebug.h"
-#if defined(USE_GNUTLS)
-
-typedef struct md4_ctx MD4_CTX;
-
-static int MD4_Init(MD4_CTX *ctx)
-{
- md4_init(ctx);
- return 1;
-}
-
-static void MD4_Update(MD4_CTX *ctx, const void *data, unsigned long size)
-{
- md4_update(ctx, size, data);
-}
-
-static void MD4_Final(unsigned char *result, MD4_CTX *ctx)
-{
- md4_digest(ctx, MD4_DIGEST_SIZE, result);
-}
-
-#elif defined(USE_WOLFSSL) && !defined(WOLFSSL_NO_MD4)
+#if defined(USE_WOLFSSL) && !defined(WOLFSSL_NO_MD4)
#ifdef OPENSSL_COEXIST
#define MD4_CTX WOLFSSL_MD4_CTX
CryptReleaseContext(ctx->hCryptProv, 0);
}
+#elif defined(USE_GNUTLS)
+
+typedef struct md4_ctx MD4_CTX;
+
+static int MD4_Init(MD4_CTX *ctx)
+{
+ md4_init(ctx);
+ return 1;
+}
+
+static void MD4_Update(MD4_CTX *ctx, const void *data, unsigned long size)
+{
+ md4_update(ctx, size, data);
+}
+
+static void MD4_Final(unsigned char *result, MD4_CTX *ctx)
+{
+ md4_digest(ctx, MD4_DIGEST_SIZE, result);
+}
+
#elif(defined(USE_MBEDTLS) && defined(MBEDTLS_MD4_C))
struct md4_ctx {
struct smtp_conn *smtpc,
smtpstate newstate)
{
-#if !defined(CURL_DISABLE_VERBOSE_STRINGS)
+#ifndef CURL_DISABLE_VERBOSE_STRINGS
/* for debug purposes */
static const char * const names[] = {
"STOP",
if(smtpc->state != newstate)
CURL_TRC_SMTP(data, "state change from %s to %s",
names[smtpc->state], names[newstate]);
+#else
+ (void)data;
#endif
smtpc->state = newstate;
#ifdef USE_SSH
char ssh_version[30];
#endif
-#ifdef USE_NGHTTP2
+#if !defined(CURL_DISABLE_HTTP) && defined(USE_NGHTTP2)
char h2_version[30];
#endif
-#ifdef USE_HTTP3
+#if !defined(CURL_DISABLE_HTTP) && defined(USE_HTTP3)
char h3_version[30];
#endif
#ifdef USE_LIBRTMP
Curl_ssh_version(ssh_version, sizeof(ssh_version));
src[i++] = ssh_version;
#endif
-#ifdef USE_NGHTTP2
+#if !defined(CURL_DISABLE_HTTP) && defined(USE_NGHTTP2)
Curl_http2_ver(h2_version, sizeof(h2_version));
src[i++] = h2_version;
#endif
-#ifdef USE_HTTP3
+#if !defined(CURL_DISABLE_HTTP) && defined(USE_HTTP3)
Curl_quic_ver(h3_version, sizeof(h3_version));
src[i++] = h3_version;
#endif
#ifndef CURL_DISABLE_HSTS
FEATURE("HSTS", NULL, CURL_VERSION_HSTS),
#endif
-#if defined(USE_NGHTTP2)
+#if !defined(CURL_DISABLE_HTTP) && defined(USE_NGHTTP2)
FEATURE("HTTP2", NULL, CURL_VERSION_HTTP2),
#endif
-#if defined(USE_HTTP3)
+#if !defined(CURL_DISABLE_HTTP) && defined(USE_HTTP3)
FEATURE("HTTP3", NULL, CURL_VERSION_HTTP3),
#endif
#if defined(USE_SSL) && !defined(CURL_DISABLE_PROXY) && \
}
#endif
-#ifdef USE_HTTP3
+#if !defined(CURL_DISABLE_HTTP) && defined(USE_HTTP3)
{
static char quicbuffer[80];
Curl_quic_ver(quicbuffer, sizeof(quicbuffer));
#include "../curl_setup.h"
-#if defined(USE_NGTCP2) && defined(USE_NGHTTP3)
+#if !defined(CURL_DISABLE_HTTP) && defined(USE_NGTCP2) && defined(USE_NGHTTP3)
#include <ngtcp2/ngtcp2.h>
#include <nghttp3/nghttp3.h>
#include "../curl_setup.h"
-#if defined(USE_NGTCP2) && defined(USE_NGHTTP3)
+#if !defined(CURL_DISABLE_HTTP) && defined(USE_NGTCP2) && defined(USE_NGHTTP3)
#ifdef HAVE_NETINET_UDP_H
#include <netinet/udp.h>
#include "../curl_setup.h"
-#if defined(USE_OPENSSL_QUIC) && defined(USE_NGHTTP3)
+#if !defined(CURL_DISABLE_HTTP) && defined(USE_OPENSSL_QUIC) && \
+ defined(USE_NGHTTP3)
#include <openssl/ssl.h>
#include <openssl/bio.h>
(void)msnprintf(p, len, "nghttp3/%s", ht3->version_str);
}
-#endif /* USE_OPENSSL_QUIC && USE_NGHTTP3 */
+#endif /* !CURL_DISABLE_HTTP && USE_OPENSSL_QUIC && USE_NGHTTP3 */
#include "../curl_setup.h"
-#if defined(USE_OPENSSL_QUIC) && defined(USE_NGHTTP3)
+#if !defined(CURL_DISABLE_HTTP) && defined(USE_OPENSSL_QUIC) && \
+ defined(USE_NGHTTP3)
#ifdef HAVE_NETINET_UDP_H
#include <netinet/udp.h>
#include "../curl_setup.h"
-#ifdef USE_QUICHE
+#if !defined(CURL_DISABLE_HTTP) && defined(USE_QUICHE)
#include <quiche.h>
#include <openssl/err.h>
#include <openssl/ssl.h>
#include "../curl_setup.h"
-#ifdef USE_QUICHE
+#if !defined(CURL_DISABLE_HTTP) && defined(USE_QUICHE)
#include <quiche.h>
#include <openssl/ssl.h>
#include "../memdebug.h"
-#ifdef USE_HTTP3
+#if !defined(CURL_DISABLE_HTTP) && defined(USE_HTTP3)
#define NW_CHUNK_SIZE (64 * 1024)
#define NW_SEND_CHUNKS 2
return CURLE_OK;
}
-#else /* USE_HTTP3 */
+#else /* CURL_DISABLE_HTTP || !USE_HTTP3 */
CURLcode Curl_conn_may_http3(struct Curl_easy *data,
const struct connectdata *conn,
return CURLE_NOT_BUILT_IN;
}
-#endif /* !USE_HTTP3 */
+#endif /* !CURL_DISABLE_HTTP && USE_HTTP3 */
#include "../curl_setup.h"
-#ifdef USE_HTTP3
+#if !defined(CURL_DISABLE_HTTP) && defined(USE_HTTP3)
struct Curl_cfilter;
struct Curl_easy;
struct connectdata;
#else
#define Curl_vquic_init() 1
-#endif /* !USE_HTTP3 */
+#endif /* !CURL_DISABLE_HTTP && USE_HTTP3 */
CURLcode Curl_conn_may_http3(struct Curl_easy *data,
const struct connectdata *conn,
return CURLE_SSH;
}
-#ifndef DEBUGBUILD
-#define myssh_to(x,y,z) myssh_set_state(x,y,z)
-#else
+#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS)
#define myssh_to(x,y,z) myssh_set_state(x,y,z, __LINE__)
+#else
+#define myssh_to(x,y,z) myssh_set_state(x,y,z)
#endif
/*
static void myssh_set_state(struct Curl_easy *data,
struct ssh_conn *sshc,
sshstate nowstate
-#ifdef DEBUGBUILD
+#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS)
, int lineno
#endif
)
}
#ifdef USE_SSL
+#if !defined(CURL_DISABLE_HTTP) || !defined(CURL_DISABLE_PROXY)
static const struct alpn_spec ALPN_SPEC_H11 = {
{ ALPN_HTTP_1_1 }, 1
};
+#endif /* !CURL_DISABLE_HTTP || !CURL_DISABLE_PROXY */
#ifdef USE_HTTP2
static const struct alpn_spec ALPN_SPEC_H2 = {
{ ALPN_H2 }, 1
};
#endif
+#if !defined(CURL_DISABLE_HTTP) || !defined(CURL_DISABLE_PROXY)
static const struct alpn_spec *
alpn_get_spec(http_majors allowed, bool use_alpn)
{
Avoid "http/1.0" because some servers do not support it. */
return &ALPN_SPEC_H11;
}
+#endif /* !CURL_DISABLE_HTTP || !CURL_DISABLE_PROXY */
#endif /* USE_SSL */
DEBUGASSERT(data->conn);
#ifdef CURL_DISABLE_HTTP
+ (void)conn;
/* We only support ALPN for HTTP so far. */
DEBUGASSERT(!conn->bits.tls_enable_alpn);
ctx = cf_ctx_new(data, NULL);
#include "../curl_setup.h"
-#ifdef USE_SSLS_EXPORT
+#if defined(USE_SSL) && defined(USE_SSLS_EXPORT)
#include "../urldata.h"
#include "../curl_trc.h"
return r;
}
-#endif /* USE_SSLS_EXPORT */
+#endif /* USE_SSL && USE_SSLS_EXPORT */
***************************************************************************/
#include "../curl_setup.h"
-#ifdef USE_SSLS_EXPORT
+#if defined(USE_SSL) && defined(USE_SSLS_EXPORT)
struct dynbuf;
struct Curl_ssl_session;
const void *bufv, size_t buflen,
struct Curl_ssl_session **ps);
-#endif /* USE_SSLS_EXPORT */
+#endif /* USE_SSL && USE_SSLS_EXPORT */
#endif /* HEADER_CURL_VTLS_SPACK_H */
data->set.str[STRING_SSL_PINNEDPUBLICKEY];
#else
const char * const pinnedpubkey = data->set.str[STRING_SSL_PINNEDPUBLICKEY];
+ (void)cf;
#endif
if(pinnedpubkey) {
'Curl_creader_def_total_length' => 'internal api',
'Curl_meta_reset' => 'internal api',
'Curl_trc_dns' => 'internal api',
+ 'curlx_base64_decode' => 'internal api',
+ 'curlx_base64_encode' => 'internal api',
+ 'curlx_base64url_encode' => 'internal api',
);
my %api = (
VERBATIM
)
add_custom_target(build-certs DEPENDS ${GENERATEDCERTS})
-add_dependencies(testdeps build-certs)
+
+option(_CURL_SKIP_BUILD_CERTS "Skip building certs with testdeps" OFF) # Internal option to increase perf for build tests
+if(NOT _CURL_SKIP_BUILD_CERTS)
+ add_dependencies(testdeps build-certs)
+endif()
add_custom_target(clean-certs
COMMAND ${CMAKE_COMMAND} -E remove ${GENERATEDCERTS}