diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | sha256.c | 4 | ||||
-rw-r--r-- | sha512.c | 4 |
3 files changed, 9 insertions, 5 deletions
@@ -1,9 +1,13 @@ 2022-06-09 Niels Möller <nisse@lysator.liu.se> - From Corentin Labbe: + Based on patches from Corentin Labbe: * sha2.h: Declare new functions. * sha256.c (sha256_compress): New function. + (COMPRESS): Updated to use sha256_compress. + (sha256_write_digest): Use sha256_compress directly. * sha512.c (sha512_compress): New function. + (COMPRESS): Updated to use sha512_compress. + (sha512_write_digest): Use sha512_compress directly. 2022-06-02 Niels Möller <nisse@lysator.liu.se> @@ -70,7 +70,7 @@ K[64] = 0x90befffaUL, 0xa4506cebUL, 0xbef9a3f7UL, 0xc67178f2UL, }; -#define COMPRESS(ctx, data) (_nettle_sha256_compress((ctx)->state, (data), K)) +#define COMPRESS(ctx, data) (sha256_compress((ctx)->state, (data))) /* Initialize the SHA values */ @@ -118,7 +118,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->state, ctx->block); _nettle_write_be32(length, digest, ctx->state); } @@ -113,7 +113,7 @@ K[80] = 0x5FCB6FAB3AD6FAECULL,0x6C44198C4A475817ULL, }; -#define COMPRESS(ctx, data) (_nettle_sha512_compress((ctx)->state, (data), K)) +#define COMPRESS(ctx, data) (sha512_compress((ctx)->state, (data))) void sha512_init(struct sha512_ctx *ctx) @@ -175,7 +175,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->state, ctx->block); words = length / 8; leftover = length % 8; |