summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--sha256.c4
-rw-r--r--sha512.c4
3 files changed, 9 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 3def44a5..abe6853e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
diff --git a/sha256.c b/sha256.c
index ed11d801..3872ca6f 100644
--- a/sha256.c
+++ b/sha256.c
@@ -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);
}
diff --git a/sha512.c b/sha512.c
index 6832d83a..76fa8cf3 100644
--- a/sha512.c
+++ b/sha512.c
@@ -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;