1
0
mirror of https://github.com/moparisthebest/curl synced 2024-11-10 11:35:07 -05:00

sha256: Added GNU TLS Nettle implementation

This commit is contained in:
Steve Holme 2020-02-20 01:25:27 +00:00
parent 256a29361f
commit 365f4ea53d
No known key found for this signature in database
GPG Key ID: 4059CB85CA7E8F19

View File

@ -38,9 +38,39 @@
#endif
#ifdef USE_OPENSSL_SHA256
#if defined(USE_OPENSSL_SHA256)
/* When OpenSSL is available we use the SHA256-function from OpenSSL */
#include <openssl/sha.h>
#elif defined(USE_GNUTLS_NETTLE)
#include <nettle/sha.h>
#include "curl_memory.h"
/* The last #include file should be: */
#include "memdebug.h"
typedef struct sha256_ctx SHA256_CTX;
static void SHA256_Init(SHA256_CTX *ctx)
{
sha256_init(ctx);
}
static void SHA256_Update(SHA256_CTX *ctx,
const unsigned char *data,
unsigned int length)
{
sha256_update(ctx, length, data);
}
static void SHA256_Final(unsigned char *digest, SHA256_CTX *ctx)
{
sha256_digest(ctx, SHA256_DIGEST_SIZE, digest);
}
#else
/* When no other crypto library is available we use this code segment */