X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/blobdiff_plain/fe6657c961b01ec72e9f35f4c3d96b11b31cf09c..45c0fd363937c6e9b05da04a9167e9912c05ca0c:/whirlpool.c diff --git a/whirlpool.c b/whirlpool.c index 96cbbe1..48e6e97 100644 --- a/whirlpool.c +++ b/whirlpool.c @@ -7,7 +7,7 @@ * (c) 2005 Straylight/Edgeware */ -/*----- Licensing notice --------------------------------------------------* +/*----- Licensing notice --------------------------------------------------* * * This file is part of Catacomb. * @@ -15,12 +15,12 @@ * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. - * + * * Catacomb is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. - * + * * You should have received a copy of the GNU Library General Public * License along with Catacomb; if not, write to the Free * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, @@ -57,7 +57,7 @@ static const uint32 U[4][256] = WHIRLPOOL_U, V[4][256] = WHIRLPOOL_V; int i; \ printf("\n"); \ for (i = 0; i < 8; i++) \ - printf(" %08x %08x : %08x %08x\n", \ + printf(" %08x %08x : %08x %08x\n", \ HI64(k[i]), LO64(k[i]), \ HI64(v[i]), LO64(v[i])); \ } while (0) @@ -123,18 +123,18 @@ static const uint32 U[4][256] = WHIRLPOOL_U, V[4][256] = WHIRLPOOL_V; vv[i].lo ^= UUL(v, i, 0); vv[i].hi ^= VVL(v, i, 0); \ XROW(vv, v, i); \ } while (0) - + #endif #define RHO(vv, v, kk, k) do { \ - ROWK(kk, k, 0, *c++); ROWK(vv, v, 0, kk[0]); \ - ROWZ(kk, k, 1); ROWK(vv, v, 1, kk[1]); \ - ROWZ(kk, k, 2); ROWK(vv, v, 2, kk[2]); \ - ROWZ(kk, k, 3); ROWK(vv, v, 3, kk[3]); \ - ROWZ(kk, k, 4); ROWK(vv, v, 4, kk[4]); \ - ROWZ(kk, k, 5); ROWK(vv, v, 5, kk[5]); \ - ROWZ(kk, k, 6); ROWK(vv, v, 6, kk[6]); \ - ROWZ(kk, k, 7); ROWK(vv, v, 7, kk[7]); \ + ROWK(kk, k, 0, *c++); ROWK(vv, v, 0, kk[0]); \ + ROWZ(kk, k, 1); ROWK(vv, v, 1, kk[1]); \ + ROWZ(kk, k, 2); ROWK(vv, v, 2, kk[2]); \ + ROWZ(kk, k, 3); ROWK(vv, v, 3, kk[3]); \ + ROWZ(kk, k, 4); ROWK(vv, v, 4, kk[4]); \ + ROWZ(kk, k, 5); ROWK(vv, v, 5, kk[5]); \ + ROWZ(kk, k, 6); ROWK(vv, v, 6, kk[6]); \ + ROWZ(kk, k, 7); ROWK(vv, v, 7, kk[7]); \ } while (0) void whirlpool_compress(whirlpool_ctx *ctx, const void *sbuf) @@ -143,7 +143,7 @@ void whirlpool_compress(whirlpool_ctx *ctx, const void *sbuf) const kludge64 *c = C; const octet *s = sbuf; int i; - + for (i = 0; i < 8; i++) { LOAD64_L_(m[i], &s[i * 8]); XOR64(v[i], m[i], ctx->s[i]); @@ -243,8 +243,8 @@ static void final(whirlpool_ctx *ctx) { HASH_PAD(WHIRLPOOL, whirlpool, ctx, 0x80, 0, 32); memset(ctx->buf + WHIRLPOOL_BUFSZ - 32, 0, 24); - STORE32(ctx->buf + WHIRLPOOL_BUFSZ - 8, (ctx->nl >> 29) | (ctx->nh << 3)); - STORE32(ctx->buf + WHIRLPOOL_BUFSZ - 4, ctx->nl << 3); + STORE32(ctx->buf + WHIRLPOOL_BUFSZ - 8, (ctx->nl >> 29) | (ctx->nh << 3)); + STORE32(ctx->buf + WHIRLPOOL_BUFSZ - 4, ctx->nl << 3); whirlpool_compress(ctx, ctx->buf); }