commit 88d397aa025f97d28fc900533dfbda721d486ad4
parent 258058688c09a819fd67761000ca6975d83598a6
Author: cfillion <cfillion@users.noreply.github.com>
Date: Wed, 5 Dec 2018 22:11:32 -0500
use COMMON_DIGEST_FOR_OPENSSL on macOS
Diffstat:
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/src/hash.cpp b/src/hash.cpp
@@ -4,7 +4,6 @@
#include <vector>
#ifdef _WIN32
-
# include <windows.h>
class Hash::CNGContext : public Hash::Context {
@@ -59,31 +58,30 @@ private:
#else // Unix systems
# ifdef __APPLE__
+# define COMMON_DIGEST_FOR_OPENSSL
# include <CommonCrypto/CommonDigest.h>
-# define CC(s) CC_##s
# else
# include <openssl/sha.h>
-# define CC(s) s
# endif
class Hash::SHA256Context : public Hash::Context {
public:
- SHA256Context() { CC(SHA256_Init)(&m_context); }
+ SHA256Context() { SHA256_Init(&m_context); }
size_t hashSize() const override {
- return CC(SHA256_DIGEST_LENGTH);
+ return SHA256_DIGEST_LENGTH;
}
void addData(const char *data, const size_t len) override {
- CC(SHA256_Update)(&m_context, data, len);
+ SHA256_Update(&m_context, data, len);
}
void getHash(unsigned char *out) override {
- CC(SHA256_Final)(out, &m_context);
+ SHA256_Final(out, &m_context);
}
private:
- CC(SHA256_CTX) m_context;
+ SHA256_CTX m_context;
};
#endif