]> Savannah Git Hosting - gnulib.git/commitdiff
crypto/sm3: Use 'restrict'.
authorBruno Haible <bruno@clisp.org>
Sun, 23 Feb 2020 12:25:28 +0000 (13:25 +0100)
committerBruno Haible <bruno@clisp.org>
Sun, 23 Feb 2020 12:25:28 +0000 (13:25 +0100)
* lib/sm3.h (sm3_finish_ctx, sm3_read_ctx, sm3_buffer): Use 'restrict'.
* m4/sm3.m4 (gl_SM3): Require AC_C_RESTRICT.

ChangeLog
lib/sm3.h
m4/sm3.m4

index 768083ebc82c79d62d602ea6b6e10f53a7c2f33f..5a1c59151b4352810732bfefe56e94fd6418b3e2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2020-02-23  Bruno Haible  <bruno@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'.
index e0bdd900db6bab061d51251b8e61998180a3dd75..fd7cc981d67c71c47bdda0b701fcfb3a11fc3ae3 100644 (file)
--- 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
index af8cb5a8bd8177562999935443020f3179bf61e5..cb31930eaec073396925c00f28370708546acfa7 100644 (file)
--- 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])