summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Gustafsson <daniel@yesql.se>2021-02-25 18:20:33 +0100
committerDaniel Gustafsson <daniel@yesql.se>2021-02-25 18:20:33 +0100
commit09a5bff1c9cb9c305ac18f5c4f1f6233badcd8b4 (patch)
treee8c0773beb3373f233fb584b04c3cec790015f8e
parent82c583dcf009f038a9ceccc695f942f24015f9ab (diff)
downloadcurl-09a5bff1c9cb9c305ac18f5c4f1f6233badcd8b4.tar.gz
gnutls: Fix nettle discovery
Commit e06fa7462ac258c removed support for libgcrypt leaving only support for nettle which has been the default crypto library in GnuTLS for a long time. There were however a few conditionals on USE_GNUTLS_NETTLE which cause compilation errors in the metalink code (as it used the gcrypt fallback instead as a result). See the below autobuild for an example of the error: https://curl.se/dev/log.cgi?id=20210225123226-30704#prob1 This removes all uses of USE_GNUTLS_NETTLE and also removes the gcrypt support from the metalink code while at it. Closes #6656 Reviewed-by: Daniel Stenberg <daniel@haxx.se>
-rw-r--r--lib/curl_ntlm_core.h1
-rw-r--r--packages/vms/generate_config_vms_h_curl.com3
-rw-r--r--src/tool_metalink.c68
3 files changed, 2 insertions, 70 deletions
diff --git a/lib/curl_ntlm_core.h b/lib/curl_ntlm_core.h
index fab628c59..95ed9e64f 100644
--- a/lib/curl_ntlm_core.h
+++ b/lib/curl_ntlm_core.h
@@ -30,7 +30,6 @@
then it must be initialized to be used by NTLM. */
#if !defined(USE_OPENSSL) && \
!defined(USE_WOLFSSL) && \
- !defined(USE_GNUTLS_NETTLE) && \
!defined(USE_GNUTLS) && \
defined(USE_NSS)
#define NTLM_NEEDS_NSS_INIT
diff --git a/packages/vms/generate_config_vms_h_curl.com b/packages/vms/generate_config_vms_h_curl.com
index 6c65b24cb..6c60bdf4b 100644
--- a/packages/vms/generate_config_vms_h_curl.com
+++ b/packages/vms/generate_config_vms_h_curl.com
@@ -331,9 +331,6 @@ $write cvh "#endif"
$write cvh "#ifdef USE_GNUTLS"
$write cvh "#undef USE_GNUTLS"
$write cvh "#endif"
-$write cvh "#ifdef USE_GNUTLS_NETTLE"
-$write cvh "#undef USE_GNUTLS_NETTLE"
-$write cvh "#endif"
$write cvh "#ifdef USE_LIBRTMP"
$write cvh "#undef USE_LIBRTMP"
$write cvh "#endif"
diff --git a/src/tool_metalink.c b/src/tool_metalink.c
index 7da49333c..367339627 100644
--- a/src/tool_metalink.c
+++ b/src/tool_metalink.c
@@ -35,17 +35,12 @@
#ifdef USE_OPENSSL
# include <openssl/md5.h>
# include <openssl/sha.h>
-#elif defined(USE_GNUTLS_NETTLE)
+#elif defined(USE_GNUTLS)
# include <nettle/md5.h>
# include <nettle/sha.h>
# define MD5_CTX struct md5_ctx
# define SHA_CTX struct sha1_ctx
# define SHA256_CTX struct sha256_ctx
-#elif defined(USE_GNUTLS)
-# include <gcrypt.h>
-# define MD5_CTX gcry_md_hd_t
-# define SHA_CTX gcry_md_hd_t
-# define SHA256_CTX gcry_md_hd_t
#elif defined(USE_NSS)
# include <nss.h>
# include <pk11pub.h>
@@ -116,7 +111,7 @@ struct win32_crypto_hash {
#if defined(USE_OPENSSL)
/* Functions are already defined */
-#elif defined(USE_GNUTLS_NETTLE)
+#elif defined(USE_GNUTLS)
static int MD5_Init(MD5_CTX *ctx)
{
@@ -172,65 +167,6 @@ static void SHA256_Final(unsigned char digest[32], SHA256_CTX *ctx)
sha256_digest(ctx, 32, digest);
}
-#elif defined(USE_GNUTLS)
-
-static int MD5_Init(MD5_CTX *ctx)
-{
- gcry_md_open(ctx, GCRY_MD_MD5, 0);
- return 1;
-}
-
-static void MD5_Update(MD5_CTX *ctx,
- const unsigned char *input,
- unsigned int inputLen)
-{
- gcry_md_write(*ctx, input, inputLen);
-}
-
-static void MD5_Final(unsigned char digest[16], MD5_CTX *ctx)
-{
- memcpy(digest, gcry_md_read(*ctx, 0), 16);
- gcry_md_close(*ctx);
-}
-
-static int SHA1_Init(SHA_CTX *ctx)
-{
- gcry_md_open(ctx, GCRY_MD_SHA1, 0);
- return 1;
-}
-
-static void SHA1_Update(SHA_CTX *ctx,
- const unsigned char *input,
- unsigned int inputLen)
-{
- gcry_md_write(*ctx, input, inputLen);
-}
-
-static void SHA1_Final(unsigned char digest[20], SHA_CTX *ctx)
-{
- memcpy(digest, gcry_md_read(*ctx, 0), 20);
- gcry_md_close(*ctx);
-}
-
-static int SHA256_Init(SHA256_CTX *ctx)
-{
- gcry_md_open(ctx, GCRY_MD_SHA256, 0);
- return 1;
-}
-
-static void SHA256_Update(SHA256_CTX *ctx,
- const unsigned char *input,
- unsigned int inputLen)
-{
- gcry_md_write(*ctx, input, inputLen);
-}
-
-static void SHA256_Final(unsigned char digest[32], SHA256_CTX *ctx)
-{
- memcpy(digest, gcry_md_read(*ctx, 0), 32);
- gcry_md_close(*ctx);
-}
-
#elif defined(USE_NSS)
static int nss_hash_init(void **pctx, SECOidTag hash_alg)