From: Niels Möller Date: Sun, 22 Jun 2025 19:05:51 +0000 (+0200) Subject: Trim memset calls in gosthash94_init and md2_init. X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=77f765aaecf0712249603b1d28ee3fb85decd65d;p=thirdparty%2Fnettle.git Trim memset calls in gosthash94_init and md2_init. --- diff --git a/ChangeLog b/ChangeLog index b0af0d0c..fc08f527 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2025-06-22 Niels Möller + * gosthash94.c (gosthash94_init): Trim memset call, no need to + clear block buffer. + * md2.c (md2_init): Likewise. + * nettle-types.h (_NETTLE_ALIGN16): New macro, to require 16-byte alignment. Enabled only on platforms where uint64_t needs 8-byte alignment. Intended to improve performance for SIMD load and diff --git a/gosthash94.c b/gosthash94.c index 3a9b86ed..c8b6250d 100644 --- a/gosthash94.c +++ b/gosthash94.c @@ -52,7 +52,7 @@ void gosthash94_init (struct gosthash94_ctx *ctx) { - memset (ctx, 0, sizeof (struct gosthash94_ctx)); + memset (ctx, 0, offsetof (struct gosthash94_ctx, block)); } /** diff --git a/md2.c b/md2.c index 6c067410..bfd3e171 100644 --- a/md2.c +++ b/md2.c @@ -109,7 +109,7 @@ md2_transform(struct md2_ctx *ctx, const uint8_t *data) void md2_init(struct md2_ctx *ctx) { - memset(ctx, 0, sizeof(*ctx)); + memset(ctx, 0, offsetof (struct md2_ctx, block)); } void