From 94ff8af6bf3399c077cb907e56424d61fdea79d4 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 23 Feb 2020 13:15:15 +0100 Subject: [PATCH 22/29] crypto/md5-buffer: Use 'restrict'. * lib/md5.h (__md5_finish_ctx, __md5_read_ctx, __md5_buffer): Use 'restrict'. * modules/crypto/md5-buffer (configure.ac): Require AC_C_RESTRICT. --- ChangeLog | 5 +++++ lib/md5.h | 8 +++++--- modules/crypto/md5-buffer | 1 + 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index bd40d1b..2ed99c4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2020-02-23 Bruno Haible + crypto/md5-buffer: Use 'restrict'. + * lib/md5.h (__md5_finish_ctx, __md5_read_ctx, __md5_buffer): Use + 'restrict'. + * modules/crypto/md5-buffer (configure.ac): Require AC_C_RESTRICT. + crypto/md4: Use 'restrict'. * lib/md4.h (md4_finish_ctx, md4_read_ctx, md4_buffer): Use 'restrict'. * modules/crypto/md4 (configure.ac): Require AC_C_RESTRICT. diff --git a/lib/md5.h b/lib/md5.h index 9e0c0fb..0c8b929 100644 --- a/lib/md5.h +++ b/lib/md5.h @@ -105,13 +105,15 @@ extern void __md5_process_bytes (const void *buffer, size_t len, in first 16 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 *__md5_finish_ctx (struct md5_ctx *ctx, void *resbuf) __THROW; +extern void *__md5_finish_ctx (struct md5_ctx *ctx, void *restrict resbuf) + __THROW; /* Put result from CTX in first 16 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 *__md5_read_ctx (const struct md5_ctx *ctx, void *resbuf) __THROW; +extern void *__md5_read_ctx (const struct md5_ctx *ctx, void *restrict resbuf) + __THROW; /* Compute MD5 message digest for LEN bytes beginning at BUFFER. The @@ -119,7 +121,7 @@ extern void *__md5_read_ctx (const struct md5_ctx *ctx, void *resbuf) __THROW; output yields to the wanted ASCII representation of the message digest. */ extern void *__md5_buffer (const char *buffer, size_t len, - void *resblock) __THROW; + void *restrict resblock) __THROW; # endif /* Compute MD5 message digest for bytes read from STREAM. diff --git a/modules/crypto/md5-buffer b/modules/crypto/md5-buffer index 006bc81..fb5763e 100644 --- a/modules/crypto/md5-buffer +++ b/modules/crypto/md5-buffer @@ -15,6 +15,7 @@ stdalign stdint configure.ac: +AC_REQUIRE([AC_C_RESTRICT]) gl_MD5 Makefile.am: -- 2.7.4