X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Fcrypto%2Fripemd160%2Fripemd160.c;h=cdd0266d7deba8f37849df7bbe1cf3cd662252d2;hb=4e2b7d0eed9fa1b98d5920393015b13fa06fedfa;hp=a8e79f3ccd225fef60139a61382eedbfb5bb3c71;hpb=4822f24f627f452a1282ae6b2764ebf0aee8fa8d;p=ccan diff --git a/ccan/crypto/ripemd160/ripemd160.c b/ccan/crypto/ripemd160/ripemd160.c index a8e79f3c..cdd0266d 100644 --- a/ccan/crypto/ripemd160/ripemd160.c +++ b/ccan/crypto/ripemd160/ripemd160.c @@ -55,16 +55,6 @@ static uint32_t inline f3(uint32_t x, uint32_t y, uint32_t z) { return (x | ~y) static uint32_t inline f4(uint32_t x, uint32_t y, uint32_t z) { return (x & z) | (y & ~z); } static uint32_t inline f5(uint32_t x, uint32_t y, uint32_t z) { return x ^ (y | ~z); } -/** Initialize RIPEMD-160 state. */ -static void inline Initialize(uint32_t* s) -{ - s[0] = 0x67452301ul; - s[1] = 0xEFCDAB89ul; - s[2] = 0x98BADCFEul; - s[3] = 0x10325476ul; - s[4] = 0xC3D2E1F0ul; -} - static uint32_t inline rol(uint32_t x, int i) { return (x << i) | (x >> (32 - i)); } static void inline Round(uint32_t *a, uint32_t b UNUSED, uint32_t *c, uint32_t d UNUSED, uint32_t e, uint32_t f, uint32_t x, uint32_t k, int r) @@ -284,7 +274,7 @@ static void add(struct ripemd160_ctx *ctx, const void *p, size_t len) size_t bufsize = ctx->bytes % 64; if (bufsize + len >= 64) { - // Fill the buffer, and process it. + /* Fill the buffer, and process it. */ memcpy(ctx->buf.u8 + bufsize, data, 64 - bufsize); ctx->bytes += 64 - bufsize; data += 64 - bufsize; @@ -294,7 +284,7 @@ static void add(struct ripemd160_ctx *ctx, const void *p, size_t len) } while (len >= 64) { - // Process full chunks directly from the source. + /* Process full chunks directly from the source. */ if (alignment_ok(data, sizeof(uint32_t))) Transform(ctx->s, (const uint32_t *)data); else { @@ -307,7 +297,7 @@ static void add(struct ripemd160_ctx *ctx, const void *p, size_t len) } if (len) { - // Fill the buffer with what remains. + /* Fill the buffer with what remains. */ memcpy(ctx->buf.u8 + bufsize, data, len); ctx->bytes += len; }