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

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