* lib/sha3-stream.c (sha3_xxx_stream):
* lib/sha3.c (sha3_##SIZE##_buffer):
Add some more ‘restrict’s.
---
ChangeLog | 2 ++
lib/sha3-stream.c | 3 ++-
lib/sha3.c | 3 ++-
3 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 73b0c46649..a3b766a799 100644
--- 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
diff --git a/lib/sha3-stream.c b/lib/sha3-stream.c
index a4d6507bba..46ae7df791 100644
--- a/lib/sha3-stream.c
+++ b/lib/sha3-stream.c
@@ -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))
diff --git a/lib/sha3.c b/lib/sha3.c
index c839f9148a..1bebbc7695 100644
--- a/lib/sha3.c
+++ b/lib/sha3.c
@@ -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) \
--
2.51.0