COMPRESS macro and sha256_compress/sha512_compress do the same thing, so replace COMPRESS by the later.
Signed-off-by: Corentin Labbe <[email protected]> --- sha256.c | 8 +++----- sha512.c | 8 +++----- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/sha256.c b/sha256.c index ed11d801..91a4db7c 100644 --- a/sha256.c +++ b/sha256.c @@ -70,8 +70,6 @@ K[64] = 0x90befffaUL, 0xa4506cebUL, 0xbef9a3f7UL, 0xc67178f2UL, }; -#define COMPRESS(ctx, data) (_nettle_sha256_compress((ctx)->state, (data), K)) - /* Initialize the SHA values */ void @@ -97,7 +95,7 @@ void sha256_update(struct sha256_ctx *ctx, size_t length, const uint8_t *data) { - MD_UPDATE (ctx, length, data, COMPRESS, ctx->count++); + MD_UPDATE (ctx, length, data, sha256_compress, ctx->count++); } static void @@ -109,7 +107,7 @@ sha256_write_digest(struct sha256_ctx *ctx, assert(length <= SHA256_DIGEST_SIZE); - MD_PAD(ctx, 8, COMPRESS); + MD_PAD(ctx, 8, sha256_compress); /* There are 512 = 2^9 bits in one block */ bit_count = (ctx->count << 9) | (ctx->index << 3); @@ -118,7 +116,7 @@ sha256_write_digest(struct sha256_ctx *ctx, big-endian format, and will be converted back by the compression function. It's probably not worth the effort to fix this. */ WRITE_UINT64(ctx->block + (SHA256_BLOCK_SIZE - 8), bit_count); - COMPRESS(ctx, ctx->block); + sha256_compress(ctx, ctx->block); _nettle_write_be32(length, digest, ctx->state); } diff --git a/sha512.c b/sha512.c index 6832d83a..be21e2d7 100644 --- a/sha512.c +++ b/sha512.c @@ -113,8 +113,6 @@ K[80] = 0x5FCB6FAB3AD6FAECULL,0x6C44198C4A475817ULL, }; -#define COMPRESS(ctx, data) (_nettle_sha512_compress((ctx)->state, (data), K)) - void sha512_init(struct sha512_ctx *ctx) { @@ -148,7 +146,7 @@ void sha512_update(struct sha512_ctx *ctx, size_t length, const uint8_t *data) { - MD_UPDATE (ctx, length, data, COMPRESS, MD_INCR(ctx)); + MD_UPDATE (ctx, length, data, sha512_compress, MD_INCR(ctx)); } static void @@ -164,7 +162,7 @@ sha512_write_digest(struct sha512_ctx *ctx, assert(length <= SHA512_DIGEST_SIZE); - MD_PAD(ctx, 16, COMPRESS); + MD_PAD(ctx, 16, sha512_compress); /* There are 1024 = 2^10 bits in one block */ high = (ctx->count_high << 10) | (ctx->count_low >> 54); @@ -175,7 +173,7 @@ sha512_write_digest(struct sha512_ctx *ctx, function. It's probably not worth the effort to fix this. */ WRITE_UINT64(ctx->block + (SHA512_BLOCK_SIZE - 16), high); WRITE_UINT64(ctx->block + (SHA512_BLOCK_SIZE - 8), low); - COMPRESS(ctx, ctx->block); + sha512_compress(ctx, ctx->block); words = length / 8; leftover = length % 8; -- 2.35.1 _______________________________________________ nettle-bugs mailing list -- [email protected] To unsubscribe send an email to [email protected]
