]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
gnutls: Fix nettle discovery
authorDaniel Gustafsson <daniel@yesql.se>
Thu, 25 Feb 2021 17:20:33 +0000 (18:20 +0100)
committerDaniel Gustafsson <daniel@yesql.se>
Thu, 25 Feb 2021 17:20:33 +0000 (18:20 +0100)
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>
lib/curl_ntlm_core.h
packages/vms/generate_config_vms_h_curl.com
src/tool_metalink.c

index fab628c590a75bc25e24d193f5326cf980422881..95ed9e64fa35e2ec48ec587d7e4284cffb80ae93 100644 (file)
@@ -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
index 6c65b24cb84d5150f1f3e1e80d6123ce6f2e2629..6c60bdf4b48d3e418cd57c7aa5ec1f562d4fdeff 100644 (file)
@@ -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"
index 7da49333ca213574942349db1c174e2e72ed1d9f..3673396275cf2ba74905c6b3fca6ec8d67ae63a0 100644 (file)
 #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)