From 24c85ae42cc9e105d431ace51bd449abca57db0f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Niels=20M=C3=B6ller?= Date: Tue, 29 Apr 2025 19:48:05 +0200 Subject: [PATCH] Whitespace changes to sha3 prototypes. --- sha3-224.c | 7 ++----- sha3-256.c | 7 ++----- sha3-384.c | 7 ++----- sha3-512.c | 7 ++----- sha3.h | 48 +++++++++++++----------------------------------- shake128.c | 10 +++------- shake256.c | 6 ++---- 7 files changed, 26 insertions(+), 66 deletions(-) diff --git a/sha3-224.c b/sha3-224.c index 0ed26d88..08afce69 100644 --- a/sha3-224.c +++ b/sha3-224.c @@ -50,9 +50,7 @@ sha3_224_init (struct sha3_224_ctx *ctx) } void -sha3_224_update (struct sha3_224_ctx *ctx, - size_t length, - const uint8_t *data) +sha3_224_update (struct sha3_224_ctx *ctx, size_t length, const uint8_t *data) { ctx->index = _nettle_sha3_update (&ctx->state, SHA3_224_BLOCK_SIZE, ctx->block, @@ -60,8 +58,7 @@ sha3_224_update (struct sha3_224_ctx *ctx, } void -sha3_224_digest(struct sha3_224_ctx *ctx, - uint8_t *digest) +sha3_224_digest(struct sha3_224_ctx *ctx, uint8_t *digest) { _sha3_pad_hash (&ctx->state, SHA3_224_BLOCK_SIZE, ctx->block, ctx->index); _nettle_write_le64 (SHA3_224_DIGEST_SIZE, digest, ctx->state.a); diff --git a/sha3-256.c b/sha3-256.c index 1d891900..c347e13b 100644 --- a/sha3-256.c +++ b/sha3-256.c @@ -50,9 +50,7 @@ sha3_256_init (struct sha3_256_ctx *ctx) } void -sha3_256_update (struct sha3_256_ctx *ctx, - size_t length, - const uint8_t *data) +sha3_256_update (struct sha3_256_ctx *ctx, size_t length, const uint8_t *data) { ctx->index = _nettle_sha3_update (&ctx->state, SHA3_256_BLOCK_SIZE, ctx->block, @@ -60,8 +58,7 @@ sha3_256_update (struct sha3_256_ctx *ctx, } void -sha3_256_digest(struct sha3_256_ctx *ctx, - uint8_t *digest) +sha3_256_digest(struct sha3_256_ctx *ctx, uint8_t *digest) { _sha3_pad_hash (&ctx->state, SHA3_256_BLOCK_SIZE, ctx->block, ctx->index); _nettle_write_le64 (SHA3_256_DIGEST_SIZE, digest, ctx->state.a); diff --git a/sha3-384.c b/sha3-384.c index 0f58892f..ea8dd038 100644 --- a/sha3-384.c +++ b/sha3-384.c @@ -50,9 +50,7 @@ sha3_384_init (struct sha3_384_ctx *ctx) } void -sha3_384_update (struct sha3_384_ctx *ctx, - size_t length, - const uint8_t *data) +sha3_384_update (struct sha3_384_ctx *ctx, size_t length, const uint8_t *data) { ctx->index = _nettle_sha3_update (&ctx->state, SHA3_384_BLOCK_SIZE, ctx->block, @@ -60,8 +58,7 @@ sha3_384_update (struct sha3_384_ctx *ctx, } void -sha3_384_digest(struct sha3_384_ctx *ctx, - uint8_t *digest) +sha3_384_digest(struct sha3_384_ctx *ctx, uint8_t *digest) { _sha3_pad_hash (&ctx->state, SHA3_384_BLOCK_SIZE, ctx->block, ctx->index); _nettle_write_le64 (SHA3_384_DIGEST_SIZE, digest, ctx->state.a); diff --git a/sha3-512.c b/sha3-512.c index 2f0a62b3..9ae014dc 100644 --- a/sha3-512.c +++ b/sha3-512.c @@ -50,9 +50,7 @@ sha3_512_init (struct sha3_512_ctx *ctx) } void -sha3_512_update (struct sha3_512_ctx *ctx, - size_t length, - const uint8_t *data) +sha3_512_update (struct sha3_512_ctx *ctx, size_t length, const uint8_t *data) { ctx->index = _nettle_sha3_update (&ctx->state, SHA3_512_BLOCK_SIZE, ctx->block, @@ -60,8 +58,7 @@ sha3_512_update (struct sha3_512_ctx *ctx, } void -sha3_512_digest(struct sha3_512_ctx *ctx, - uint8_t *digest) +sha3_512_digest(struct sha3_512_ctx *ctx, uint8_t *digest) { _sha3_pad_hash (&ctx->state, SHA3_512_BLOCK_SIZE, ctx->block, ctx->index); _nettle_write_le64 (SHA3_512_DIGEST_SIZE, digest, ctx->state.a); diff --git a/sha3.h b/sha3.h index 5cd9ee1a..c499f395 100644 --- a/sha3.h +++ b/sha3.h @@ -109,19 +109,13 @@ void sha3_128_init (struct sha3_128_ctx *ctx); void -sha3_128_update (struct sha3_128_ctx *ctx, - size_t length, - const uint8_t *data); +sha3_128_update (struct sha3_128_ctx *ctx, size_t length, const uint8_t *data); void -sha3_128_shake (struct sha3_128_ctx *ctx, - size_t length, - uint8_t *digest); +sha3_128_shake (struct sha3_128_ctx *ctx, size_t length, uint8_t *digest); void -sha3_128_shake_output (struct sha3_128_ctx *ctx, - size_t length, - uint8_t *digest); +sha3_128_shake_output (struct sha3_128_ctx *ctx, size_t length, uint8_t *digest); struct sha3_224_ctx { @@ -134,13 +128,10 @@ void sha3_224_init (struct sha3_224_ctx *ctx); void -sha3_224_update (struct sha3_224_ctx *ctx, - size_t length, - const uint8_t *data); +sha3_224_update (struct sha3_224_ctx *ctx, size_t length, const uint8_t *data); void -sha3_224_digest(struct sha3_224_ctx *ctx, - uint8_t *digest); +sha3_224_digest(struct sha3_224_ctx *ctx, uint8_t *digest); struct sha3_256_ctx { @@ -153,27 +144,20 @@ void sha3_256_init (struct sha3_256_ctx *ctx); void -sha3_256_update (struct sha3_256_ctx *ctx, - size_t length, - const uint8_t *data); +sha3_256_update (struct sha3_256_ctx *ctx, size_t length, const uint8_t *data); void -sha3_256_digest(struct sha3_256_ctx *ctx, - uint8_t *digest); +sha3_256_digest(struct sha3_256_ctx *ctx, uint8_t *digest); /* Alternative digest function implementing shake256, with arbitrary digest size */ void -sha3_256_shake(struct sha3_256_ctx *ctx, - size_t length, - uint8_t *digest); +sha3_256_shake(struct sha3_256_ctx *ctx, size_t length, uint8_t *digest); /* Unlike sha3_256_shake, this function can be called multiple times to retrieve output from shake256 in an incremental manner */ void -sha3_256_shake_output(struct sha3_256_ctx *ctx, - size_t length, - uint8_t *digest); +sha3_256_shake_output(struct sha3_256_ctx *ctx, size_t length, uint8_t *digest); struct sha3_384_ctx { @@ -186,13 +170,10 @@ void sha3_384_init (struct sha3_384_ctx *ctx); void -sha3_384_update (struct sha3_384_ctx *ctx, - size_t length, - const uint8_t *data); +sha3_384_update (struct sha3_384_ctx *ctx, size_t length, const uint8_t *data); void -sha3_384_digest(struct sha3_384_ctx *ctx, - uint8_t *digest); +sha3_384_digest(struct sha3_384_ctx *ctx, uint8_t *digest); struct sha3_512_ctx { @@ -205,13 +186,10 @@ void sha3_512_init (struct sha3_512_ctx *ctx); void -sha3_512_update (struct sha3_512_ctx *ctx, - size_t length, - const uint8_t *data); +sha3_512_update (struct sha3_512_ctx *ctx, size_t length, const uint8_t *data); void -sha3_512_digest(struct sha3_512_ctx *ctx, - uint8_t *digest); +sha3_512_digest(struct sha3_512_ctx *ctx, uint8_t *digest); #ifdef __cplusplus } diff --git a/shake128.c b/shake128.c index f0eb7e24..f0c68e7d 100644 --- a/shake128.c +++ b/shake128.c @@ -48,9 +48,7 @@ sha3_128_init (struct sha3_128_ctx *ctx) } void -sha3_128_update (struct sha3_128_ctx *ctx, - size_t length, - const uint8_t *data) +sha3_128_update (struct sha3_128_ctx *ctx, size_t length, const uint8_t *data) { ctx->index = _nettle_sha3_update (&ctx->state, SHA3_128_BLOCK_SIZE, ctx->block, @@ -58,16 +56,14 @@ sha3_128_update (struct sha3_128_ctx *ctx, } void -sha3_128_shake (struct sha3_128_ctx *ctx, - size_t length, uint8_t *dst) +sha3_128_shake (struct sha3_128_ctx *ctx, size_t length, uint8_t *dst) { _nettle_sha3_shake (&ctx->state, sizeof (ctx->block), ctx->block, ctx->index, length, dst); sha3_128_init (ctx); } void -sha3_128_shake_output (struct sha3_128_ctx *ctx, - size_t length, uint8_t *digest) +sha3_128_shake_output (struct sha3_128_ctx *ctx, size_t length, uint8_t *digest) { ctx->index = _nettle_sha3_shake_output (&ctx->state, diff --git a/shake256.c b/shake256.c index 721c6ae0..de72cf96 100644 --- a/shake256.c +++ b/shake256.c @@ -40,16 +40,14 @@ #include "sha3-internal.h" void -sha3_256_shake (struct sha3_256_ctx *ctx, - size_t length, uint8_t *dst) +sha3_256_shake (struct sha3_256_ctx *ctx, size_t length, uint8_t *dst) { _nettle_sha3_shake (&ctx->state, sizeof (ctx->block), ctx->block, ctx->index, length, dst); sha3_256_init (ctx); } void -sha3_256_shake_output (struct sha3_256_ctx *ctx, - size_t length, uint8_t *digest) +sha3_256_shake_output (struct sha3_256_ctx *ctx, size_t length, uint8_t *digest) { ctx->index = _nettle_sha3_shake_output (&ctx->state, -- 2.47.3