diff --git a/src/sha256/sha256_final.c b/src/sha256/sha256_final.c index 342230b..19929ee 100644 --- a/src/sha256/sha256_final.c +++ b/src/sha256/sha256_final.c @@ -43,13 +43,13 @@ static void sha256_encode(const struct sha256_ctx *ctx, uint8_t out[32]) { for (uint8_t i = 0; i < 8; ++i) - { - const uint8_t i4 = i * 4; - uint32_t v = ctx->state[i]; + { + const uint8_t i4 = i * 4; + uint32_t v = ctx->state[i]; - out[i4 + 0] = (uint8_t)(v >> 24); - out[i4 + 1] = (uint8_t)(v >> 16); - out[i4 + 2] = (uint8_t)(v >> 8); - out[i4 + 3] = (uint8_t)(v >> 0); - } + out[i4 + 0] = (uint8_t)(v >> 24); + out[i4 + 1] = (uint8_t)(v >> 16); + out[i4 + 2] = (uint8_t)(v >> 8); + out[i4 + 3] = (uint8_t)(v >> 0); + } } diff --git a/src/whirlpool/whirlpool_final.c b/src/whirlpool/whirlpool_final.c index 0be4b8a..229c457 100644 --- a/src/whirlpool/whirlpool_final.c +++ b/src/whirlpool/whirlpool_final.c @@ -4,7 +4,8 @@ /* Forward declarations */ static void whirlpool_pad(struct whirlpool_ctx *ctx); static void whirlpool_encode(const struct whirlpool_ctx *ctx, uint8_t out[64]); -static inline void whirlpool_write_len(struct whirlpool_ctx *ctx, uint64_t bitlen); +static inline void whirlpool_write_len(struct whirlpool_ctx *ctx, uint64_t + bitlen); /* ---------------- */ void whirlpool_final(void *ctx, uint8_t *out) diff --git a/src/whirlpool/whirlpool_init.c b/src/whirlpool/whirlpool_init.c index 31b539d..b208a4b 100644 --- a/src/whirlpool/whirlpool_init.c +++ b/src/whirlpool/whirlpool_init.c @@ -1,10 +1,10 @@ #include "whirlpool.h" +#include void whirlpool_init(void *ctx) { struct whirlpool_ctx *local_ctx = ctx; - for (uint8_t i = 0; i < 8; ++i) - local_ctx->state[i] = 0; + memset(local_ctx->state, 0, sizeof(uint64_t) * 8); local_ctx->count = 0; }