>From 3b97754de802a01897a8ef4c09edf8487309705f Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 23 Feb 2020 13:16:44 +0100 Subject: [PATCH 23/29] crypto/sha1-buffer: Use 'restrict'. * lib/sha1.h (sha1_finish_ctx, sha1_read_ctx, sha1_buffer): Use 'restrict'. * modules/crypto/sha1-buffer (configure.ac): Require AC_C_RESTRICT. --- ChangeLog | 5 +++++ lib/sha1.h | 7 ++++--- modules/crypto/sha1-buffer | 1 + 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2ed99c4..379083a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2020-02-23 Bruno Haible + crypto/sha1-buffer: Use 'restrict'. + * lib/sha1.h (sha1_finish_ctx, sha1_read_ctx, sha1_buffer): Use + 'restrict'. + * modules/crypto/sha1-buffer (configure.ac): Require AC_C_RESTRICT. + crypto/md5-buffer: Use 'restrict'. * lib/md5.h (__md5_finish_ctx, __md5_read_ctx, __md5_buffer): Use 'restrict'. diff --git a/lib/sha1.h b/lib/sha1.h index 99c53da..51496a9 100644 --- a/lib/sha1.h +++ b/lib/sha1.h @@ -71,20 +71,21 @@ extern void sha1_process_bytes (const void *buffer, size_t len, in first 20 bytes following RESBUF. The result is always in little endian byte order, so that a byte-wise output yields to the wanted ASCII representation of the message digest. */ -extern void *sha1_finish_ctx (struct sha1_ctx *ctx, void *resbuf); +extern void *sha1_finish_ctx (struct sha1_ctx *ctx, void *restrict resbuf); /* Put result from CTX in first 20 bytes following RESBUF. The result is always in little endian byte order, so that a byte-wise output yields to the wanted ASCII representation of the message digest. */ -extern void *sha1_read_ctx (const struct sha1_ctx *ctx, void *resbuf); +extern void *sha1_read_ctx (const struct sha1_ctx *ctx, void *restrict resbuf); /* Compute SHA1 message digest for LEN bytes beginning at BUFFER. The result is always in little endian byte order, so that a byte-wise output yields to the wanted ASCII representation of the message digest. */ -extern void *sha1_buffer (const char *buffer, size_t len, void *resblock); +extern void *sha1_buffer (const char *buffer, size_t len, + void *restrict resblock); # endif /* Compute SHA1 message digest for bytes read from STREAM. diff --git a/modules/crypto/sha1-buffer b/modules/crypto/sha1-buffer index 807f2dc..55a5420 100644 --- a/modules/crypto/sha1-buffer +++ b/modules/crypto/sha1-buffer @@ -15,6 +15,7 @@ stdalign stdint configure.ac: +AC_REQUIRE([AC_C_RESTRICT]) gl_SHA1 Makefile.am: -- 2.7.4