Skip to content

Commit

Permalink
sha2 generic. Fixed stict pointer warning when building on PPC64
Browse files Browse the repository at this point in the history
  • Loading branch information
jfoug committed Nov 12, 2017
1 parent 60b9362 commit 14dd15e
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/sha2.c
Expand Up @@ -231,7 +231,11 @@ void jtr_sha256_final(void *_output, jtr_sha256_ctx *ctx)

bits = (ctx->total << 3);
m.wlen[0] = 0;
OUTBE32(bits, m.mlen, 4);
#if ARCH_LITTLE_ENDIAN
m.wlen[1] = JOHNSWAP(bits);
#else
m.wlen[1] = bits;
#endif

last = ctx->total & 0x3F;
padcnt = (last < 56) ? (56 - last) : (120 - last);
Expand Down Expand Up @@ -554,7 +558,12 @@ void jtr_sha512_final(void *_output, jtr_sha512_ctx *ctx)

bits = (ctx->total << 3);
m.wlen[0] = 0;
OUTBE64(bits, m.mlen, 8);
#if ARCH_LITTLE_ENDIAN
m.wlen[1] = JOHNSWAP64(bits);
#else
m.wlen[1] = bits;
#endif


last = ctx->total & 0x7F;
padcnt = (last < 112) ? (112 - last) : (240 - last);
Expand Down

0 comments on commit 14dd15e

Please sign in to comment.