]> git.ipfire.org Git - thirdparty/nettle.git/commitdiff
Use new sha256_compress and sha512_compress functions.
authorNiels Möller <nisse@lysator.liu.se>
Thu, 9 Jun 2022 16:27:47 +0000 (18:27 +0200)
committerNiels Möller <nisse@lysator.liu.se>
Thu, 9 Jun 2022 16:41:27 +0000 (18:41 +0200)
ChangeLog
sha256.c
sha512.c

index 3def44a56586f90ad452f7a905cb4694f8d12514..abe6853ec9463b4585c831ffe13123f03ad7a92b 100644 (file)
--- 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>
 
index ed11d8017af0053a727ae3d6b54310be3bb4bb69..3872ca6fa9aac2ab9744e7532eece05af95fd02b 100644 (file)
--- 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);
 }
index 6832d83aa637d216af6c2f3381f512fc0394ee27..76fa8cf3bea364297a5d5b2ccca0838c65f09550 100644 (file)
--- 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;