From 9feaa6ea396a1692e66a09f3d310155ffabd16b8 Mon Sep 17 00:00:00 2001 From: Steve Dee Date: Sun, 20 Apr 2014 14:51:35 -0700 Subject: [PATCH] Use CommonCrypto for sha on OS X This reverts commit 31b43ffe770c420e2a012b019c631056c30def67. Conflicts: gen164/5/shax.c --- gen164/5/shax.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/gen164/5/shax.c b/gen164/5/shax.c index 0c4f0e3065..02724cf8d6 100644 --- a/gen164/5/shax.c +++ b/gen164/5/shax.c @@ -5,9 +5,11 @@ #include "all.h" #include "../pit.h" -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" - +#if defined(U2_OS_osx) +#include +#else #include +#endif /* functions */ @@ -21,11 +23,19 @@ u2_bytes(0, met_w, fat_y, a); { c3_y dig_y[32]; +#if defined(U2_OS_osx) + CC_SHA256_CTX ctx_h; + + CC_SHA256_Init(&ctx_h); + CC_SHA256_Update(&ctx_h, fat_y, met_w); + CC_SHA256_Final(dig_y, &ctx_h); +#else SHA256_CTX ctx_h; SHA256_Init(&ctx_h); SHA256_Update(&ctx_h, fat_y, met_w); SHA256_Final(dig_y, &ctx_h); +#endif free(fat_y); return u2_rl_bytes(wir_r, 32, dig_y); } @@ -42,11 +52,19 @@ u2_bytes(0, a, fat_y, b); { c3_y dig_y[64]; +#if defined(U2_OS_osx) + CC_SHA512_CTX ctx_h; + + CC_SHA512_Init(&ctx_h); + CC_SHA512_Update(&ctx_h, fat_y, a); + CC_SHA512_Final(dig_y, &ctx_h); +#else SHA512_CTX ctx_h; SHA512_Init(&ctx_h); SHA512_Update(&ctx_h, fat_y, a); SHA512_Final(dig_y, &ctx_h); +#endif free(fat_y); return u2_rl_bytes(wir_r, 64, dig_y); }