summaryrefslogtreecommitdiff
path: root/src
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 /src
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>
Diffstat (limited to 'src')
-rw-r--r--src/tool_metalink.c68
1 files changed, 2 insertions, 66 deletions
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)