]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
sha256: Added SecureTransport implementation
authorSteve Holme <steve_holme@hotmail.com>
Thu, 20 Feb 2020 01:41:01 +0000 (01:41 +0000)
committerSteve Holme <steve_holme@hotmail.com>
Sun, 8 Mar 2020 11:45:24 +0000 (11:45 +0000)
lib/sha256.c

index 97214182be8aa1b56b05675b664220278a8ec3c1..a14f42aa30520a338b9e05e9af9100da1d294aa6 100644 (file)
@@ -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 */