summaryrefslogtreecommitdiff
path: root/lib/sha256.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2021-02-18 11:42:46 +0100
committerDaniel Stenberg <daniel@haxx.se>2021-02-18 23:06:47 +0100
commite06fa7462ac258cf6096a0c909310bf23cf7c1eb (patch)
tree632e1f709b6b32db1b6335d8866c0604359c3c5c /lib/sha256.c
parent692faeab9f07c23feddc4814e16a138a30cbab06 (diff)
downloadcurl-e06fa7462ac258cf6096a0c909310bf23cf7c1eb.tar.gz
gnutls: assume nettle crypto support
nettle has been the default crypto library with GnuTLS since 2010. By dropping support for the previous libcrypto, we simplify code. Closes #6625
Diffstat (limited to 'lib/sha256.c')
-rw-r--r--lib/sha256.c42
1 files changed, 6 insertions, 36 deletions
diff --git a/lib/sha256.c b/lib/sha256.c
index d91511791..c34f97e8f 100644
--- a/lib/sha256.c
+++ b/lib/sha256.c
@@ -6,7 +6,7 @@
* \___|\___/|_| \_\_____|
*
* Copyright (C) 2017, Florin Petriuc, <petriuc.florin@gmail.com>
- * Copyright (C) 2018 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 2018 - 2021, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -50,11 +50,10 @@
/* Please keep the SSL backend-specific #if branches in this order:
*
* 1. USE_OPENSSL
- * 2. USE_GNUTLS_NETTLE
- * 3. USE_GNUTLS
- * 4. USE_MBEDTLS
- * 5. USE_COMMON_CRYPTO
- * 6. USE_WIN32_CRYPTO
+ * 2. USE_GNUTLS
+ * 3. USE_MBEDTLS
+ * 4. USE_COMMON_CRYPTO
+ * 5. USE_WIN32_CRYPTO
*
* This ensures that the same SSL branch gets activated throughout this source
* file even if multiple backends are enabled at the same time.
@@ -65,7 +64,7 @@
/* When OpenSSL is available we use the SHA256-function from OpenSSL */
#include <openssl/sha.h>
-#elif defined(USE_GNUTLS_NETTLE)
+#elif defined(USE_GNUTLS)
#include <nettle/sha.h>
@@ -93,35 +92,6 @@ static void SHA256_Final(unsigned char *digest, SHA256_CTX *ctx)
sha256_digest(ctx, SHA256_DIGEST_SIZE, digest);
}
-#elif defined(USE_GNUTLS)
-
-#include <gcrypt.h>
-
-#include "curl_memory.h"
-
-/* The last #include file should be: */
-#include "memdebug.h"
-
-typedef gcry_md_hd_t SHA256_CTX;
-
-static void SHA256_Init(SHA256_CTX *ctx)
-{
- gcry_md_open(ctx, GCRY_MD_SHA256, 0);
-}
-
-static void SHA256_Update(SHA256_CTX *ctx,
- const unsigned char *data,
- unsigned int length)
-{
- gcry_md_write(*ctx, data, length);
-}
-
-static void SHA256_Final(unsigned char *digest, SHA256_CTX *ctx)
-{
- memcpy(digest, gcry_md_read(*ctx, 0), SHA256_DIGEST_LENGTH);
- gcry_md_close(*ctx);
-}
-
#elif defined(USE_MBEDTLS)
#include <mbedtls/sha256.h>