From 92d63a10aa12b7c76f54fbdd8a362ddb3a64ae52 Mon Sep 17 00:00:00 2001 From: Steve Holme Date: Thu, 20 Feb 2020 01:41:01 +0000 Subject: [PATCH] sha256: Added SecureTransport implementation --- lib/sha256.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/lib/sha256.c b/lib/sha256.c index 97214182b..a14f42aa3 100644 --- a/lib/sha256.c +++ b/lib/sha256.c @@ -161,6 +161,37 @@ static void SHA256_Final(unsigned char *digest, SHA256_CTX *ctx) #endif } +#elif (defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && \ + (__MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)) || \ + (defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && \ + (__IPHONE_OS_VERSION_MAX_ALLOWED >= 20000)) + +#include + +#include "curl_memory.h" + +/* The last #include file should be: */ +#include "memdebug.h" + +typedef CC_SHA256_CTX SHA256_CTX; + +static void SHA256_Init(SHA256_CTX *ctx) +{ + (void) CC_SHA256_Init(ctx); +} + +static void SHA256_Update(SHA256_CTX *ctx, + const unsigned char *data, + unsigned int length) +{ + (void) CC_SHA256_Update(ctx, data, length); +} + +static void SHA256_Final(unsigned char *digest, SHA256_CTX *ctx) +{ + (void) CC_SHA256_Final(digest, ctx); +} + #else /* When no other crypto library is available we use this code segment */