(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
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))
#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) \