From: Niels Möller Date: Tue, 11 Mar 2025 19:35:28 +0000 (+0100) Subject: Add typedef nettle_output_func. X-Git-Tag: nettle_4.0rc1~101 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b9167b8a65e18497c77630d52407868943dd32e2;p=thirdparty%2Fnettle.git Add typedef nettle_output_func. --- diff --git a/nettle-types.h b/nettle-types.h index 3151bb2d..04febc7c 100644 --- a/nettle-types.h +++ b/nettle-types.h @@ -70,9 +70,13 @@ union nettle_block8 uint64_t u64; }; -/* Randomness. Used by key generation and dsa signature creation. */ -typedef void nettle_random_func(void *ctx, + +/* Used for generating randomness, as well as for extendable output + functions like shake. */ +typedef void nettle_output_func(void *ctx, size_t length, uint8_t *dst); +/* Old name used for key generation and (ec)dsa signature creation. */ +typedef nettle_output_func nettle_random_func; /* Progress report function, mainly for key generation. */ typedef void nettle_progress_func(void *ctx, int c); diff --git a/testsuite/shake128-test.c b/testsuite/shake128-test.c index c724b9f3..fd55b4b2 100644 --- a/testsuite/shake128-test.c +++ b/testsuite/shake128-test.c @@ -41,8 +41,8 @@ const struct nettle_xof nettle_shake128 = SHA3_128_BLOCK_SIZE, (nettle_hash_init_func *) sha3_128_init, (nettle_hash_update_func *) sha3_128_update, - (nettle_random_func *) sha3_128_shake, - (nettle_random_func *) sha3_128_shake_output, + (nettle_output_func *) sha3_128_shake, + (nettle_output_func *) sha3_128_shake_output, }; void diff --git a/testsuite/shake256-test.c b/testsuite/shake256-test.c index 1421239f..93e1107e 100644 --- a/testsuite/shake256-test.c +++ b/testsuite/shake256-test.c @@ -43,8 +43,8 @@ const struct nettle_xof nettle_shake256 = SHA3_256_BLOCK_SIZE, (nettle_hash_init_func *) sha3_256_init, (nettle_hash_update_func *) sha3_256_update, - (nettle_random_func *) sha3_256_shake, - (nettle_random_func *) sha3_256_shake_output, + (nettle_output_func *) sha3_256_shake, + (nettle_output_func *) sha3_256_shake_output, }; void diff --git a/testsuite/testutils.h b/testsuite/testutils.h index 84b4998c..49b813ab 100644 --- a/testsuite/testutils.h +++ b/testsuite/testutils.h @@ -114,9 +114,8 @@ struct nettle_xof { unsigned block_size; nettle_hash_init_func *init; nettle_hash_update_func *update; - /* FIXME: Rename to, e.g., nettle_output_func. */ - nettle_random_func *digest; - nettle_random_func *output; + nettle_output_func *digest; + nettle_output_func *output; }; void