]> git.ipfire.org Git - thirdparty/nettle.git/commitdiff
Trim memset calls in gosthash94_init and md2_init.
authorNiels Möller <nisse@lysator.liu.se>
Sun, 22 Jun 2025 19:05:51 +0000 (21:05 +0200)
committerNiels Möller <nisse@lysator.liu.se>
Sun, 22 Jun 2025 19:05:51 +0000 (21:05 +0200)
ChangeLog
gosthash94.c
md2.c

index b0af0d0cfb7f23fbf22c01dac9fbf0156ae39b8f..fc08f5270246107a7a765806aedc1aaa85d8b852 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2025-06-22  Niels Möller  <nisse@lysator.liu.se>
 
+       * 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
index 3a9b86ed78c4b91eb8aa515379a13f3cb2d27396..c8b6250d3e0a22a56b6d834876b288d781501a47 100644 (file)
@@ -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 6c067410c93d8ae64b1be86bfd33be7dacb8a05b..bfd3e17160c33e99056a0257c83590255ee18186 100644 (file)
--- 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