From: Bruno Haible Date: Sun, 23 Feb 2020 12:18:33 +0000 (+0100) Subject: crypto/sha256-buffer: Use 'restrict'. X-Git-Tag: v1.0~4206 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=cd6346e11a637b08d364399f900c8ddd3f44bf39;p=gnulib.git crypto/sha256-buffer: Use 'restrict'. * lib/sha256.h (sha256_finish_ctx, sha224_finish_ctx, sha256_read_ctx, sha224_read_ctx, sha256_buffer, sha224_buffer): Use 'restrict'. * modules/crypto/sha256-buffer (configure.ac): Require AC_C_RESTRICT. --- diff --git a/ChangeLog b/ChangeLog index 379083a3d3..6e782e1be0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2020-02-23 Bruno Haible + crypto/sha256-buffer: Use 'restrict'. + * lib/sha256.h (sha256_finish_ctx, sha224_finish_ctx, sha256_read_ctx, + sha224_read_ctx, sha256_buffer, sha224_buffer): Use 'restrict'. + * modules/crypto/sha256-buffer (configure.ac): Require AC_C_RESTRICT. + crypto/sha1-buffer: Use 'restrict'. * lib/sha1.h (sha1_finish_ctx, sha1_read_ctx, sha1_buffer): Use 'restrict'. diff --git a/lib/sha256.h b/lib/sha256.h index 1bc61d437c..750d78a269 100644 --- a/lib/sha256.h +++ b/lib/sha256.h @@ -70,23 +70,27 @@ extern void sha256_process_bytes (const void *buffer, size_t len, in first 32 (28) 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 *sha256_finish_ctx (struct sha256_ctx *ctx, void *resbuf); -extern void *sha224_finish_ctx (struct sha256_ctx *ctx, void *resbuf); +extern void *sha256_finish_ctx (struct sha256_ctx *ctx, void *restrict resbuf); +extern void *sha224_finish_ctx (struct sha256_ctx *ctx, void *restrict resbuf); /* Put result from CTX in first 32 (28) 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 *sha256_read_ctx (const struct sha256_ctx *ctx, void *resbuf); -extern void *sha224_read_ctx (const struct sha256_ctx *ctx, void *resbuf); +extern void *sha256_read_ctx (const struct sha256_ctx *ctx, + void *restrict resbuf); +extern void *sha224_read_ctx (const struct sha256_ctx *ctx, + void *restrict resbuf); -/* Compute SHA256 (SHA224) message digest for LEN bytes beginning at BUFFER. The - result is always in little endian byte order, so that a byte-wise +/* Compute SHA256 (SHA224) 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 *sha256_buffer (const char *buffer, size_t len, void *resblock); -extern void *sha224_buffer (const char *buffer, size_t len, void *resblock); +extern void *sha256_buffer (const char *buffer, size_t len, + void *restrict resblock); +extern void *sha224_buffer (const char *buffer, size_t len, + void *restrict resblock); # endif /* Compute SHA256 (SHA224) message digest for bytes read from STREAM. diff --git a/modules/crypto/sha256-buffer b/modules/crypto/sha256-buffer index e5a4703ec0..055275a38e 100644 --- a/modules/crypto/sha256-buffer +++ b/modules/crypto/sha256-buffer @@ -15,6 +15,7 @@ stdalign stdint configure.ac: +AC_REQUIRE([AC_C_RESTRICT]) gl_SHA256 Makefile.am: