aboutsummaryrefslogtreecommitdiff
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-03 00:37:22 +0000
commit4feb38deed33fed14ff7c370a6a9153c661dbb9c (patch)
tree8c4ac21385d939a6d6a8d0c01ec26bd6d3f1da3e
parent425ceb0150f499db2eec25a289f5eeccadda369c (diff)
sha256: Added SecureTransport implementation
-rw-r--r--lib/sha256.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/lib/sha256.c b/lib/sha256.c
index db7e642de..10ad44b49 100644
--- a/lib/sha256.c
+++ b/lib/sha256.c
@@ -148,6 +148,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_SHA224_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 */