This commit is contained in:
Adam Ierymenko 2019-08-08 08:42:27 -05:00
parent 3c590994db
commit 663376e385
No known key found for this signature in database
GPG Key ID: 1657198823E52A61

View File

@ -18,7 +18,6 @@ Public domain.
#include <CommonCrypto/CommonDigest.h>
#define ZT_HAVE_NATIVE_SHA512
namespace ZeroTier {
void SHA512(void *digest,const void *data,unsigned int len)
{
CC_SHA512_CTX ctx;
@ -26,7 +25,6 @@ void SHA512(void *digest,const void *data,unsigned int len)
CC_SHA512_Update(&ctx,data,len);
CC_SHA512_Final(reinterpret_cast<unsigned char *>(digest),&ctx);
}
void SHA384(void *digest,const void *data,unsigned int len)
{
CC_SHA512_CTX ctx;
@ -34,7 +32,6 @@ void SHA384(void *digest,const void *data,unsigned int len)
CC_SHA384_Update(&ctx,data,len);
CC_SHA384_Final(reinterpret_cast<unsigned char *>(digest),&ctx);
}
}
#endif
@ -42,7 +39,6 @@ void SHA384(void *digest,const void *data,unsigned int len)
#include <openssl/sha.h>
#define ZT_HAVE_NATIVE_SHA512
namespace ZeroTier {
void SHA512(void *digest,const void *data,unsigned int len)
{
SHA512_CTX ctx;
@ -50,7 +46,6 @@ void SHA512(void *digest,const void *data,unsigned int len)
SHA512_Update(&ctx,data,len);
SHA512_Final(reinterpret_cast<unsigned char *>(digest),&ctx);
}
void SHA384(void *digest,const void *data,unsigned int len)
{
SHA512_CTX ctx;
@ -58,10 +53,10 @@ void SHA384(void *digest,const void *data,unsigned int len)
SHA384_Update(&ctx,data,len);
SHA384_Final(reinterpret_cast<unsigned char *>(digest),&ctx);
}
}
#endif
// If a platform-native SHA512 isn't available we use this 64-bit C version.
#ifndef ZT_HAVE_NATIVE_SHA512
namespace ZeroTier {