Skip to content

Commit

Permalink
sha256: Added SecureTransport implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
captain-caveman2k committed Mar 3, 2020
1 parent 425ceb0 commit 4feb38d
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions lib/sha256.c
Expand Up @@ -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 */
Expand Down

0 comments on commit 4feb38d

Please sign in to comment.