On Mon, Oct 22, 2018 at 02:43:40AM +0000, brian m. carlson wrote: > diff --git a/sha256/block/sha256.c b/sha256/block/sha256.c > new file mode 100644 > index 0000000000..683bc6e39b > --- /dev/null > +++ b/sha256/block/sha256.c > @@ -0,0 +1,186 @@ > +#include "git-compat-util.h" > +#include "./sha256.h" > + > +#define BLKSIZE blk_SHA256_BLKSIZE [...] > +#define Ch(x,y,z) (z ^ (x & (y ^ z))) > +#define Maj(x,y,z) (((x | y) & z) | (x & y)) > +#define S(x, n) ror((x),(n)) > +#define R(x, n) ((x)>>(n)) > +#define Sigma0(x) (S(x, 2) ^ S(x, 13) ^ S(x, 22)) > +#define Sigma1(x) (S(x, 6) ^ S(x, 11) ^ S(x, 25)) > +#define Gamma0(x) (S(x, 7) ^ S(x, 18) ^ R(x, 3)) > +#define Gamma1(x) (S(x, 17) ^ S(x, 19) ^ R(x, 10)) [...] > +#define RND(a,b,c,d,e,f,g,h,i,ki) \ > + t0 = h + Sigma1(e) + Ch(e, f, g) + ki + W[i]; \ > + t1 = Sigma0(a) + Maj(a, b, c); \ > + d += t0; \ > + h = t0 + t1; [...] > +#undef RND > +#undef Ch > +#undef Maj > +#undef S > +#undef R > +#undef Sigma0 > +#undef Sigma1 > +#undef Gamma0 > +#undef Gamma1 To protect us from potential "macro redefinition" errors, these #undefs should come before the #defines above. Note also that BLKSIZE is not #undef-ed.