Here comes the second part: Use of 'restrict' in non-POSIX function declarations, excluding libunistring code.
2020-02-23 Bruno Haible <br...@clisp.org> crypto/gc: Use 'restrict'. * lib/gc.h (gc_pbkdf2_hmac, gc_pbkdf2_sha1): Use 'restrict'. * m4/gc.m4 (gl_GC): Require AC_C_RESTRICT. crypto/hmac-*: Use 'restrict'. * lib/hmac.h (hmac_md5, hmac_sha1, hmac_sha256, hmac_sha512): Use 'restrict'. * modules/crypto/hmac-md5 (configure.ac): Require AC_C_RESTRICT. * modules/crypto/hmac-sha1 (configure.ac): Likewise. * modules/crypto/hmac-sha256 (configure.ac): Likewise. * modules/crypto/hmac-sha512 (configure.ac): Likewise. crypto/sm3: Use 'restrict'. * lib/sm3.h (sm3_finish_ctx, sm3_read_ctx, sm3_buffer): Use 'restrict'. * m4/sm3.m4 (gl_SM3): Require AC_C_RESTRICT. crypto/*-buffer: Use 'restrict'. * lib/gl_openssl.h (GL_CRYPTO_FN (_finish_ctx), GL_CRYPTO_FN (_buffer), GL_CRYPTO_FN (_read_ctx)): Use 'restrict'. crypto/sha512-buffer: Use 'restrict'. * lib/sha512.h (sha512_finish_ctx, sha384_finish_ctx, sha512_read_ctx, sha384_read_ctx, sha512_buffer, sha384_buffer): Use 'restrict'. * modules/crypto/sha512-buffer (configure.ac): Require AC_C_RESTRICT. 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'. * 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'. * 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. crypto/md2: Use 'restrict'. * lib/md2.h (md2_finish_ctx, md2_read_ctx, md2_buffer): Use 'restrict'. * modules/crypto/md2 (configure.ac): Require AC_C_RESTRICT. crypto/rijndael: Use 'restrict'. * lib/rijndael-api-fst.h (rijndaelBlockEncrypt, rijndaelPadEncrypt, rijndaelBlockDecrypt, rijndaelPadDecrypt): Use 'restrict'. * modules/crypto/rijndael (configure.ac): Require AC_C_RESTRICT. crypto/arctwo: Use 'restrict'. * lib/arctwo.h (arctwo_encrypt, arctwo_decrypt): Use 'restrict'. * modules/crypto/arctwo (configure.ac): Require AC_C_RESTRICT. crypto/arcfour: Use 'restrict'. * lib/arcfour.h (arcfour_stream): Use 'restrict'. * modules/crypto/arcfour (configure.ac): Require AC_C_RESTRICT. careadlinkat: Use 'restrict'. * lib/careadlinkat.h (careadlinkat): Use 'restrict'. * modules/careadlinkat (configure.ac): Require AC_C_RESTRICT. * modules/relocatable-prog-wrapper (configure.ac): Likewise. regex-quote: Use 'restrict'. * lib/regex-quote.h (regex_quote_copy): Use 'restrict'. * modules/regex-quote (configure.ac): Require AC_C_RESTRICT. system-quote: Use 'restrict'. * lib/system-quote.h (system_quote_copy): Use 'restrict'. * modules/system-quote (configure.ac): Require AC_C_RESTRICT. sh-quote: Use 'restrict'. * lib/sh-quote.h (shell_quote_copy): Use 'restrict'. * modules/sh-quote (configure.ac): Require AC_C_RESTRICT. quotearg: Use 'restrict'. * lib/quotearg.h (quotearg_buffer): Use 'restrict'. * m4/quotearg.m4 (gl_QUOTEARG): Require AC_C_RESTRICT. parse-datetime: Use 'restrict'. * lib/parse-datetime.h (parse_datetime, parse_datetime2): Use 'restrict'. * m4/parse-datetime.m4 (gl_PARSE_DATETIME): Require AC_C_RESTRICT. nstrftime: Use 'restrict'. * lib/strftime.h (nstrftime): Use 'restrict'. * m4/nstrftime.m4 (gl_FUNC_GNU_STRFTIME): Require AC_C_RESTRICT. mbstok_r: Use 'restrict'. * lib/string.in.h (mbstok_r): Use 'restrict'. xmemcoll: Use 'restrict'. * lib/xmemcoll.h (xmemcoll): Use 'restrict'. * modules/xmemcoll (configure.ac): Require AC_C_RESTRICT. memcoll: Use 'restrict'. * lib/memcoll.h (memcoll): Use 'restrict'. * m4/memcoll.m4 (gl_MEMCOLL): Require AC_C_RESTRICT. vasnprintf: Use 'restrict'. * lib/vasnprintf.h (asnprintf, vasnprintf): Use 'restrict'. * modules/vasnprintf (configure.ac): Require AC_C_RESTRICT. c-vasnprintf: Use 'restrict'. * lib/c-vasnprintf.h (c_vasnprintf): Use 'restrict'. * modules/c-vasnprintf (configure.ac): Require AC_C_RESTRICT. c-vsnprintf: Use 'restrict'. * lib/c-vsnprintf.h (c_vsnprintf): Use 'restrict'. * modules/c-vsnprintf (configure.ac): Require AC_C_RESTRICT. c-snprintf: Use 'restrict'. * lib/c-snprintf.h (c_snprintf): Use 'restrict'. * modules/c-snprintf (configure.ac): Require AC_C_RESTRICT. astrxfrm: Use 'restrict'. * lib/astrxfrm.h (astrxfrm): Use 'restrict'. * modules/astrxfrm (configure.ac): Require AC_C_RESTRICT. amemxfrm: Use 'restrict'. * lib/amemxfrm.h (amemxfrm): Use 'restrict'. * modules/amemxfrm (configure.ac): Require AC_C_RESTRICT.
>From a765a46c498f55ab1291737a3f6167a58e75d948 Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Sun, 23 Feb 2020 12:04:46 +0100 Subject: [PATCH 01/29] amemxfrm: Use 'restrict'. * lib/amemxfrm.h (amemxfrm): Use 'restrict'. * modules/amemxfrm (configure.ac): Require AC_C_RESTRICT. --- ChangeLog | 6 ++++++ lib/amemxfrm.h | 3 ++- modules/amemxfrm | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index c21e04d..563d770 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2020-02-23 Bruno Haible <br...@clisp.org> + + amemxfrm: Use 'restrict'. + * lib/amemxfrm.h (amemxfrm): Use 'restrict'. + * modules/amemxfrm (configure.ac): Require AC_C_RESTRICT. + 2020-02-22 Paul Eggert <egg...@cs.ucla.edu> fchmodat, lchmod: simplify diff --git a/lib/amemxfrm.h b/lib/amemxfrm.h index 7cfc283..2c91388 100644 --- a/lib/amemxfrm.h +++ b/lib/amemxfrm.h @@ -38,7 +38,8 @@ extern "C" { freshly allocated string is returned. In both cases, *lengthp is set to the length of the returned string. Upon failure, return NULL, with errno set. */ -extern char * amemxfrm (char *s, size_t n, char *resultbuf, size_t *lengthp); +extern char * amemxfrm (char *restrict s, size_t n, + char *restrict resultbuf, size_t *lengthp); #ifdef __cplusplus diff --git a/modules/amemxfrm b/modules/amemxfrm index fe7e1a4..cf48753 100644 --- a/modules/amemxfrm +++ b/modules/amemxfrm @@ -8,6 +8,7 @@ lib/amemxfrm.c Depends-on: configure.ac: +AC_REQUIRE([AC_C_RESTRICT]) Makefile.am: lib_SOURCES += amemxfrm.c -- 2.7.4
>From b9eae96869cc9cef3865505ab8dc356196f241e9 Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Sun, 23 Feb 2020 12:06:29 +0100 Subject: [PATCH 02/29] astrxfrm: Use 'restrict'. * lib/astrxfrm.h (astrxfrm): Use 'restrict'. * modules/astrxfrm (configure.ac): Require AC_C_RESTRICT. --- ChangeLog | 4 ++++ lib/astrxfrm.h | 3 ++- modules/astrxfrm | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 563d770..80a90eb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2020-02-23 Bruno Haible <br...@clisp.org> + astrxfrm: Use 'restrict'. + * lib/astrxfrm.h (astrxfrm): Use 'restrict'. + * modules/astrxfrm (configure.ac): Require AC_C_RESTRICT. + amemxfrm: Use 'restrict'. * lib/amemxfrm.h (amemxfrm): Use 'restrict'. * modules/amemxfrm (configure.ac): Require AC_C_RESTRICT. diff --git a/lib/astrxfrm.h b/lib/astrxfrm.h index a23ed70..211fe3b 100644 --- a/lib/astrxfrm.h +++ b/lib/astrxfrm.h @@ -37,7 +37,8 @@ extern "C" { freshly allocated string is returned. In both cases, *lengthp is set to the length of the returned string. Upon failure, return NULL, with errno set. */ -extern char * astrxfrm (const char *s, char *resultbuf, size_t *lengthp); +extern char * astrxfrm (const char *s, + char *restrict resultbuf, size_t *lengthp); #ifdef __cplusplus diff --git a/modules/astrxfrm b/modules/astrxfrm index e2edc42..0533403 100644 --- a/modules/astrxfrm +++ b/modules/astrxfrm @@ -8,6 +8,7 @@ lib/astrxfrm.c Depends-on: configure.ac: +AC_REQUIRE([AC_C_RESTRICT]) Makefile.am: lib_SOURCES += astrxfrm.c -- 2.7.4
>From f2042e039a29fdab365929d776fee22bfeff15fb Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Sun, 23 Feb 2020 12:12:09 +0100 Subject: [PATCH 03/29] c-snprintf: Use 'restrict'. * lib/c-snprintf.h (c_snprintf): Use 'restrict'. * modules/c-snprintf (configure.ac): Require AC_C_RESTRICT. --- ChangeLog | 4 ++++ lib/c-snprintf.h | 3 ++- modules/c-snprintf | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 80a90eb..277b594 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2020-02-23 Bruno Haible <br...@clisp.org> + c-snprintf: Use 'restrict'. + * lib/c-snprintf.h (c_snprintf): Use 'restrict'. + * modules/c-snprintf (configure.ac): Require AC_C_RESTRICT. + astrxfrm: Use 'restrict'. * lib/astrxfrm.h (astrxfrm): Use 'restrict'. * modules/astrxfrm (configure.ac): Require AC_C_RESTRICT. diff --git a/lib/c-snprintf.h b/lib/c-snprintf.h index bfdc081..d82f354 100644 --- a/lib/c-snprintf.h +++ b/lib/c-snprintf.h @@ -36,7 +36,8 @@ extern "C" { #endif -int c_snprintf (char *str, size_t size, const char *format, ...) +extern int c_snprintf (char *restrict str, size_t size, + const char *format, ...) _GL_ATTRIBUTE_FORMAT ((__printf__, 3, 4)); #ifdef __cplusplus diff --git a/modules/c-snprintf b/modules/c-snprintf index edebe2b..2449b01 100644 --- a/modules/c-snprintf +++ b/modules/c-snprintf @@ -9,6 +9,7 @@ Depends-on: c-vasnprintf configure.ac: +AC_REQUIRE([AC_C_RESTRICT]) Makefile.am: lib_SOURCES += c-snprintf.c -- 2.7.4
>From 69acbf9b8d4b8517eefa25be74e436f22b9b0428 Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Sun, 23 Feb 2020 12:13:40 +0100 Subject: [PATCH 04/29] c-vsnprintf: Use 'restrict'. * lib/c-vsnprintf.h (c_vsnprintf): Use 'restrict'. * modules/c-vsnprintf (configure.ac): Require AC_C_RESTRICT. --- ChangeLog | 4 ++++ lib/c-vsnprintf.h | 3 ++- modules/c-vsnprintf | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 277b594..1bc838e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2020-02-23 Bruno Haible <br...@clisp.org> + c-vsnprintf: Use 'restrict'. + * lib/c-vsnprintf.h (c_vsnprintf): Use 'restrict'. + * modules/c-vsnprintf (configure.ac): Require AC_C_RESTRICT. + c-snprintf: Use 'restrict'. * lib/c-snprintf.h (c_snprintf): Use 'restrict'. * modules/c-snprintf (configure.ac): Require AC_C_RESTRICT. diff --git a/lib/c-vsnprintf.h b/lib/c-vsnprintf.h index 97a2816..e296871 100644 --- a/lib/c-vsnprintf.h +++ b/lib/c-vsnprintf.h @@ -39,7 +39,8 @@ extern "C" { #endif -int c_vsnprintf (char *str, size_t size, const char *format, va_list args) +extern int c_vsnprintf (char *restrict str, size_t size, + const char *format, va_list args) _GL_ATTRIBUTE_FORMAT ((__printf__, 3, 0)); #ifdef __cplusplus diff --git a/modules/c-vsnprintf b/modules/c-vsnprintf index 7846d9d..b227e92 100644 --- a/modules/c-vsnprintf +++ b/modules/c-vsnprintf @@ -10,6 +10,7 @@ Depends-on: c-vasnprintf configure.ac: +AC_REQUIRE([AC_C_RESTRICT]) Makefile.am: lib_SOURCES += c-vsnprintf.c -- 2.7.4
>From fc00c78e289085063c1832a54d73fc784e9f9626 Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Sun, 23 Feb 2020 12:15:09 +0100 Subject: [PATCH 05/29] c-vasnprintf: Use 'restrict'. * lib/c-vasnprintf.h (c_vasnprintf): Use 'restrict'. * modules/c-vasnprintf (configure.ac): Require AC_C_RESTRICT. --- ChangeLog | 4 ++++ lib/c-vasnprintf.h | 3 ++- modules/c-vasnprintf | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 1bc838e..9db6d8b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2020-02-23 Bruno Haible <br...@clisp.org> + c-vasnprintf: Use 'restrict'. + * lib/c-vasnprintf.h (c_vasnprintf): Use 'restrict'. + * modules/c-vasnprintf (configure.ac): Require AC_C_RESTRICT. + c-vsnprintf: Use 'restrict'. * lib/c-vsnprintf.h (c_vsnprintf): Use 'restrict'. * modules/c-vsnprintf (configure.ac): Require AC_C_RESTRICT. diff --git a/lib/c-vasnprintf.h b/lib/c-vasnprintf.h index 1a69e56..0f58fb8 100644 --- a/lib/c-vasnprintf.h +++ b/lib/c-vasnprintf.h @@ -66,7 +66,8 @@ extern "C" { Formatting takes place in the C locale, that is, the decimal point used in floating-point formatting directives is always '.'. */ -extern char *c_vasnprintf (char *resultbuf, size_t *lengthp, const char *format, va_list args) +extern char *c_vasnprintf (char *restrict resultbuf, size_t *lengthp, + const char *format, va_list args) _GL_ATTRIBUTE_FORMAT ((__printf__, 3, 0)); #ifdef __cplusplus diff --git a/modules/c-vasnprintf b/modules/c-vasnprintf index ae51ea9..391d964 100644 --- a/modules/c-vasnprintf +++ b/modules/c-vasnprintf @@ -39,6 +39,7 @@ multiarch verify configure.ac: +AC_REQUIRE([AC_C_RESTRICT]) gl_PREREQ_VASNPRINTF_WITH_EXTRAS Makefile.am: -- 2.7.4
>From d5233651c987d7b605aff58c79538d1b5cc5ed1e Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Sun, 23 Feb 2020 12:17:44 +0100 Subject: [PATCH 06/29] vasnprintf: Use 'restrict'. * lib/vasnprintf.h (asnprintf, vasnprintf): Use 'restrict'. * modules/vasnprintf (configure.ac): Require AC_C_RESTRICT. --- ChangeLog | 4 ++++ lib/vasnprintf.h | 6 ++++-- modules/vasnprintf | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9db6d8b..5154229 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2020-02-23 Bruno Haible <br...@clisp.org> + vasnprintf: Use 'restrict'. + * lib/vasnprintf.h (asnprintf, vasnprintf): Use 'restrict'. + * modules/vasnprintf (configure.ac): Require AC_C_RESTRICT. + c-vasnprintf: Use 'restrict'. * lib/c-vasnprintf.h (c_vasnprintf): Use 'restrict'. * modules/c-vasnprintf (configure.ac): Require AC_C_RESTRICT. diff --git a/lib/vasnprintf.h b/lib/vasnprintf.h index 345e6a8..37777c9 100644 --- a/lib/vasnprintf.h +++ b/lib/vasnprintf.h @@ -67,9 +67,11 @@ extern "C" { # define asnprintf rpl_asnprintf # define vasnprintf rpl_vasnprintf #endif -extern char * asnprintf (char *resultbuf, size_t *lengthp, const char *format, ...) +extern char * asnprintf (char *restrict resultbuf, size_t *lengthp, + const char *format, ...) _GL_ATTRIBUTE_FORMAT ((__printf__, 3, 4)); -extern char * vasnprintf (char *resultbuf, size_t *lengthp, const char *format, va_list args) +extern char * vasnprintf (char *restrict resultbuf, size_t *lengthp, + const char *format, va_list args) _GL_ATTRIBUTE_FORMAT ((__printf__, 3, 0)); #ifdef __cplusplus diff --git a/modules/vasnprintf b/modules/vasnprintf index 671cb68..de8537a 100644 --- a/modules/vasnprintf +++ b/modules/vasnprintf @@ -31,6 +31,7 @@ verify wchar configure.ac: +AC_REQUIRE([AC_C_RESTRICT]) gl_FUNC_VASNPRINTF Makefile.am: -- 2.7.4
>From 771be1d4d16c54578e9605c3d457290b822bcfa5 Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Sun, 23 Feb 2020 12:19:28 +0100 Subject: [PATCH 07/29] memcoll: Use 'restrict'. * lib/memcoll.h (memcoll): Use 'restrict'. * m4/memcoll.m4 (gl_MEMCOLL): Require AC_C_RESTRICT. --- ChangeLog | 4 ++++ lib/memcoll.h | 2 +- m4/memcoll.m4 | 8 ++++++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5154229..b1ffa89 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2020-02-23 Bruno Haible <br...@clisp.org> + memcoll: Use 'restrict'. + * lib/memcoll.h (memcoll): Use 'restrict'. + * m4/memcoll.m4 (gl_MEMCOLL): Require AC_C_RESTRICT. + vasnprintf: Use 'restrict'. * lib/vasnprintf.h (asnprintf, vasnprintf): Use 'restrict'. * modules/vasnprintf (configure.ac): Require AC_C_RESTRICT. diff --git a/lib/memcoll.h b/lib/memcoll.h index add0968..907ca1f 100644 --- a/lib/memcoll.h +++ b/lib/memcoll.h @@ -22,7 +22,7 @@ # include <stddef.h> -int memcoll (char *, size_t, char *, size_t); +int memcoll (char *restrict, size_t, char *restrict, size_t); int memcoll0 (char const *, size_t, char const *, size_t); #endif /* MEMCOLL_H_ */ diff --git a/m4/memcoll.m4 b/m4/memcoll.m4 index d3d1132..e6eb77e 100644 --- a/m4/memcoll.m4 +++ b/m4/memcoll.m4 @@ -1,8 +1,12 @@ -# memcoll.m4 serial 10 +# memcoll.m4 serial 11 dnl Copyright (C) 2002-2003, 2005-2006, 2009-2020 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. -AC_DEFUN([gl_MEMCOLL], [:]) +AC_DEFUN([gl_MEMCOLL], +[ + AC_REQUIRE([AC_C_RESTRICT]) + : +]) -- 2.7.4
>From 11ff607ecad1b1f06b6f6966ee989db9d079cc9d Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Sun, 23 Feb 2020 12:20:35 +0100 Subject: [PATCH 08/29] xmemcoll: Use 'restrict'. * lib/xmemcoll.h (xmemcoll): Use 'restrict'. * modules/xmemcoll (configure.ac): Require AC_C_RESTRICT. --- ChangeLog | 4 ++++ lib/xmemcoll.h | 2 +- modules/xmemcoll | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index b1ffa89..161c3d6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2020-02-23 Bruno Haible <br...@clisp.org> + xmemcoll: Use 'restrict'. + * lib/xmemcoll.h (xmemcoll): Use 'restrict'. + * modules/xmemcoll (configure.ac): Require AC_C_RESTRICT. + memcoll: Use 'restrict'. * lib/memcoll.h (memcoll): Use 'restrict'. * m4/memcoll.m4 (gl_MEMCOLL): Require AC_C_RESTRICT. diff --git a/lib/xmemcoll.h b/lib/xmemcoll.h index 4170b9b..1ac2325 100644 --- a/lib/xmemcoll.h +++ b/lib/xmemcoll.h @@ -1,3 +1,3 @@ #include <stddef.h> -int xmemcoll (char *, size_t, char *, size_t); +int xmemcoll (char *restrict, size_t, char *restrict, size_t); int xmemcoll0 (char const *, size_t, char const *, size_t); diff --git a/modules/xmemcoll b/modules/xmemcoll index 9724945..3ef5491 100644 --- a/modules/xmemcoll +++ b/modules/xmemcoll @@ -13,6 +13,7 @@ quotearg exitfail configure.ac: +AC_REQUIRE([AC_C_RESTRICT]) Makefile.am: lib_SOURCES += xmemcoll.h xmemcoll.c -- 2.7.4
>From 6f6695eaf1c2dee0f2d11f107637405da1d6121e Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Sun, 23 Feb 2020 12:24:01 +0100 Subject: [PATCH 09/29] mbstok_r: Use 'restrict'. * lib/string.in.h (mbstok_r): Use 'restrict'. --- ChangeLog | 3 +++ lib/string.in.h | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 161c3d6..cf441ae 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2020-02-23 Bruno Haible <br...@clisp.org> + mbstok_r: Use 'restrict'. + * lib/string.in.h (mbstok_r): Use 'restrict'. + xmemcoll: Use 'restrict'. * lib/xmemcoll.h (xmemcoll): Use 'restrict'. * modules/xmemcoll (configure.ac): Require AC_C_RESTRICT. diff --git a/lib/string.in.h b/lib/string.in.h index 625d608..87155ca 100644 --- a/lib/string.in.h +++ b/lib/string.in.h @@ -969,7 +969,8 @@ _GL_EXTERN_C char * mbssep (char **stringp, const char *delim) Caveat: The identity of the delimiting character is lost. See also mbssep(). */ -_GL_EXTERN_C char * mbstok_r (char *string, const char *delim, char **save_ptr) +_GL_EXTERN_C char * mbstok_r (char *restrict string, const char *delim, + char **save_ptr) _GL_ARG_NONNULL ((2, 3)); #endif -- 2.7.4
>From bf19526c73eb07080946178390834c2ab8ddfb83 Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Sun, 23 Feb 2020 12:25:42 +0100 Subject: [PATCH 10/29] nstrftime: Use 'restrict'. * lib/strftime.h (nstrftime): Use 'restrict'. * m4/nstrftime.m4 (gl_FUNC_GNU_STRFTIME): Require AC_C_RESTRICT. --- ChangeLog | 4 ++++ lib/strftime.h | 2 +- m4/nstrftime.m4 | 4 +++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index cf441ae..31cd227 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2020-02-23 Bruno Haible <br...@clisp.org> + nstrftime: Use 'restrict'. + * lib/strftime.h (nstrftime): Use 'restrict'. + * m4/nstrftime.m4 (gl_FUNC_GNU_STRFTIME): Require AC_C_RESTRICT. + mbstok_r: Use 'restrict'. * lib/string.in.h (mbstok_r): Use 'restrict'. diff --git a/lib/strftime.h b/lib/strftime.h index 97a062c..e850163 100644 --- a/lib/strftime.h +++ b/lib/strftime.h @@ -25,7 +25,7 @@ extern "C" { POSIX requires that strftime use the local timezone information. Use the timezone __TZ instead. Use __NS as the number of nanoseconds in the %N directive. */ -size_t nstrftime (char *, size_t, char const *, struct tm const *, +size_t nstrftime (char *restrict, size_t, char const *, struct tm const *, timezone_t __tz, int __ns); #ifdef __cplusplus diff --git a/m4/nstrftime.m4 b/m4/nstrftime.m4 index c15fab3..6f2762a 100644 --- a/m4/nstrftime.m4 +++ b/m4/nstrftime.m4 @@ -1,4 +1,4 @@ -# serial 34 +# serial 35 # Copyright (C) 1996-1997, 1999-2007, 2009-2020 Free Software Foundation, Inc. # @@ -10,6 +10,8 @@ AC_DEFUN([gl_FUNC_GNU_STRFTIME], [ + AC_REQUIRE([AC_C_RESTRICT]) + # This defines (or not) HAVE_TZNAME and HAVE_TM_ZONE. AC_REQUIRE([AC_STRUCT_TIMEZONE]) -- 2.7.4
>From 5f56bf12b34a83ab90c9d7e3955aacb9c67cb8a2 Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Sun, 23 Feb 2020 12:27:58 +0100 Subject: [PATCH 11/29] parse-datetime: Use 'restrict'. * lib/parse-datetime.h (parse_datetime, parse_datetime2): Use 'restrict'. * m4/parse-datetime.m4 (gl_PARSE_DATETIME): Require AC_C_RESTRICT. --- ChangeLog | 5 +++++ lib/parse-datetime.h | 6 ++++-- m4/parse-datetime.m4 | 3 ++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 31cd227..472ec01 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2020-02-23 Bruno Haible <br...@clisp.org> + parse-datetime: Use 'restrict'. + * lib/parse-datetime.h (parse_datetime, parse_datetime2): Use + 'restrict'. + * m4/parse-datetime.m4 (gl_PARSE_DATETIME): Require AC_C_RESTRICT. + nstrftime: Use 'restrict'. * lib/strftime.h (nstrftime): Use 'restrict'. * m4/nstrftime.m4 (gl_FUNC_GNU_STRFTIME): Require AC_C_RESTRICT. diff --git a/lib/parse-datetime.h b/lib/parse-datetime.h index ab9b576..3836308 100644 --- a/lib/parse-datetime.h +++ b/lib/parse-datetime.h @@ -19,11 +19,13 @@ #include <stdbool.h> #include <time.h> -bool parse_datetime (struct timespec *, char const *, struct timespec const *); +bool parse_datetime (struct timespec *restrict, + char const *, struct timespec const *); /* parse_datetime2 flag: if set, print debug/progress information to STDERR */ #define PARSE_DATETIME_DEBUG 1 /* same as above, supporting additional flags */ -bool parse_datetime2 (struct timespec *, char const *, struct timespec const *, +bool parse_datetime2 (struct timespec *restrict, + char const *, struct timespec const *, unsigned int flags, timezone_t, char const *); diff --git a/m4/parse-datetime.m4 b/m4/parse-datetime.m4 index ebe9541..52a10aa 100644 --- a/m4/parse-datetime.m4 +++ b/m4/parse-datetime.m4 @@ -1,4 +1,4 @@ -# parse-datetime.m4 serial 23 +# parse-datetime.m4 serial 24 dnl Copyright (C) 2002-2006, 2008-2020 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -60,6 +60,7 @@ changequote([,])dnl dnl Prerequisites of lib/parse-datetime.h. AC_REQUIRE([AM_STDBOOL_H]) AC_REQUIRE([gl_TIMESPEC]) + AC_REQUIRE([AC_C_RESTRICT]) dnl Prerequisites of lib/parse-datetime.y. AC_REQUIRE([gl_BISON]) -- 2.7.4
>From 90106dbaf4b8881139bb3e567da8bbc1bad2055f Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Sun, 23 Feb 2020 12:29:41 +0100 Subject: [PATCH 12/29] quotearg: Use 'restrict'. * lib/quotearg.h (quotearg_buffer): Use 'restrict'. * m4/quotearg.m4 (gl_QUOTEARG): Require AC_C_RESTRICT. --- ChangeLog | 4 ++++ lib/quotearg.h | 2 +- m4/quotearg.m4 | 3 ++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 472ec01..8b87c6b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2020-02-23 Bruno Haible <br...@clisp.org> + quotearg: Use 'restrict'. + * lib/quotearg.h (quotearg_buffer): Use 'restrict'. + * m4/quotearg.m4 (gl_QUOTEARG): Require AC_C_RESTRICT. + parse-datetime: Use 'restrict'. * lib/parse-datetime.h (parse_datetime, parse_datetime2): Use 'restrict'. diff --git a/lib/quotearg.h b/lib/quotearg.h index d30fdd1..3bf149b 100644 --- a/lib/quotearg.h +++ b/lib/quotearg.h @@ -323,7 +323,7 @@ void set_custom_quoting (struct quoting_options *o, On output, BUFFER might contain embedded null bytes if ARGSIZE was not -1, the style of O does not use backslash escapes, and the flags of O do not request elision of null bytes.*/ -size_t quotearg_buffer (char *buffer, size_t buffersize, +size_t quotearg_buffer (char *restrict buffer, size_t buffersize, char const *arg, size_t argsize, struct quoting_options const *o); diff --git a/m4/quotearg.m4 b/m4/quotearg.m4 index b6eb16b..4038711 100644 --- a/m4/quotearg.m4 +++ b/m4/quotearg.m4 @@ -1,4 +1,4 @@ -# quotearg.m4 serial 9 +# quotearg.m4 serial 10 dnl Copyright (C) 2002, 2004-2020 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -6,5 +6,6 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_QUOTEARG], [ + AC_REQUIRE([AC_C_RESTRICT]) : ]) -- 2.7.4
>From a85a39de0293d492a6a087c356f4e3a26e0d1cee Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Sun, 23 Feb 2020 12:31:00 +0100 Subject: [PATCH 13/29] sh-quote: Use 'restrict'. * lib/sh-quote.h (shell_quote_copy): Use 'restrict'. * modules/sh-quote (configure.ac): Require AC_C_RESTRICT. --- ChangeLog | 4 ++++ lib/sh-quote.h | 2 +- modules/sh-quote | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 8b87c6b..a00c415 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2020-02-23 Bruno Haible <br...@clisp.org> + sh-quote: Use 'restrict'. + * lib/sh-quote.h (shell_quote_copy): Use 'restrict'. + * modules/sh-quote (configure.ac): Require AC_C_RESTRICT. + quotearg: Use 'restrict'. * lib/quotearg.h (quotearg_buffer): Use 'restrict'. * m4/quotearg.m4 (gl_QUOTEARG): Require AC_C_RESTRICT. diff --git a/lib/sh-quote.h b/lib/sh-quote.h index 9dcd4cf..8b06355 100644 --- a/lib/sh-quote.h +++ b/lib/sh-quote.h @@ -33,7 +33,7 @@ extern size_t shell_quote_length (const char *string); /* Copies the quoted string to p and returns the incremented p. There must be room for shell_quote_length (string) + 1 bytes at p. */ -extern char * shell_quote_copy (char *p, const char *string); +extern char * shell_quote_copy (char *restrict p, const char *string); /* Returns the freshly allocated quoted string. */ extern char * shell_quote (const char *string); diff --git a/modules/sh-quote b/modules/sh-quote index 83fa089..97378f8 100644 --- a/modules/sh-quote +++ b/modules/sh-quote @@ -10,6 +10,7 @@ quotearg xalloc configure.ac: +AC_REQUIRE([AC_C_RESTRICT]) Makefile.am: lib_SOURCES += sh-quote.h sh-quote.c -- 2.7.4
>From 4c37dd4ab504ba644fbcfdb47375398bf0d97b4f Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Sun, 23 Feb 2020 12:32:25 +0100 Subject: [PATCH 14/29] system-quote: Use 'restrict'. * lib/system-quote.h (system_quote_copy): Use 'restrict'. * modules/system-quote (configure.ac): Require AC_C_RESTRICT. --- ChangeLog | 4 ++++ lib/system-quote.h | 2 +- modules/system-quote | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index a00c415..525ecdb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2020-02-23 Bruno Haible <br...@clisp.org> + system-quote: Use 'restrict'. + * lib/system-quote.h (system_quote_copy): Use 'restrict'. + * modules/system-quote (configure.ac): Require AC_C_RESTRICT. + sh-quote: Use 'restrict'. * lib/sh-quote.h (shell_quote_copy): Use 'restrict'. * modules/sh-quote (configure.ac): Require AC_C_RESTRICT. diff --git a/lib/system-quote.h b/lib/system-quote.h index d31d47f..419d3b8 100644 --- a/lib/system-quote.h +++ b/lib/system-quote.h @@ -77,7 +77,7 @@ extern size_t /* Copies the quoted string to p and returns the incremented p. There must be room for system_quote_length (string) + 1 bytes at p. */ extern char * - system_quote_copy (char *p, + system_quote_copy (char *restrict p, enum system_command_interpreter interpreter, const char *string); diff --git a/modules/system-quote b/modules/system-quote index f34d58a..9af74dc 100644 --- a/modules/system-quote +++ b/modules/system-quote @@ -10,6 +10,7 @@ sh-quote xalloc configure.ac: +AC_REQUIRE([AC_C_RESTRICT]) Makefile.am: lib_SOURCES += system-quote.h system-quote.c -- 2.7.4
>From 0423ac9fe82acd56e3b4108738cb3426c6216d6e Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Sun, 23 Feb 2020 12:33:37 +0100 Subject: [PATCH 15/29] regex-quote: Use 'restrict'. * lib/regex-quote.h (regex_quote_copy): Use 'restrict'. * modules/regex-quote (configure.ac): Require AC_C_RESTRICT. --- ChangeLog | 4 ++++ lib/regex-quote.h | 2 +- modules/regex-quote | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 525ecdb..7f4db6a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2020-02-23 Bruno Haible <br...@clisp.org> + regex-quote: Use 'restrict'. + * lib/regex-quote.h (regex_quote_copy): Use 'restrict'. + * modules/regex-quote (configure.ac): Require AC_C_RESTRICT. + system-quote: Use 'restrict'. * lib/system-quote.h (system_quote_copy): Use 'restrict'. * modules/system-quote (configure.ac): Require AC_C_RESTRICT. diff --git a/lib/regex-quote.h b/lib/regex-quote.h index 185f9fe..b6b299f 100644 --- a/lib/regex-quote.h +++ b/lib/regex-quote.h @@ -77,7 +77,7 @@ extern size_t /* Copies the quoted string to p and returns the incremented p. There must be room for regex_quote_length (string, spec) + 1 bytes at p. */ extern char * - regex_quote_copy (char *p, + regex_quote_copy (char *restrict p, const char *string, const struct regex_quote_spec *spec); /* Returns the freshly allocated quoted string. */ diff --git a/modules/regex-quote b/modules/regex-quote index 9b67ca2..4623339 100644 --- a/modules/regex-quote +++ b/modules/regex-quote @@ -11,6 +11,7 @@ xalloc mbuiter configure.ac: +AC_REQUIRE([AC_C_RESTRICT]) Makefile.am: lib_SOURCES += regex-quote.c -- 2.7.4
>From 8aa4a92942b7bf1183878ea75e378de02046fdc4 Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Sun, 23 Feb 2020 12:35:14 +0100 Subject: [PATCH 16/29] careadlinkat: Use 'restrict'. * lib/careadlinkat.h (careadlinkat): Use 'restrict'. * modules/careadlinkat (configure.ac): Require AC_C_RESTRICT. * modules/relocatable-prog-wrapper (configure.ac): Likewise. --- ChangeLog | 5 +++++ lib/careadlinkat.h | 2 +- modules/careadlinkat | 1 + modules/relocatable-prog-wrapper | 1 + 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 7f4db6a..fc7190c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2020-02-23 Bruno Haible <br...@clisp.org> + careadlinkat: Use 'restrict'. + * lib/careadlinkat.h (careadlinkat): Use 'restrict'. + * modules/careadlinkat (configure.ac): Require AC_C_RESTRICT. + * modules/relocatable-prog-wrapper (configure.ac): Likewise. + regex-quote: Use 'restrict'. * lib/regex-quote.h (regex_quote_copy): Use 'restrict'. * modules/regex-quote (configure.ac): Require AC_C_RESTRICT. diff --git a/lib/careadlinkat.h b/lib/careadlinkat.h index 584cfe9..a4a37b2 100644 --- a/lib/careadlinkat.h +++ b/lib/careadlinkat.h @@ -47,7 +47,7 @@ struct allocator; set errno. */ char *careadlinkat (int fd, char const *filename, - char *buffer, size_t buffer_size, + char *restrict buffer, size_t buffer_size, struct allocator const *alloc, ssize_t (*preadlinkat) (int, char const *, char *, size_t)); diff --git a/modules/careadlinkat b/modules/careadlinkat index 9dd7471..3f49aae 100644 --- a/modules/careadlinkat +++ b/modules/careadlinkat @@ -11,6 +11,7 @@ ssize_t unistd configure.ac: +AC_REQUIRE([AC_C_RESTRICT]) AC_CHECK_FUNCS_ONCE([readlinkat]) Makefile.am: diff --git a/modules/relocatable-prog-wrapper b/modules/relocatable-prog-wrapper index d70d63e..58af208 100644 --- a/modules/relocatable-prog-wrapper +++ b/modules/relocatable-prog-wrapper @@ -49,6 +49,7 @@ verify xalloc-oversized configure.ac: +AC_REQUIRE([AC_C_RESTRICT]) gl_FUNC_READLINK_SEPARATE gl_CANONICALIZE_LGPL_SEPARATE gl_MALLOCA -- 2.7.4
>From 8f6c42bf9ab0aed1caca1368e5a4dc4f6eef2842 Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Sun, 23 Feb 2020 13:04:13 +0100 Subject: [PATCH 17/29] crypto/arcfour: Use 'restrict'. * lib/arcfour.h (arcfour_stream): Use 'restrict'. * modules/crypto/arcfour (configure.ac): Require AC_C_RESTRICT. --- ChangeLog | 4 ++++ lib/arcfour.h | 2 +- modules/crypto/arcfour | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index fc7190c..4da2852 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2020-02-23 Bruno Haible <br...@clisp.org> + crypto/arcfour: Use 'restrict'. + * lib/arcfour.h (arcfour_stream): Use 'restrict'. + * modules/crypto/arcfour (configure.ac): Require AC_C_RESTRICT. + careadlinkat: Use 'restrict'. * lib/careadlinkat.h (careadlinkat): Use 'restrict'. * modules/careadlinkat (configure.ac): Require AC_C_RESTRICT. diff --git a/lib/arcfour.h b/lib/arcfour.h index b77df1a..cc4e37d 100644 --- a/lib/arcfour.h +++ b/lib/arcfour.h @@ -37,7 +37,7 @@ typedef struct before this function is called. */ extern void arcfour_stream (arcfour_context * context, - const char *inbuf, char *outbuf, size_t length); + const char *inbuf, char *restrict outbuf, size_t length); /* Initialize CONTEXT using encryption KEY of KEYLEN bytes. KEY should be 40 bits (5 bytes) or longer. The KEY cannot be zero diff --git a/modules/crypto/arcfour b/modules/crypto/arcfour index 43d1345..5e7736c 100644 --- a/modules/crypto/arcfour +++ b/modules/crypto/arcfour @@ -9,6 +9,7 @@ Depends-on: stdint configure.ac: +AC_REQUIRE([AC_C_RESTRICT]) Makefile.am: lib_SOURCES += arcfour.c -- 2.7.4
>From 9ca102bfeada4694bc288754d71475cae91c6620 Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Sun, 23 Feb 2020 13:05:57 +0100 Subject: [PATCH 18/29] crypto/arctwo: Use 'restrict'. * lib/arctwo.h (arctwo_encrypt, arctwo_decrypt): Use 'restrict'. * modules/crypto/arctwo (configure.ac): Require AC_C_RESTRICT. --- ChangeLog | 4 ++++ lib/arctwo.h | 4 ++-- modules/crypto/arctwo | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4da2852..22933fc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2020-02-23 Bruno Haible <br...@clisp.org> + crypto/arctwo: Use 'restrict'. + * lib/arctwo.h (arctwo_encrypt, arctwo_decrypt): Use 'restrict'. + * modules/crypto/arctwo (configure.ac): Require AC_C_RESTRICT. + crypto/arcfour: Use 'restrict'. * lib/arcfour.h (arcfour_stream): Use 'restrict'. * modules/crypto/arcfour (configure.ac): Require AC_C_RESTRICT. diff --git a/lib/arctwo.h b/lib/arctwo.h index 91f725f..05929bf 100644 --- a/lib/arctwo.h +++ b/lib/arctwo.h @@ -48,7 +48,7 @@ arctwo_setkey_ekb (arctwo_context *context, arctwo_setkey_ekb. */ extern void arctwo_encrypt (arctwo_context *context, const char *inbuf, - char *outbuf, size_t length); + char *restrict outbuf, size_t length); /* Decrypt INBUF of size LENGTH into OUTBUF. LENGTH must be a multiple of ARCTWO_BLOCK_SIZE. CONTEXT hold the decryption key, @@ -56,6 +56,6 @@ arctwo_encrypt (arctwo_context *context, const char *inbuf, arctwo_setkey_ekb. */ extern void arctwo_decrypt (arctwo_context *context, const char *inbuf, - char *outbuf, size_t length); + char *restrict outbuf, size_t length); #endif /* ARCTWO_H */ diff --git a/modules/crypto/arctwo b/modules/crypto/arctwo index e0bbb90..d439701 100644 --- a/modules/crypto/arctwo +++ b/modules/crypto/arctwo @@ -11,6 +11,7 @@ stdint bitrotate configure.ac: +AC_REQUIRE([AC_C_RESTRICT]) gl_ARCTWO Makefile.am: -- 2.7.4
>From 555b03cc26011dbe6364a6eb4efef8fe4837ebc5 Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Sun, 23 Feb 2020 13:08:14 +0100 Subject: [PATCH 19/29] crypto/rijndael: Use 'restrict'. * lib/rijndael-api-fst.h (rijndaelBlockEncrypt, rijndaelPadEncrypt, rijndaelBlockDecrypt, rijndaelPadDecrypt): Use 'restrict'. * modules/crypto/rijndael (configure.ac): Require AC_C_RESTRICT. --- ChangeLog | 5 +++++ lib/rijndael-api-fst.h | 8 ++++---- modules/crypto/rijndael | 1 + 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 22933fc..2e51ac6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2020-02-23 Bruno Haible <br...@clisp.org> + crypto/rijndael: Use 'restrict'. + * lib/rijndael-api-fst.h (rijndaelBlockEncrypt, rijndaelPadEncrypt, + rijndaelBlockDecrypt, rijndaelPadDecrypt): Use 'restrict'. + * modules/crypto/rijndael (configure.ac): Require AC_C_RESTRICT. + crypto/arctwo: Use 'restrict'. * lib/arctwo.h (arctwo_encrypt, arctwo_decrypt): Use 'restrict'. * modules/crypto/arctwo (configure.ac): Require AC_C_RESTRICT. diff --git a/lib/rijndael-api-fst.h b/lib/rijndael-api-fst.h index 0553acc..fa5f8d7 100644 --- a/lib/rijndael-api-fst.h +++ b/lib/rijndael-api-fst.h @@ -157,7 +157,7 @@ extern int rijndaelBlockEncrypt (rijndaelCipherInstance *cipher, const rijndaelKeyInstance *key, const char *input, size_t inputLen, - char *outBuffer); + char *restrict outBuffer); /* Encrypt data in INPUT, of INPUTOCTETS bytes length, placing the output in the pre-allocated OUTBUFFER which must hold at least @@ -172,7 +172,7 @@ extern int rijndaelPadEncrypt (rijndaelCipherInstance *cipher, const rijndaelKeyInstance *key, const char *input, size_t inputOctets, - char *outBuffer); + char *restrict outBuffer); /* Decrypt data in INPUT, of INPUTLEN/8 bytes length, placing the output in the pre-allocated OUTBUFFER which must hold at least @@ -185,7 +185,7 @@ extern int rijndaelBlockDecrypt (rijndaelCipherInstance *cipher, const rijndaelKeyInstance *key, const char *input, size_t inputLen, - char *outBuffer); + char *restrict outBuffer); /* Decrypt data in INPUT, of INPUTOCTETS bytes length, placing the output in the pre-allocated OUTBUFFER which must hold at least @@ -200,6 +200,6 @@ extern int rijndaelPadDecrypt (rijndaelCipherInstance *cipher, const rijndaelKeyInstance *key, const char *input, size_t inputOctets, - char *outBuffer); + char *restrict outBuffer); #endif /* __RIJNDAEL_API_FST_H */ diff --git a/modules/crypto/rijndael b/modules/crypto/rijndael index c5feae6..8dd0ae5 100644 --- a/modules/crypto/rijndael +++ b/modules/crypto/rijndael @@ -11,6 +11,7 @@ Depends-on: stdint configure.ac: +AC_REQUIRE([AC_C_RESTRICT]) Makefile.am: lib_SOURCES += rijndael-alg-fst.c rijndael-api-fst.c -- 2.7.4
>From 67f3b5ba252ac2962276ddc8e3431d4897549cf1 Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Sun, 23 Feb 2020 13:12:16 +0100 Subject: [PATCH 20/29] crypto/md2: Use 'restrict'. * lib/md2.h (md2_finish_ctx, md2_read_ctx, md2_buffer): Use 'restrict'. * modules/crypto/md2 (configure.ac): Require AC_C_RESTRICT. --- ChangeLog | 4 ++++ lib/md2.h | 7 ++++--- modules/crypto/md2 | 1 + 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2e51ac6..33a233e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2020-02-23 Bruno Haible <br...@clisp.org> + crypto/md2: Use 'restrict'. + * lib/md2.h (md2_finish_ctx, md2_read_ctx, md2_buffer): Use 'restrict'. + * modules/crypto/md2 (configure.ac): Require AC_C_RESTRICT. + crypto/rijndael: Use 'restrict'. * lib/rijndael-api-fst.h (rijndaelBlockEncrypt, rijndaelPadEncrypt, rijndaelBlockDecrypt, rijndaelPadDecrypt): Use 'restrict'. diff --git a/lib/md2.h b/lib/md2.h index 8fa912f..6cb58a9 100644 --- a/lib/md2.h +++ b/lib/md2.h @@ -57,13 +57,13 @@ extern void md2_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 *md2_finish_ctx (struct md2_ctx *ctx, void *resbuf); +extern void *md2_finish_ctx (struct md2_ctx *ctx, void *restrict resbuf); /* 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 *md2_read_ctx (const struct md2_ctx *ctx, void *resbuf); +extern void *md2_read_ctx (const struct md2_ctx *ctx, void *restrict resbuf); /* Compute MD2 message digest for bytes read from STREAM. The @@ -75,7 +75,8 @@ extern int md2_stream (FILE *stream, void *resblock); 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 *md2_buffer (const char *buffer, size_t len, void *resblock); +extern void *md2_buffer (const char *buffer, size_t len, + void *restrict resblock); # ifdef __cplusplus } diff --git a/modules/crypto/md2 b/modules/crypto/md2 index 0cc8499..d89eb95 100644 --- a/modules/crypto/md2 +++ b/modules/crypto/md2 @@ -9,6 +9,7 @@ Depends-on: minmax configure.ac: +AC_REQUIRE([AC_C_RESTRICT]) Makefile.am: lib_SOURCES += md2.c -- 2.7.4
>From 1fa14c798c517aae775149ebcbe5577a73515dfc Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Sun, 23 Feb 2020 13:13:38 +0100 Subject: [PATCH 21/29] 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. --- ChangeLog | 4 ++++ lib/md4.h | 7 ++++--- modules/crypto/md4 | 1 + 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 33a233e..bd40d1b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2020-02-23 Bruno Haible <br...@clisp.org> + 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. + crypto/md2: Use 'restrict'. * lib/md2.h (md2_finish_ctx, md2_read_ctx, md2_buffer): Use 'restrict'. * modules/crypto/md2 (configure.ac): Require AC_C_RESTRICT. diff --git a/lib/md4.h b/lib/md4.h index 4cb5aa0..37f3ff2 100644 --- a/lib/md4.h +++ b/lib/md4.h @@ -63,13 +63,13 @@ extern void md4_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 *md4_finish_ctx (struct md4_ctx *ctx, void *resbuf); +extern void *md4_finish_ctx (struct md4_ctx *ctx, void *restrict resbuf); /* 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 *md4_read_ctx (const struct md4_ctx *ctx, void *resbuf); +extern void *md4_read_ctx (const struct md4_ctx *ctx, void *restrict resbuf); /* Compute MD4 message digest for bytes read from STREAM. The @@ -81,7 +81,8 @@ extern int md4_stream (FILE * stream, void *resblock); 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 *md4_buffer (const char *buffer, size_t len, void *resblock); +extern void *md4_buffer (const char *buffer, size_t len, + void *restrict resblock); # ifdef __cplusplus } diff --git a/modules/crypto/md4 b/modules/crypto/md4 index 03d28e9..f5a5f16 100644 --- a/modules/crypto/md4 +++ b/modules/crypto/md4 @@ -12,6 +12,7 @@ stdalign stdint configure.ac: +AC_REQUIRE([AC_C_RESTRICT]) gl_MD4 Makefile.am: -- 2.7.4
>From 94ff8af6bf3399c077cb907e56424d61fdea79d4 Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> 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 <br...@clisp.org> + 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
>From 3b97754de802a01897a8ef4c09edf8487309705f Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> 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 <br...@clisp.org> + 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
>From cd6346e11a637b08d364399f900c8ddd3f44bf39 Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Sun, 23 Feb 2020 13:18:33 +0100 Subject: [PATCH 24/29] 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. --- ChangeLog | 5 +++++ lib/sha256.h | 20 ++++++++++++-------- modules/crypto/sha256-buffer | 1 + 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 379083a..6e782e1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2020-02-23 Bruno Haible <br...@clisp.org> + 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 1bc61d4..750d78a 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 e5a4703..055275a 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: -- 2.7.4
>From 734c22abe7d5d046a360415bb030baf2952d5807 Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Sun, 23 Feb 2020 13:20:18 +0100 Subject: [PATCH 25/29] crypto/sha512-buffer: Use 'restrict'. * lib/sha512.h (sha512_finish_ctx, sha384_finish_ctx, sha512_read_ctx, sha384_read_ctx, sha512_buffer, sha384_buffer): Use 'restrict'. * modules/crypto/sha512-buffer (configure.ac): Require AC_C_RESTRICT. --- ChangeLog | 5 +++++ lib/sha512.h | 20 ++++++++++++-------- modules/crypto/sha512-buffer | 1 + 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6e782e1..8701bea 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2020-02-23 Bruno Haible <br...@clisp.org> + crypto/sha512-buffer: Use 'restrict'. + * lib/sha512.h (sha512_finish_ctx, sha384_finish_ctx, sha512_read_ctx, + sha384_read_ctx, sha512_buffer, sha384_buffer): Use 'restrict'. + * modules/crypto/sha512-buffer (configure.ac): Require AC_C_RESTRICT. + 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'. diff --git a/lib/sha512.h b/lib/sha512.h index aaf35a5..21c2f58 100644 --- a/lib/sha512.h +++ b/lib/sha512.h @@ -70,8 +70,8 @@ extern void sha512_process_bytes (const void *buffer, size_t len, in first 64 (48) 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 *sha512_finish_ctx (struct sha512_ctx *ctx, void *resbuf); -extern void *sha384_finish_ctx (struct sha512_ctx *ctx, void *resbuf); +extern void *sha512_finish_ctx (struct sha512_ctx *ctx, void *restrict resbuf); +extern void *sha384_finish_ctx (struct sha512_ctx *ctx, void *restrict resbuf); /* Put result from CTX in first 64 (48) bytes following RESBUF. The result is @@ -80,16 +80,20 @@ extern void *sha384_finish_ctx (struct sha512_ctx *ctx, void *resbuf); IMPORTANT: On some systems it is required that RESBUF is correctly aligned for a 32 bits value. */ -extern void *sha512_read_ctx (const struct sha512_ctx *ctx, void *resbuf); -extern void *sha384_read_ctx (const struct sha512_ctx *ctx, void *resbuf); +extern void *sha512_read_ctx (const struct sha512_ctx *ctx, + void *restrict resbuf); +extern void *sha384_read_ctx (const struct sha512_ctx *ctx, + void *restrict resbuf); -/* Compute SHA512 (SHA384) message digest for LEN bytes beginning at BUFFER. The - result is always in little endian byte order, so that a byte-wise +/* Compute SHA512 (SHA384) 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 *sha512_buffer (const char *buffer, size_t len, void *resblock); -extern void *sha384_buffer (const char *buffer, size_t len, void *resblock); +extern void *sha512_buffer (const char *buffer, size_t len, + void *restrict resblock); +extern void *sha384_buffer (const char *buffer, size_t len, + void *restrict resblock); # endif /* Compute SHA512 (SHA384) message digest for bytes read from STREAM. diff --git a/modules/crypto/sha512-buffer b/modules/crypto/sha512-buffer index 32170a9..7c5f64d 100644 --- a/modules/crypto/sha512-buffer +++ b/modules/crypto/sha512-buffer @@ -16,6 +16,7 @@ stdint u64 configure.ac: +AC_REQUIRE([AC_C_RESTRICT]) gl_SHA512 Makefile.am: -- 2.7.4
>From 7d4a2b0c17628cc4e5fc159b26498564706ee1be Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Sun, 23 Feb 2020 13:22:42 +0100 Subject: [PATCH 26/29] crypto/*-buffer: Use 'restrict'. * lib/gl_openssl.h (GL_CRYPTO_FN (_finish_ctx), GL_CRYPTO_FN (_buffer), GL_CRYPTO_FN (_read_ctx)): Use 'restrict'. --- ChangeLog | 4 ++++ lib/gl_openssl.h | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8701bea..768083e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2020-02-23 Bruno Haible <br...@clisp.org> + crypto/*-buffer: Use 'restrict'. + * lib/gl_openssl.h (GL_CRYPTO_FN (_finish_ctx), GL_CRYPTO_FN (_buffer), + GL_CRYPTO_FN (_read_ctx)): Use 'restrict'. + crypto/sha512-buffer: Use 'restrict'. * lib/sha512.h (sha512_finish_ctx, sha384_finish_ctx, sha512_read_ctx, sha384_read_ctx, sha512_buffer, sha384_buffer): Use 'restrict'. diff --git a/lib/gl_openssl.h b/lib/gl_openssl.h index e5991d8..e985b1c 100644 --- a/lib/gl_openssl.h +++ b/lib/gl_openssl.h @@ -90,15 +90,15 @@ GL_CRYPTO_FN (_process_block) (const void *buf, size_t len, struct _gl_ctx *ctx) #endif GL_OPENSSL_INLINE void * -GL_CRYPTO_FN (_finish_ctx) (struct _gl_ctx *ctx, void *res) +GL_CRYPTO_FN (_finish_ctx) (struct _gl_ctx *ctx, void *restrict res) { OPENSSL_FN (_Final) ((unsigned char *) res, (_gl_CTX *) ctx); return res; } GL_OPENSSL_INLINE void * -GL_CRYPTO_FN (_buffer) (const char *buf, size_t len, void *res) +GL_CRYPTO_FN (_buffer) (const char *buf, size_t len, void *restrict res) { return OPENSSL_FN () ((const unsigned char *) buf, len, (unsigned char *) res); } GL_OPENSSL_INLINE void * -GL_CRYPTO_FN (_read_ctx) (const struct _gl_ctx *ctx, void *res) +GL_CRYPTO_FN (_read_ctx) (const struct _gl_ctx *ctx, void *restrict res) { /* Assume any unprocessed bytes in ctx are not to be ignored. */ _gl_CTX tmp_ctx = *(_gl_CTX *) ctx; -- 2.7.4
>From fd783467d341d2916ef5a798748c2bab20e6ec2a Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Sun, 23 Feb 2020 13:25:28 +0100 Subject: [PATCH 27/29] crypto/sm3: Use 'restrict'. * lib/sm3.h (sm3_finish_ctx, sm3_read_ctx, sm3_buffer): Use 'restrict'. * m4/sm3.m4 (gl_SM3): Require AC_C_RESTRICT. --- ChangeLog | 4 ++++ lib/sm3.h | 7 ++++--- m4/sm3.m4 | 5 ++++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 768083e..5a1c591 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2020-02-23 Bruno Haible <br...@clisp.org> + crypto/sm3: Use 'restrict'. + * lib/sm3.h (sm3_finish_ctx, sm3_read_ctx, sm3_buffer): Use 'restrict'. + * m4/sm3.m4 (gl_SM3): Require AC_C_RESTRICT. + crypto/*-buffer: Use 'restrict'. * lib/gl_openssl.h (GL_CRYPTO_FN (_finish_ctx), GL_CRYPTO_FN (_buffer), GL_CRYPTO_FN (_read_ctx)): Use 'restrict'. diff --git a/lib/sm3.h b/lib/sm3.h index e0bdd90..fd7cc98 100644 --- a/lib/sm3.h +++ b/lib/sm3.h @@ -75,18 +75,19 @@ extern void sm3_process_bytes (const void *buffer, size_t len, in first 32 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 *sm3_finish_ctx (struct sm3_ctx *ctx, void *resbuf); +extern void *sm3_finish_ctx (struct sm3_ctx *ctx, void *restrict resbuf); /* Put result from CTX in first 32 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 *sm3_read_ctx (const struct sm3_ctx *ctx, void *resbuf); +extern void *sm3_read_ctx (const struct sm3_ctx *ctx, void *restrict resbuf); /* Compute SM3 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 *sm3_buffer (const char *buffer, size_t len, void *resblock); +extern void *sm3_buffer (const char *buffer, size_t len, + void *restrict resblock); # endif /* Compute SM3 message digest for bytes read from STREAM. The diff --git a/m4/sm3.m4 b/m4/sm3.m4 index af8cb5a..cb31930 100644 --- a/m4/sm3.m4 +++ b/m4/sm3.m4 @@ -1,4 +1,4 @@ -# sm3.m4 serial 1 +# sm3.m4 serial 2 dnl Copyright (C) 2017-2020 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -6,6 +6,9 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_SM3], [ + dnl Prerequisites of lib/sm3.h. + AC_REQUIRE([AC_C_RESTRICT]) + dnl Prerequisites of lib/sm3.c. AC_REQUIRE([gl_BIGENDIAN]) -- 2.7.4
>From 7c69c58720bc2b3cdfca4a3d8564f77aa662e576 Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Sun, 23 Feb 2020 13:27:35 +0100 Subject: [PATCH 28/29] crypto/hmac-*: Use 'restrict'. * lib/hmac.h (hmac_md5, hmac_sha1, hmac_sha256, hmac_sha512): Use 'restrict'. * modules/crypto/hmac-md5 (configure.ac): Require AC_C_RESTRICT. * modules/crypto/hmac-sha1 (configure.ac): Likewise. * modules/crypto/hmac-sha256 (configure.ac): Likewise. * modules/crypto/hmac-sha512 (configure.ac): Likewise. --- ChangeLog | 8 ++++++++ lib/hmac.h | 8 ++++---- modules/crypto/hmac-md5 | 1 + modules/crypto/hmac-sha1 | 1 + modules/crypto/hmac-sha256 | 1 + modules/crypto/hmac-sha512 | 1 + 6 files changed, 16 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5a1c591..e62e1aa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2020-02-23 Bruno Haible <br...@clisp.org> + crypto/hmac-*: Use 'restrict'. + * lib/hmac.h (hmac_md5, hmac_sha1, hmac_sha256, hmac_sha512): Use + 'restrict'. + * modules/crypto/hmac-md5 (configure.ac): Require AC_C_RESTRICT. + * modules/crypto/hmac-sha1 (configure.ac): Likewise. + * modules/crypto/hmac-sha256 (configure.ac): Likewise. + * modules/crypto/hmac-sha512 (configure.ac): Likewise. + crypto/sm3: Use 'restrict'. * lib/sm3.h (sm3_finish_ctx, sm3_read_ctx, sm3_buffer): Use 'restrict'. * m4/sm3.m4 (gl_SM3): Require AC_C_RESTRICT. diff --git a/lib/hmac.h b/lib/hmac.h index a390702..135eb2a 100644 --- a/lib/hmac.h +++ b/lib/hmac.h @@ -27,7 +27,7 @@ RESBUF buffer. Return 0 on success. */ int hmac_md5 (const void *key, size_t keylen, - const void *buffer, size_t buflen, void *resbuf); + const void *buffer, size_t buflen, void *restrict resbuf); /* Compute Hashed Message Authentication Code with SHA-1, over BUFFER data of BUFLEN bytes using the KEY of KEYLEN bytes, writing the @@ -35,7 +35,7 @@ hmac_md5 (const void *key, size_t keylen, success. */ int hmac_sha1 (const void *key, size_t keylen, - const void *in, size_t inlen, void *resbuf); + const void *in, size_t inlen, void *restrict resbuf); /* Compute Hashed Message Authentication Code with SHA-256, over BUFFER data of BUFLEN bytes using the KEY of KEYLEN bytes, writing the @@ -43,7 +43,7 @@ hmac_sha1 (const void *key, size_t keylen, success. */ int hmac_sha256 (const void *key, size_t keylen, - const void *in, size_t inlen, void *resbuf); + const void *in, size_t inlen, void *restrict resbuf); /* Compute Hashed Message Authentication Code with SHA-512, over BUFFER data of BUFLEN bytes using the KEY of KEYLEN bytes, writing the @@ -51,6 +51,6 @@ hmac_sha256 (const void *key, size_t keylen, success. */ int hmac_sha512 (const void *key, size_t keylen, - const void *in, size_t inlen, void *resbuf); + const void *in, size_t inlen, void *restrict resbuf); #endif /* HMAC_H */ diff --git a/modules/crypto/hmac-md5 b/modules/crypto/hmac-md5 index a2bb9ed..8739c06 100644 --- a/modules/crypto/hmac-md5 +++ b/modules/crypto/hmac-md5 @@ -11,6 +11,7 @@ memxor crypto/md5 configure.ac: +AC_REQUIRE([AC_C_RESTRICT]) Makefile.am: lib_SOURCES += hmac-md5.c diff --git a/modules/crypto/hmac-sha1 b/modules/crypto/hmac-sha1 index 6bec8ae..d49d68d 100644 --- a/modules/crypto/hmac-sha1 +++ b/modules/crypto/hmac-sha1 @@ -11,6 +11,7 @@ memxor crypto/sha1 configure.ac: +AC_REQUIRE([AC_C_RESTRICT]) Makefile.am: lib_SOURCES += hmac-sha1.c diff --git a/modules/crypto/hmac-sha256 b/modules/crypto/hmac-sha256 index 8bd47e8..e67ffd4 100644 --- a/modules/crypto/hmac-sha256 +++ b/modules/crypto/hmac-sha256 @@ -11,6 +11,7 @@ memxor crypto/sha256 configure.ac: +AC_REQUIRE([AC_C_RESTRICT]) Makefile.am: lib_SOURCES += hmac-sha256.c diff --git a/modules/crypto/hmac-sha512 b/modules/crypto/hmac-sha512 index ad0e81b..53e11f8 100644 --- a/modules/crypto/hmac-sha512 +++ b/modules/crypto/hmac-sha512 @@ -11,6 +11,7 @@ memxor crypto/sha512 configure.ac: +AC_REQUIRE([AC_C_RESTRICT]) Makefile.am: lib_SOURCES += hmac-sha512.c -- 2.7.4
>From 46b3b6881a8a677c7a577ec4182b2eb4d5aa230c Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Sun, 23 Feb 2020 13:29:14 +0100 Subject: [PATCH 29/29] crypto/gc: Use 'restrict'. * lib/gc.h (gc_pbkdf2_hmac, gc_pbkdf2_sha1): Use 'restrict'. * m4/gc.m4 (gl_GC): Require AC_C_RESTRICT. --- ChangeLog | 4 ++++ lib/gc.h | 4 ++-- m4/gc.m4 | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index e62e1aa..5b5b35d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2020-02-23 Bruno Haible <br...@clisp.org> + crypto/gc: Use 'restrict'. + * lib/gc.h (gc_pbkdf2_hmac, gc_pbkdf2_sha1): Use 'restrict'. + * m4/gc.m4 (gl_GC): Require AC_C_RESTRICT. + crypto/hmac-*: Use 'restrict'. * lib/hmac.h (hmac_md5, hmac_sha1, hmac_sha256, hmac_sha512): Use 'restrict'. diff --git a/lib/gc.h b/lib/gc.h index 05fb8a3..87acdbc 100644 --- a/lib/gc.h +++ b/lib/gc.h @@ -185,12 +185,12 @@ extern Gc_rc gc_pbkdf2_hmac (Gc_hash hash, const char *P, size_t Plen, const char *S, size_t Slen, - unsigned int c, char *DK, size_t dkLen); + unsigned int c, char *restrict DK, size_t dkLen); extern Gc_rc gc_pbkdf2_sha1 (const char *P, size_t Plen, const char *S, size_t Slen, - unsigned int c, char *DK, size_t dkLen); + unsigned int c, char *restrict DK, size_t dkLen); /* TODO: diff --git a/m4/gc.m4 b/m4/gc.m4 index 0180d32..7f8f462 100644 --- a/m4/gc.m4 +++ b/m4/gc.m4 @@ -1,4 +1,4 @@ -# gc.m4 serial 12 +# gc.m4 serial 13 dnl Copyright (C) 2005-2020 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -25,4 +25,6 @@ AC_DEFUN([gl_GC], fi fi AC_SUBST([LIB_CRYPTO]) + + AC_REQUIRE([AC_C_RESTRICT]) ]) -- 2.7.4