]> git.ipfire.org Git - thirdparty/nettle.git/commitdiff
Export sha256/sha512_compress functions
authorCorentin Labbe <clabbe.montjoie@gmail.com>
Wed, 1 Jun 2022 17:36:08 +0000 (19:36 +0200)
committerNiels Möller <nisse@lysator.liu.se>
Thu, 9 Jun 2022 16:40:58 +0000 (18:40 +0200)
nettle export only md5_compress and sha1_compress.
Let's export also the compress functions for sha256 and sha512.

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
sha2.h
sha256.c
sha512.c

diff --git a/sha2.h b/sha2.h
index ca8222a7ece521cd0da2f5a79a538ca23be70643..264ab6ba77b109d057b98dd55b1bf208fe380580 100644 (file)
--- a/sha2.h
+++ b/sha2.h
@@ -46,11 +46,13 @@ extern "C" {
 #define sha256_init nettle_sha256_init
 #define sha256_update nettle_sha256_update
 #define sha256_digest nettle_sha256_digest
+#define sha256_compress nettle_sha256_compress
 #define sha384_init nettle_sha384_init
 #define sha384_digest nettle_sha384_digest
 #define sha512_init nettle_sha512_init
 #define sha512_update nettle_sha512_update
 #define sha512_digest nettle_sha512_digest
+#define sha512_compress nettle_sha512_compress
 #define sha512_224_init   nettle_sha512_224_init
 #define sha512_224_digest nettle_sha512_224_digest
 #define sha512_256_init   nettle_sha512_256_init
@@ -138,6 +140,8 @@ sha512_digest(struct sha512_ctx *ctx,
              size_t length,
              uint8_t *digest);
 
+void
+sha512_compress(uint64_t *state, const uint8_t *input);
 
 /* SHA384, a truncated SHA512 with different initial state. */
 
@@ -186,7 +190,10 @@ void
 sha512_256_digest(struct sha512_256_ctx *ctx,
                   size_t length,
                   uint8_t *digest);
-  
+
+void
+sha256_compress(uint32_t *state, const uint8_t *input);
+
 #ifdef __cplusplus
 }
 #endif
index 253c13191356e33987c7006466cb523f1ad10f0f..ed11d8017af0053a727ae3d6b54310be3bb4bb69 100644 (file)
--- a/sha256.c
+++ b/sha256.c
@@ -161,3 +161,9 @@ sha224_digest(struct sha256_ctx *ctx,
   sha256_write_digest(ctx, length, digest);
   sha224_init(ctx);
 }
+
+void
+sha256_compress(uint32_t *state, const uint8_t *input)
+{
+  _nettle_sha256_compress(state, input, K);
+}
index 6936cb50114281507091e193cbcab2262df2e502..6832d83aa637d216af6c2f3381f512fc0394ee27 100644 (file)
--- a/sha512.c
+++ b/sha512.c
@@ -312,3 +312,9 @@ sha512_256_digest(struct sha512_256_ctx *ctx,
   sha512_write_digest(ctx, length, digest);
   sha512_256_init(ctx);
 }
+
+void
+sha512_compress(uint64_t *state, const uint8_t *input)
+{
+  _nettle_sha512_compress(state, input, K);
+}