mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-18 12:22:10 +03:00
Use CommonCrypto for sha on OS X
This reverts commit 31b43ffe770c420e2a012b019c631056c30def67. Conflicts: gen164/5/shax.c
This commit is contained in:
parent
13ae1eee30
commit
9feaa6ea39
@ -5,9 +5,11 @@
|
||||
#include "all.h"
|
||||
#include "../pit.h"
|
||||
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
|
||||
#if defined(U2_OS_osx)
|
||||
#include <CommonCrypto/CommonDigest.h>
|
||||
#else
|
||||
#include <openssl/sha.h>
|
||||
#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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user