]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
sha3: add a few ‘restrict’s that I forgot
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 23 Feb 2026 00:36:11 +0000 (16:36 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 23 Feb 2026 00:38:05 +0000 (16:38 -0800)
* lib/sha3-stream.c (sha3_xxx_stream):
* lib/sha3.c (sha3_##SIZE##_buffer):
Add some more ‘restrict’s.

ChangeLog
lib/sha3-stream.c
lib/sha3.c

index 73b0c46649a544c4ba0f4a4f536f0ff6824d708e..a3b766a799d389e6f512736f4df2e67a549db8db 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -48,6 +48,8 @@
        (sha384_stream):
        * lib/sm3.h (sm3_process_block, sm3_process_bytes, sm3_finish_ctx)
        (sm3_read_ctx, sm3_buffer, sm3_stream):
+       * lib/sha3.c (sha3_##SIZE##_buffer):
+       * lib/sha3-stream.c (sha3_xxx_stream):
        Add ‘restrict’ to pointer args.  All implementations changed.
 
        crypto/sha3: Don’t leak if init fails and no free
index a4d6507bba792cfd6995a79f28e319cda00d81d0..46ae7df7919a50ffa79b078f0975f09fbbbb59b2 100644 (file)
@@ -40,7 +40,8 @@
    The initial operation is INIT_CTX.  Return zero if and only if
    successful.  */
 static int
-sha3_xxx_stream (FILE *stream, char const *alg, void *resblock,
+sha3_xxx_stream (FILE *restrict stream, char const *restrict alg,
+                 void *restrict resblock,
                  ssize_t hashlen, bool (*init_ctx) (struct sha3_ctx *))
 {
   switch (afalg_stream (stream, alg, resblock, hashlen))
index c839f9148a85ddeb61de05c98d17eb6b6e6ccda6..1bebbc769506d5d021c7156e56dc01d75227d1ae 100644 (file)
@@ -402,7 +402,8 @@ sha3_finish_ctx (struct sha3_ctx *restrict ctx, void *restrict resbuf)
 
 #define DEFINE_SHA3_BUFFER(SIZE)                                        \
   void *                                                                \
-  sha3_##SIZE##_buffer (const char *buffer, size_t len, void *resblock) \
+  sha3_##SIZE##_buffer (char const *restrict buffer, size_t len,        \
+                        void *restrict resblock)                        \
   {                                                                     \
     struct sha3_ctx ctx;                                                \
     void *result = ((sha3_##SIZE##_init_ctx (&ctx)                      \