summaryrefslogtreecommitdiff
path: root/lib/sha256.c
diff options
context:
space:
mode:
authorSteve Holme <steve_holme@hotmail.com>2020-02-20 01:41:01 +0000
committerSteve Holme <steve_holme@hotmail.com>2020-03-08 11:45:24 +0000
commit92d63a10aa12b7c76f54fbdd8a362ddb3a64ae52 (patch)
treef80287d683200bc138d9e17c5354673b5ff89ea8 /lib/sha256.c
parent0a04dc4d5d775402f2e3cdc192c3aadb2e9c4857 (diff)
downloadcurl-92d63a10aa12b7c76f54fbdd8a362ddb3a64ae52.tar.gz
sha256: Added SecureTransport implementation
Diffstat (limited to 'lib/sha256.c')
-rw-r--r--lib/sha256.c31
1 files changed, 31 insertions, 0 deletions
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 <CommonCrypto/CommonDigest.h>
+
+#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 */