>From fd783467d341d2916ef5a798748c2bab20e6ec2a Mon Sep 17 00:00:00 2001 From: Bruno Haible 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 + 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